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

[SYCL] Test exception throwing for unsupported kernel feature #1314

Merged
merged 5 commits into from
Nov 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// REQUIRES: cpu

// RUN: %clangxx -fsycl -O0 %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out

#include <sycl/sycl.hpp>

[[sycl::device_has(sycl::aspect::gpu)]] void foo() {}

int main() {
sycl::queue q;
try {
q.submit([&](sycl::handler &h) { h.single_task([=]() { foo(); }); });
q.wait();
} catch (sycl::exception &e) {
const char *ErrMsg = "Required aspect gpu is not supported on the device";
if (std::string(e.what()).find(ErrMsg) != std::string::npos) {
return 0;
}
}
return 1;
}