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

[SYCL] Add test for sycl::is_compatible supports reqd_work_group_size #1528

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
28 changes: 28 additions & 0 deletions SYCL/OptionalKernelFeatures/is_compatible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
class KernelCPU;
class KernelGPU;
class KernelACC;
class GoodWGSize;
class WrongReqWGSize;

constexpr int SIZE = 2;

int main() {
bool Compatible = true;
Expand Down Expand Up @@ -42,5 +46,29 @@ int main() {
Called = true;
}

if (sycl::is_compatible<GoodWGSize>(Dev)) {
Q.submit([&](sycl::handler &h) {
h.parallel_for<class GoodWGSize>(
sycl::range<2>(4, 2),
[=](sycl::item<2> it) [[sycl::reqd_work_group_size(SIZE, SIZE)]] {});
});
Q.wait();
Compatible &= (Dev.get_info<sycl::info::device::max_work_group_size>() >
(SIZE * SIZE));
Called = true;
}

if (Dev.get_info<sycl::info::device::max_work_group_size>() > INT_MAX) {
Compatible &= true;
}
if (sycl::is_compatible<WrongReqWGSize>(Dev)) {
assert(false && "sycl::is_compatible<WrongReqWGSize> must be false");
Q.submit([&](sycl::handler &h) {
h.parallel_for<class WrongReqWGSize>(
sycl::range<1>(2),
[=](sycl::item<1> it) [[sycl::reqd_work_group_size(INT_MAX)]] {});
});
}

return (Compatible && Called) ? 0 : 1;
}