Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit fad1650

Browse files
committed
[SYCL] Add a built-in kernel test
Test that program manager throws an exception when actually trying to use built-in kernels, since they are not yet fully supported.
1 parent 18c2f11 commit fad1650

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
// RUN: %HOST_RUN_PLACEHOLDER %t.out
3+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
4+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
5+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
6+
7+
#include <CL/sycl.hpp>
8+
9+
int main() {
10+
sycl::queue q;
11+
auto ctx = q.get_context();
12+
auto dev = q.get_device();
13+
14+
auto ids = dev.get_info<sycl::info::device::built_in_kernel_ids>();
15+
16+
sycl::errc val = sycl::errc::success;
17+
std::string msg;
18+
try {
19+
sycl::get_kernel_bundle<sycl::bundle_state::executable>(ctx, {dev}, ids);
20+
} catch (sycl::exception &e) {
21+
val = sycl::errc(e.code().value());
22+
msg = e.what();
23+
}
24+
25+
if (!ids.empty()) { // exception only thrown when there built-in kernels
26+
if (val != sycl::errc::kernel_argument)
27+
return 1;
28+
if (msg !=
29+
"Attempting to use a built-in kernel. They are not fully supported")
30+
return 1;
31+
}
32+
33+
return 0;
34+
}

0 commit comments

Comments
 (0)