Skip to content

Commit 7997a2d

Browse files
committed
[SYCL] Add test for kernel annotations
1 parent fa945e6 commit 7997a2d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// RUN: %clang_cc1 -triple spir64-unknown-unknown -fsycl-is-device \
2+
// RUN: -S -emit-llvm %s -o %temp.ll
3+
// RUN: FileCheck -check-prefix=CHECK-SPIR --input-file %temp.ll %s
4+
5+
// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -fsycl-is-device \
6+
// RUN: -S -emit-llvm %s -o %temp.ll
7+
// RUN: FileCheck -check-prefix=CHECK-NVPTX --input-file %temp.ll %s
8+
9+
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -fsycl-is-device \
10+
// RUN: -S -emit-llvm %s -o %temp.ll
11+
// RUN: FileCheck -check-prefix=CHECK-AMDGCN --input-file %temp.ll %s
12+
13+
// The test makes sure that `[nnvm|amdgcn].annotations are correctly generated
14+
// only for their respective targets.
15+
16+
#include "Inputs/sycl.hpp"
17+
18+
sycl::handler H;
19+
20+
class Functor {
21+
public:
22+
void operator()() const {}
23+
};
24+
25+
// CHECK-SPIR-NOT: annotations =
26+
27+
// CHECK-NVPTX: nvvm.annotations = !{[[FIRST:![0-9]]], [[SECOND:![0-9]]]}
28+
// CHECK-NVPTX: [[FIRST]] = !{void ()* @_ZTS7Functor, !"kernel", i32 1}
29+
// CHECK-NVPTX: [[SECOND]] = !{void ()* @_ZTSZZ4mainENKUlRN2cl4sycl7handlerEE0_clES2_E5foo_2, !"kernel", i32 1}
30+
31+
// CHECK-AMDGCN: amdgcn.annotations = !{[[FIRST:![0-9]]], [[SECOND:![0-9]]]}
32+
// CHECK-AMDGCN: [[FIRST]] = !{void ()* @_ZTS7Functor, !"kernel", i32 1}
33+
// CHECK-AMDGCN: [[SECOND]] = !{void ()* @_ZTSZZ4mainENKUlRN2cl4sycl7handlerEE0_clES2_E5foo_2, !"kernel", i32 1}
34+
35+
int main() {
36+
sycl::queue q;
37+
q.submit([&](sycl::handler &cgh) {
38+
Functor foo{};
39+
cgh.single_task(foo);
40+
});
41+
42+
q.submit([&](cl::sycl::handler &cgh) {
43+
cgh.parallel_for<class foo_2>(cl::sycl::range<1>(1),
44+
[=](cl::sycl::item<1> item) {
45+
});
46+
});
47+
return 0;
48+
}

0 commit comments

Comments
 (0)