Skip to content

Commit d3556c6

Browse files
authored
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
2 parents 20004d4 + e9cb36b commit d3556c6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler/rustc_codegen_llvm/src/context.rs

+6
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ pub(crate) unsafe fn create_module<'ll>(
194194
target_data_layout = target_data_layout.replace("-i128:128", "");
195195
}
196196
}
197+
if llvm_version < (21, 0, 0) {
198+
if sess.target.arch == "nvptx64" {
199+
// LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961
200+
target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64");
201+
}
202+
}
197203

198204
// Ensure the data-layout values hardcoded remain the defaults.
199205
{

compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::spec::{
55
pub(crate) fn target() -> Target {
66
Target {
77
arch: "nvptx64".into(),
8-
data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(),
8+
data_layout: "e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(),
99
llvm_target: "nvptx64-nvidia-cuda".into(),
1010
metadata: crate::spec::TargetMetadata {
1111
description: Some("--emit=asm generates PTX code that runs on NVIDIA GPUs".into()),

0 commit comments

Comments
 (0)