-
Notifications
You must be signed in to change notification settings - Fork 89
[KHR] Tests for sycl_khr_max_work_group_queries extension #1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
2323c1c
a6f6d21
67ba23e
8a902a9
0d0c273
59362a6
e3573df
d574575
adf6ba2
045874b
9f7343b
d36b83f
96334b2
fc287a5
ea0f2b9
dbb91fa
5ccf182
c1e9564
a08e59b
bd06022
a2dd184
c472bbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(SYCL_CTS_ENABLE_MAX_NUM_WORK_GROUPS) | ||
Aympab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
file(GLOB test_cases_list *.cpp) | ||
|
||
add_cts_test(${test_cases_list}) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Conformance Test Suite | ||
// | ||
// Copyright (c) 2025 The Khronos Group Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
namespace max_num_work_groups_macro::tests { | ||
TEST_CASE( | ||
"the max_num_work_groups extension defines the " | ||
"SYCL_KHR_MAX_NUM_WORK_GROUPS macro", | ||
"[khr_max_num_work_groups]") { | ||
#ifndef SYCL_KHR_MAX_NUM_WORK_GROUPS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where/how is this macro set? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This macro is set by the SYCL implementation |
||
static_assert(false, "SYCL_KHR_MAX_NUM_WORK_GROUPS is not defined"); | ||
#endif | ||
} | ||
} // namespace max_num_work_groups_macro::tests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Conformance Test Suite | ||
// | ||
// Copyright (c) 2025 The Khronos Group Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
namespace max_num_work_groups::tests { | ||
|
||
template <int DIMENSION> | ||
void check_min_size() { | ||
auto queue = sycl_cts::util::get_cts_object::queue(); | ||
auto dev = queue.get_device(); | ||
|
||
check_get_info_param<khr::info::device::max_num_work_groups<DIMENSION>, | ||
sycl::range<DIMENSION>>(dev); | ||
|
||
if (dev.get_info<sycl::info::device::device_type>() == | ||
sycl::info::device_type::custom) { | ||
return; | ||
} else { | ||
Aympab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
auto max_work_groups = | ||
dev.get_info<khr::info::device::max_num_work_groups<DIMENSION>>(); | ||
|
||
for (int i = 0; i < DIMENSION; i++) { | ||
CHECK(max_work_groups[i] >= 1); | ||
} | ||
} | ||
} | ||
|
||
TEST_CASE("if the device is not info::device_type::custom, the minimal", | ||
"size in each dimension is (1,1,1)", "[khr_max_num_work_groups]") { | ||
check_min_size<1>(); | ||
check_min_size<2>(); | ||
check_min_size<3>(); | ||
} | ||
|
||
} // namespace max_num_work_groups::tests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/******************************************************************************* | ||
// | ||
// SYCL 2020 Conformance Test Suite | ||
// | ||
// Copyright (c) 2025 The Khronos Group Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
*******************************************************************************/ | ||
|
||
#include "../../common/common.h" | ||
|
||
namespace max_num_work_groups::tests { | ||
|
||
template <int DIMENSION> | ||
void check_submit() { | ||
auto queue = sycl_cts::util::get_cts_object::queue(); | ||
auto dev = queue.get_device(); | ||
|
||
auto max_work_groups_nd = | ||
dev.get_info<sycl::info::device::max_num_work_groups<DIMENSION>>(); | ||
auto local = sycl::range<DIMENSION>(); | ||
for (int i = 0; i < DIMENSION; i++) { | ||
local[i] = 1; | ||
// to avoid running too long | ||
keryell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
max_work_groups_nd[i] = std::min( | ||
max_work_groups_nd[i], | ||
static_cast<size_t>(std::numeric_limits<unsigned int>::max() + 1)); | ||
} | ||
|
||
int* a = sycl::malloc_shared<int>(1, queue); | ||
a[0] = 0; | ||
queue | ||
.parallel_for(sycl::nd_range(max_work_groups_nd, local), | ||
[=](auto i) { | ||
if (i.get_global_id(0) == 0) a[0] = 1; | ||
}) | ||
.wait_and_throw(); | ||
|
||
CHECK(a[0] == 1); | ||
|
||
sycl::free(a, queue); | ||
} | ||
|
||
TEST_CASE("max_num_work_groups nd_range submission [khr_max_num_work_groups]") { | ||
check_submit<1>(); | ||
check_submit<2>(); | ||
check_submit<3>(); | ||
} | ||
|
||
} // namespace max_num_work_groups::tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused. Should it be
SYCL_CTS_ENABLE_KHR_MAX_NUM_WORK_GROUPS
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bug vs line 130