Skip to content

Commit 4ce4c54

Browse files
committed
Update AMDGPU data layout
1 parent 2298168 commit 4ce4c54

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ pub(crate) unsafe fn create_module<'ll>(
206206
// LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961
207207
target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64");
208208
}
209+
if sess.target.arch == "amdgpu" {
210+
// LLVM 21 adds the address width for address space 8.
211+
// See https://github.com/llvm/llvm-project/pull/139419
212+
target_data_layout = target_data_layout.replace("p8:128:128:128:48", "p8:128:128")
213+
}
209214
}
210215

211216
// Ensure the data-layout values hardcoded remain the defaults.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, Target, TargetMetadata,
33
pub(crate) fn target() -> Target {
44
Target {
55
arch: "amdgpu".into(),
6-
data_layout: "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9".into(),
6+
data_layout: "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9".into(),
77
llvm_target: "amdgcn-amd-amdhsa".into(),
88
metadata: TargetMetadata {
99
description: Some("AMD GPU".into()),

0 commit comments

Comments
 (0)