Skip to content

Commit 85a228b

Browse files
committed
[SYCL] Only kernel 0 and 2
Signed-off-by: Hu, Peisen <[email protected]>
1 parent 2dc6484 commit 85a228b

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

sycl/test-e2e/GroupAlgorithm/root_group.cpp

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,32 @@ void testRootGroup() {
104104
}
105105
}
106106

107+
template <typename T> struct TestKernel2 {
108+
T m_testResults;
109+
TestKernel2(T &testResults_) : m_testResults(testResults_) {}
110+
void operator()(sycl::nd_item<1> it) const {
111+
const auto root = it.ext_oneapi_get_root_group();
112+
if (root.leader() || root.get_local_id() == 3) {
113+
m_testResults[0] = root.get_group_id() == sycl::id<1>(0);
114+
m_testResults[1] = root.leader() ? root.get_local_id() == sycl::id<1>(0)
115+
: root.get_local_id() == sycl::id<1>(3);
116+
m_testResults[2] = root.get_group_range() == sycl::range<1>(1);
117+
m_testResults[3] = root.get_local_range() == it.get_global_range();
118+
m_testResults[4] = root.get_max_local_range() == root.get_local_range();
119+
m_testResults[5] = root.get_group_linear_id() == 0;
120+
m_testResults[6] =
121+
root.get_local_linear_id() == root.get_local_id().get(0);
122+
m_testResults[7] = root.get_group_linear_range() == 1;
123+
m_testResults[8] =
124+
root.get_local_linear_range() == root.get_local_range().size();
125+
}
126+
}
127+
auto get(sycl::ext::oneapi::experimental::properties_tag) {
128+
return sycl::ext::oneapi::experimental::properties{
129+
sycl::ext::oneapi::experimental::use_root_sync};
130+
}
131+
};
132+
107133
void testRootGroupFunctions() {
108134
sycl::queue q;
109135
const auto bundle =
@@ -114,34 +140,14 @@ void testRootGroupFunctions() {
114140
.ext_oneapi_get_info<sycl::ext::oneapi::experimental::info::
115141
kernel_queue_specific::max_num_work_groups>(
116142
q, WorkGroupSize, 0);
117-
const auto props = sycl::ext::oneapi::experimental::properties{
118-
sycl::ext::oneapi::experimental::use_root_sync};
119143

120144
constexpr int testCount = 9;
121145
sycl::buffer<bool> testResultsBuf{sycl::range{testCount}};
122146
const auto range = sycl::nd_range<1>{maxWGs * WorkGroupSize, WorkGroupSize};
123147
q.submit([&](sycl::handler &h) {
124148
sycl::accessor testResults{testResultsBuf, h};
125-
h.parallel_for<class RootGroupFunctionsKernel>(
126-
range, props, [=](sycl::nd_item<1> it) {
127-
const auto root = it.ext_oneapi_get_root_group();
128-
if (root.leader() || root.get_local_id() == 3) {
129-
testResults[0] = root.get_group_id() == sycl::id<1>(0);
130-
testResults[1] = root.leader()
131-
? root.get_local_id() == sycl::id<1>(0)
132-
: root.get_local_id() == sycl::id<1>(3);
133-
testResults[2] = root.get_group_range() == sycl::range<1>(1);
134-
testResults[3] = root.get_local_range() == it.get_global_range();
135-
testResults[4] =
136-
root.get_max_local_range() == root.get_local_range();
137-
testResults[5] = root.get_group_linear_id() == 0;
138-
testResults[6] =
139-
root.get_local_linear_id() == root.get_local_id().get(0);
140-
testResults[7] = root.get_group_linear_range() == 1;
141-
testResults[8] =
142-
root.get_local_linear_range() == root.get_local_range().size();
143-
}
144-
});
149+
h.parallel_for<class RootGroupFunctionsKernel>(range,
150+
TestKernel2(testResults));
145151
});
146152
sycl::host_accessor testResults{testResultsBuf};
147153
for (int i = 0; i < testCount; i++) {

0 commit comments

Comments
 (0)