Skip to content

Commit 837b470

Browse files
authored
Merge pull request #1057 from dm-vodopyanov/test-impl-sycl_ext_oneapi_num_compute_units
Add test impl for `sycl_ext_oneapi_num_compute_units`
2 parents 4f79615 + 553915e commit 837b470

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_NON_UNIFORM_GROUPS_TESTS
106106
"Enable extension oneAPI non_uniform_groups tests" OFF
107107
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
108108

109+
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_NUM_COMPUTE_UNITS_TESTS
110+
"Enable extension oneAPI num_compute_units tests" OFF
111+
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
112+
109113
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_ROOT_GROUP_TESTS
110114
"Enable extension oneAPI root group tests" OFF
111115
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if(SYCL_CTS_ENABLE_EXT_ONEAPI_NUM_COMPUTE_UNITS_TESTS)
2+
set(test_cases_list
3+
device_info_descriptor.cpp
4+
)
5+
6+
add_cts_test(${test_cases_list})
7+
endif()
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*******************************************************************************
2+
//
3+
// SYCL 2020 Conformance Test Suite
4+
//
5+
// Copyright (c) 2025 The Khronos Group Inc.
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
//
19+
*******************************************************************************/
20+
21+
#include <sycl/sycl.hpp>
22+
23+
#include <catch2/catch_test_macros.hpp>
24+
25+
#include "../../common/get_cts_object.h"
26+
27+
#include <type_traits>
28+
#include <vector>
29+
30+
namespace num_compute_units::tests {
31+
32+
TEST_CASE("Test for info::device::num_compute_units descriptor",
33+
"[oneapi_num_compute_units]") {
34+
#ifndef SYCL_EXT_ONEAPI_NUM_COMPUTE_UNITS
35+
SKIP(
36+
"The sycl_ext_oneapi_num_compute_units device extension is not supported "
37+
"by an implementation");
38+
#else
39+
40+
sycl::device dev = sycl_cts::util::get_cts_object::device();
41+
42+
STATIC_REQUIRE(
43+
std::is_same_v<
44+
size_t,
45+
decltype(dev.get_info<
46+
sycl::ext::oneapi::info::device::num_compute_units>())>);
47+
48+
INFO("Checking that query returns a result greater than or equal to 1");
49+
REQUIRE(dev.get_info<sycl::ext::oneapi::info::device::num_compute_units>() >=
50+
1);
51+
52+
#endif
53+
}
54+
55+
} // namespace num_compute_units::tests

0 commit comments

Comments
 (0)