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

Commit 4c8ccf4

Browse files
[SYCL] Add test for sycl::is_compatible supports reqd_work_group_size (#1528)
Impl: intel/llvm#8056
1 parent 068869e commit 4c8ccf4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

SYCL/OptionalKernelFeatures/is_compatible.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
class KernelCPU;
1414
class KernelGPU;
1515
class KernelACC;
16+
class GoodWGSize;
17+
class WrongReqWGSize;
18+
19+
constexpr int SIZE = 2;
1620

1721
int main() {
1822
bool Compatible = true;
@@ -42,5 +46,29 @@ int main() {
4246
Called = true;
4347
}
4448

49+
if (sycl::is_compatible<GoodWGSize>(Dev)) {
50+
Q.submit([&](sycl::handler &h) {
51+
h.parallel_for<class GoodWGSize>(
52+
sycl::range<2>(4, 2),
53+
[=](sycl::item<2> it) [[sycl::reqd_work_group_size(SIZE, SIZE)]] {});
54+
});
55+
Q.wait();
56+
Compatible &= (Dev.get_info<sycl::info::device::max_work_group_size>() >
57+
(SIZE * SIZE));
58+
Called = true;
59+
}
60+
61+
if (Dev.get_info<sycl::info::device::max_work_group_size>() > INT_MAX) {
62+
Compatible &= true;
63+
}
64+
if (sycl::is_compatible<WrongReqWGSize>(Dev)) {
65+
assert(false && "sycl::is_compatible<WrongReqWGSize> must be false");
66+
Q.submit([&](sycl::handler &h) {
67+
h.parallel_for<class WrongReqWGSize>(
68+
sycl::range<1>(2),
69+
[=](sycl::item<1> it) [[sycl::reqd_work_group_size(INT_MAX)]] {});
70+
});
71+
}
72+
4573
return (Compatible && Called) ? 0 : 1;
4674
}

0 commit comments

Comments
 (0)