mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
28 lines
931 B
Rust
28 lines
931 B
Rust
//@ 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]) {}
|