Skip to content

Commit 85adfa4

Browse files
authored
[SYCL][NFC] Update sub-group info test (#2755)
Use generic SYCL features to make test backend-portable
1 parent 51ac08c commit 85adfa4

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

sycl/test/on-device/sub_group/info.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
// REQUIRES: opencl
1+
// See https://github.com/intel/llvm/issues/2922 for more info
2+
// UNSUPPORTED: cuda
23

34
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
4-
// RUN: %RUN_ON_HOST %t.out
55
// RUN: %CPU_RUN_PLACEHOLDER %t.out
66
// RUN: %GPU_RUN_PLACEHOLDER %t.out
7-
// RUN: %ACC_RUN_PLACEHOLDER %t.out
87

98
//==------------- info.cpp - SYCL sub_group parameters test ----*- C++ -*---==//
109
//
@@ -36,24 +35,26 @@ int main() {
3635
try {
3736
size_t max_wg_size = Device.get_info<info::device::max_work_group_size>();
3837
program Prog(Queue.get_context());
39-
/* TODO: replace with pure SYCL code when fixed problem with consumption
40-
* kernels defined using program objects on GPU device
4138
Prog.build_with_kernel_type<kernel_sg>();
4239
kernel Kernel = Prog.get_kernel<kernel_sg>();
40+
range<2> GlobalRange{50, 40};
41+
42+
buffer<double, 2> ABuf{GlobalRange}, BBuf{GlobalRange}, CBuf{GlobalRange};
4343

4444
Queue.submit([&](cl::sycl::handler &cgh) {
45+
auto A = ABuf.get_access<access::mode::read_write>(cgh);
46+
auto B = BBuf.get_access<access::mode::read>(cgh);
47+
auto C = CBuf.get_access<access::mode::read>(cgh);
4548
cgh.parallel_for<kernel_sg>(
46-
nd_range<2>(range<2>(50, 40), range<2>(10, 20)), Kernel,
47-
[=](nd_item<2> index) {});
48-
});*/
49-
Prog.build_with_source("kernel void "
50-
"kernel_sg(global double* a, global double* b, "
51-
"global double* c) {*a=*b+*c; }\n");
52-
kernel Kernel = Prog.get_kernel("kernel_sg");
49+
nd_range<2>(GlobalRange, range<2>(10, 20)), [=](nd_item<2> index) {
50+
const id<2> GlobalID = index.get_global_id();
51+
A[GlobalID] = B[GlobalID] * C[GlobalID];
52+
});
53+
});
5354
uint32_t Res = 0;
5455

55-
/* sub_group_sizes can be quared only of cl_intel_required_subgroup_size
56-
* extention is supported by device*/
56+
/* sub_group_sizes can be queried only if cl_intel_required_subgroup_size
57+
* extension is supported by device*/
5758
if (Device.has_extension("cl_intel_required_subgroup_size")) {
5859
auto sg_sizes = Device.get_info<info::device::sub_group_sizes>();
5960
for (auto r : {range<3>(3, 4, 5), range<3>(1, 1, 1), range<3>(4, 2, 1),

0 commit comments

Comments
 (0)