forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslice_device.rs
More file actions
27 lines (23 loc) · 931 Bytes
/
slice_device.rs
File metadata and controls
27 lines (23 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//@ add-minicore
//@ revisions: amdgpu nvptx
//@[nvptx] compile-flags: -Copt-level=3 -Zunstable-options -Zoffload=Device --target nvptx64-nvidia-cuda --crate-type=rlib
//@[nvptx] needs-llvm-components: nvptx
//@[amdgpu] compile-flags: -Copt-level=3 -Zunstable-options -Zoffload=Device --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib
//@[amdgpu] needs-llvm-components: amdgpu
//@ no-prefer-dynamic
//@ needs-offload
#![feature(abi_gpu_kernel, rustc_attrs, no_core)]
#![no_core]
extern crate minicore;
// CHECK: ; Function Attrs
// nvptx-NEXT: define ptx_kernel void @foo
// amdgpu-NEXT: define amdgpu_kernel void @foo
// CHECK-SAME: ptr readnone captures(none) %dyn_ptr
// nvptx-SAME: [2 x i64] %0
// amdgpu-SAME: ptr noalias {{.*}} %0, i64 {{.*}} %1
// CHECK-NEXT: entry:
// CHECK-NEXT: ret void
// CHECK-NEXT: }
#[unsafe(no_mangle)]
#[rustc_offload_kernel]
pub unsafe extern "gpu-kernel" fn foo(x: &[f32]) {}