Skip to content

Commit cd95be7

Browse files
authored
[SYCL] Test for multi-dim subscript operator for atomic accessor (intel#218)
Signed-off-by: mdimakov <[email protected]>
1 parent 2bdc36e commit cd95be7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

SYCL/Basic/accessor/accessor.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,29 @@ int main() {
166166
}
167167
}
168168

169+
// Device accessor with 2-dimensional subscript operators for atomic accessor
170+
// check compile error
171+
{
172+
cl::sycl::queue queue;
173+
if (!queue.is_host()) {
174+
cl::sycl::range<2> range(1, 1);
175+
int Arr[] = {2};
176+
{
177+
cl::sycl::buffer<int, 1> Buf(Arr, 1);
178+
queue.submit([&](cl::sycl::handler &cgh) {
179+
auto acc =
180+
cl::sycl::accessor<int, 2, cl::sycl::access::mode::atomic,
181+
cl::sycl::access::target::local>(range, cgh);
182+
cgh.parallel_for<class dim2_subscr_atomic>(
183+
cl::sycl::nd_range<2>{range, range}, [=](cl::sycl::nd_item<2>) {
184+
sycl::atomic<int, sycl::access::address_space::local_space>
185+
value = acc[0][0];
186+
});
187+
});
188+
}
189+
}
190+
}
191+
169192
// Device accessor with 3-dimensional subscript operators.
170193
{
171194
sycl::queue Queue;

0 commit comments

Comments
 (0)