Skip to content

Commit 6a9115b

Browse files
committed
Add test for amdgpu kernel descriptor
Add a test that checks that the .kd symbol is exported for gpu kernels.
1 parent e520907 commit 6a9115b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/run-make/amdgpu-kd/foo.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![allow(internal_features)]
2+
#![feature(no_core, lang_items, abi_gpu_kernel)]
3+
#![no_core]
4+
#![no_std]
5+
6+
// This is needed because of #![no_core]:
7+
#[lang = "sized"]
8+
trait Sized {}
9+
10+
#[no_mangle]
11+
extern "gpu-kernel" fn kernel() {}

tests/run-make/amdgpu-kd/rmake.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Checks that the produced object has the .kd symbol exported.
2+
3+
use run_make_support::{cmd, dynamic_lib_name, llvm_readobj, run_in_tmpdir, rustc};
4+
5+
fn main() {
6+
rustc()
7+
.crate_name("foo")
8+
.target("amdgcn-amd-amdhsa")
9+
.arg("-Ctarget-cpu=gfx900")
10+
.crate_type("cdylib")
11+
.input("foo.rs")
12+
.run();
13+
llvm_readobj().input("foo.elf").symbols().run().assert_stdout_contains("kernel.kd");
14+
}

0 commit comments

Comments
 (0)