Skip to content

Commit aea98ad

Browse files
nnethercoteLegNeato
authored andcommitted
Update the data layout.
Recent NVVM IR docs (e.g. https://docs.nvidia.com/cuda/archive/13.0.0/nvvm-ir-spec/index.html#data-layout) mention four data layouts, which I will abbreviate as: - 64-bit-with-128-bit-integers - 32-bit-with-128-bit-integers - 64-bit-without-128-bit-integers - 32-bit-without-128-bit-integers These docs have said the same thing for every CUDA version from 12.0 to 13.0: - 64-bit-with-128-bit-integers is "supported". - The others are "deprecated and will be removed in a future release". We currently use 64-bit-without-128-bit integers. This works fine on CUDA 12.8, but doesn't work on CUDA 13.0 -- libNVVM spits out "DataLayoutError: Unsupported integer alignment". Even though the docs haven't changed, 13.0 seems to be the first version actually enforcing the deprecation. (Or maybe "deprecated" has become "removed" and the docs haven't caught up, given that there's no apparent way to avoid the error.) This commit changes our data layout from 64-bit-without-128-bit-integers to 64-bit-with-128-bit-integers. This lets commands like `cargo run -p compiletests -- --target-arch compute_75` run successfully on my ASUS GX10 with CUDA 13.0. There appear to be no ill side-effects.
1 parent 1eca961 commit aea98ad

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed
-1.43 KB
Binary file not shown.

crates/rustc_codegen_nvvm/libintrinsics.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
; if you update this make sure to update libintrinsics.bc by running llvm-as (make sure you are using llvm-7 or it won't work when
66
; loaded into libnvvm).
77
source_filename = "libintrinsics"
8-
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
8+
; This data layout must match `DATA_LAYOUT` in `crates/rustc_codegen_nvvm/src/target.rs`.
9+
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
910
target triple = "nvptx64-nvidia-cuda"
1011

1112
; warp ----

crates/rustc_codegen_nvvm/src/target.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use rustc_target::spec::{
33
LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetMetadata, TargetOptions,
44
};
55

6-
pub const DATA_LAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64";
6+
// This data layout must match `datalayout` in `crates/rustc_codegen_nvvm/libintrinsics.ll`.
7+
pub const DATA_LAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64";
78
pub const TARGET_TRIPLE: &str = "nvptx64-nvidia-cuda";
89
pub const POINTER_WIDTH: u32 = 64;
910

0 commit comments

Comments
 (0)