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

Commit bde7457

Browse files
authored
[SYCL] Test exception throwing for unsupported kernel feature (#1314)
Related compiler changes: intel/llvm#6989 and intel/llvm#7419
1 parent 94fa3c8 commit bde7457

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// REQUIRES: cpu
2+
3+
// RUN: %clangxx -fsycl -O0 %s -o %t.out
4+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
5+
6+
#include <sycl/sycl.hpp>
7+
8+
[[sycl::device_has(sycl::aspect::gpu)]] void foo() {}
9+
10+
int main() {
11+
sycl::queue q;
12+
try {
13+
q.submit([&](sycl::handler &h) { h.single_task([=]() { foo(); }); });
14+
q.wait();
15+
} catch (sycl::exception &e) {
16+
const char *ErrMsg = "Required aspect gpu is not supported on the device";
17+
if (std::string(e.what()).find(ErrMsg) != std::string::npos) {
18+
return 0;
19+
}
20+
}
21+
return 1;
22+
}

0 commit comments

Comments
 (0)