Skip to content

Commit

Permalink
Unrolled build for rust-lang#136545
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#136545 - durin42:nvptx64-align, r=nikic

nvptx64: update default alignment to match LLVM 21

This changed in llvm/llvm-project@91cb8f5. The commit itself is mostly about some intrinsic instructions, but as an aside it also mentions something about addrspace for tensor memory, which I believe is what this string is telling us.

`@rustbot` label: +llvm-main
  • Loading branch information
rust-timer authored Feb 16, 2025
2 parents c3fe9e7 + e9cb36b commit 3fabdca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ pub(crate) unsafe fn create_module<'ll>(
target_data_layout = target_data_layout.replace("-i128:128", "");
}
}
if llvm_version < (21, 0, 0) {
if sess.target.arch == "nvptx64" {
// LLVM 21 updated the default layout on nvptx: /~https://github.com/llvm/llvm-project/pull/124961
target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64");
}
}

// Ensure the data-layout values hardcoded remain the defaults.
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::spec::{
pub(crate) fn target() -> Target {
Target {
arch: "nvptx64".into(),
data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(),
data_layout: "e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(),
llvm_target: "nvptx64-nvidia-cuda".into(),
metadata: crate::spec::TargetMetadata {
description: Some("--emit=asm generates PTX code that runs on NVIDIA GPUs".into()),
Expand Down

0 comments on commit 3fabdca

Please sign in to comment.