Skip to content

Commit 2371802

Browse files
committed
Auto merge of #146148 - Flakebi:global-addrspace-test, r=Mark-Simulacrum
Add amdgpu test for addrspacecasting global vars and the gpu-kernel calling convention Add two tests that can now be added, as the amdgpu is merged. - Global variables are casted to the default address space since #135026 - gpu-kernel calling convention, translatos to amdgpu_kernel #135047 Tracking issue: #135024
2 parents 55b9b4d + 15c6585 commit 2371802

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎tests/auxiliary/minicore.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,14 @@ impl Add<isize> for isize {
179179

180180
#[lang = "sync"]
181181
traitSync{}
182-
implSyncforu8{}
182+
impl_marker_trait!(
183+
Sync => [
184+
char,bool,
185+
isize,i8,i16,i32,i64,i128,
186+
usize,u8,u16,u32,u64,u128,
187+
f16,f32,f64, f128,
188+
]
189+
);
183190

184191
#[lang = "drop_in_place"]
185192
fndrop_in_place<T>(_:*mutT){}

‎tests/codegen-llvm/amdgpu-addrspacecast.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,12 @@ pub fn ref_of_local(f: fn(&i32)) {
1616
let i = 0;
1717
f(&i);
1818
}
19+
20+
// CHECK-LABEL: @ref_of_global
21+
// CHECK: addrspacecast (ptr addrspace(1) @I to ptr)
22+
#[no_mangle]
23+
pubfnref_of_global(f:fn(&i32)){
24+
#[no_mangle]
25+
staticI:i32 = 0;
26+
f(&I);
27+
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Checks that the gpu-kernel calling convention correctly translates to LLVM calling conventions.
22

33
//@ add-core-stubs
4-
//@ revisions: nvptx
4+
//@ revisions: amdgpu nvptx
5+
//@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900
6+
//@ [amdgpu] needs-llvm-components: amdgpu
57
//@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda
68
//@ [nvptx] needs-llvm-components: nvptx
79
#![feature(no_core, lang_items, abi_gpu_kernel)]
@@ -10,6 +12,7 @@
1012
externcrate minicore;
1113
use minicore::*;
1214

15+
// amdgpu: define amdgpu_kernel void @fun(i32
1316
// nvptx: define ptx_kernel void @fun(i32
1417
#[no_mangle]
1518
pubextern"gpu-kernel"fnfun(_:i32){}

0 commit comments

Comments
 (0)