Skip to content

Commit

Permalink
[SYCL] Add test for sycl::is_compatible supports reqd_work_group_size (
Browse files Browse the repository at this point in the history
  • Loading branch information
dm-vodopyanov authored Jan 27, 2023
1 parent 60ab99e commit 59bd07a
Showing 1 changed file with 28 additions and 0 deletions.
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;
}

0 comments on commit 59bd07a

Please sign in to comment.