Skip to content

Commit cb2a6bd

Browse files
committed
Merge remote-tracking branch 'upstream/main' into current-device-tests
2 parents c06cd72 + b851fcb commit cb2a6bd

File tree

16 files changed

+1017
-61
lines changed

16 files changed

+1017
-61
lines changed

.github/workflows/cts_ci.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
# Pushing container images requires DockerHub credentials, provided as GitHub secrets.
1313
# Secrets are not available for runs triggered from external branches (forks).
1414
check-secrets:
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-latest
1616
outputs:
1717
available: ${{ steps.check.outputs.available }}
1818
steps:
@@ -25,7 +25,7 @@ jobs:
2525
build-common-base-image:
2626
needs: check-secrets
2727
if: needs.check-secrets.outputs.available == 'yes'
28-
runs-on: ubuntu-20.04
28+
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
3131
uses: actions/checkout@v3
@@ -49,7 +49,7 @@ jobs:
4949

5050
build-image-for-sycl-impl:
5151
needs: build-common-base-image
52-
runs-on: ubuntu-20.04
52+
runs-on: ubuntu-latest
5353
strategy:
5454
fail-fast: false
5555
# NB: Don't forget to update versions in compile-cts step as well
@@ -86,30 +86,27 @@ jobs:
8686
8787
check-clang-format:
8888
if: github.event_name == 'pull_request'
89-
runs-on: "ubuntu-22.04"
89+
90+
runs-on: ubuntu-latest
9091
steps:
91-
- name: Checkout
92-
uses: actions/checkout@v3
92+
- uses: actions/checkout@v4
93+
- uses: cpp-linter/cpp-linter-action@main
94+
id: linter
95+
continue-on-error: true
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9398
with:
94-
fetch-depth: 0 # Need to check out base branch as well
95-
- name: Run clang-format on changed files
96-
run: |
97-
set -o errexit -o pipefail -o noclobber -o nounset
98-
DIFF=$( git diff -U0 --no-color ${{ github.event.pull_request.base.sha }} | clang-format-diff-14 -p1 )
99-
if [ ! -z "$DIFF" ]; then
100-
echo 'The following changes are not formatted according to `clang-format`:' >> $GITHUB_STEP_SUMMARY
101-
echo '```diff' >> $GITHUB_STEP_SUMMARY
102-
echo "$DIFF" >> $GITHUB_STEP_SUMMARY
103-
echo '```' >> $GITHUB_STEP_SUMMARY
104-
echo "Not all files are formatted according to clang-format. See workflow summary for details."
105-
exit 1 # Fail CI run
106-
fi
99+
style: file
100+
tidy-checks: '-*' # Disable all clang-tidy checks for now. Enable checks as needed.
101+
lines-changed-only: true
102+
format-review: true
103+
passive-reviews: true
107104

108105
compile-cts:
109106
needs: build-image-for-sycl-impl
110107
# Wait for Docker image builds, but run even if they're skipped
111108
if: always()
112-
runs-on: ubuntu-20.04
109+
runs-on: ubuntu-latest
113110
strategy:
114111
fail-fast: false
115112
# NB: Don't forget to update versions in build-image-for-sycl-impl step as well

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS
5151
add_cts_option(SYCL_CTS_ENABLE_KHR_TESTS
5252
"Enable all extension Khronos tests" OFF)
5353

54+
add_cts_option(SYCL_CTS_SYCL_NEXT_TESTS
55+
"Enable all SYCL Next tests" OFF)
56+
5457
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_PROPERTIES_TESTS
5558
"Enable extension oneAPI compile-time property list tests" OFF
5659
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
@@ -103,6 +106,10 @@ add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_NON_UNIFORM_GROUPS_TESTS
103106
"Enable extension oneAPI non_uniform_groups tests" OFF
104107
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
105108

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+
106113
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_ROOT_GROUP_TESTS
107114
"Enable extension oneAPI root group tests" OFF
108115
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
@@ -123,6 +130,10 @@ add_cts_option(SYCL_CTS_ENABLE_KHR_DEFAULT_CONTEXT_TESTS
123130
"Enable extension Khronos default_context tests" OFF
124131
FORCE_ON ${SYCL_CTS_ENABLE_KHR_TESTS})
125132

133+
add_cts_option(SYCL_CTS_ENABLE_KHR_FREE_FUNCTION_COMMANDS
134+
"Enable extension Khronos free_function_commands tests" OFF
135+
FORCE_ON ${SYCL_CTS_ENABLE_KHR_TESTS})
136+
126137
add_cts_option(SYCL_CTS_ENABLE_KHR_QUEUE_EMPTY_QUERY_TESTS
127138
"Enable extension Khronos queue_empty_query tests" OFF
128139
FORCE_ON ${SYCL_CTS_ENABLE_KHR_TESTS})

cmake/FindDPCPP.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ set(DPCPP_FLAGS "${DPCPP_FLAGS};-fno-sycl-id-queries-fit-in-int")
2929
if(DEFINED DPCPP_TARGET_TRIPLES)
3030
set(DPCPP_FLAGS "${DPCPP_FLAGS};-fsycl-targets=${DPCPP_TARGET_TRIPLES};")
3131
message(STATUS "DPC++ compiling to triples: ${DPCPP_TARGET_TRIPLES}")
32-
if(${DPCPP_TARGET_TRIPLES} MATCHES ".*-nvidia-cuda-.*")
33-
add_definitions(-DSYCL_CTS_INTEL_PI_CUDA)
34-
endif()
3532
endif()
3633
message(STATUS "DPC++ compiler flags: `${DPCPP_FLAGS}`")
3734

@@ -72,6 +69,13 @@ if(DPCPP_ENABLE_PREVIEW_CHANGES)
7269
set(CMAKE_CXX_FLAGS "-fpreview-breaking-changes ${CMAKE_CXX_FLAGS}")
7370
endif()
7471

72+
cmake_dependent_option(DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS
73+
"Enable unfinished KHR extensions for DPC++ compiler" ON
74+
"SYCL_CTS_ENABLE_KHR_TESTS" OFF)
75+
if(DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS)
76+
add_definitions(-D__DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS)
77+
endif()
78+
7579
add_library(DPCPP::Runtime INTERFACE IMPORTED GLOBAL)
7680
set_target_properties(DPCPP::Runtime PROPERTIES
7781
INTERFACE_COMPILE_OPTIONS "${DPCPP_FLAGS}"
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
:sectnums:
2+
:xrefstyle: short
3+
4+
= Test plan for SYCL extension KHR group interface
5+
6+
This is a test plan for an extension that defines a new interface for groups
7+
described in
8+
https://github.com/KhronosGroup/SYCL-Docs/blob/b05db85e72f489ea10d8b87f111624719425614d/adoc/extensions/sycl_khr_group_interface.adoc[sycl_khr_group_interface].
9+
10+
== Testing scope
11+
12+
=== Device coverage
13+
14+
All of the tests described below are performed only on the default device that
15+
is selected on the CTS command line.
16+
17+
=== Feature test macro
18+
19+
The tests should statically check that the `SYCL_KHR_GROUP_INTERFACE` macro is
20+
defined.
21+
22+
== Tests
23+
24+
The test cases should test the interface of each of the following classes
25+
defined in the extension:
26+
27+
* `sycl::khr::work_group<Dimensions>`
28+
* `sycl::khr::sub_group`
29+
* `sycl::khr::work_item<sycl::khr::work_group<Dimensions>>`
30+
* `sycl::khr::work_item<sycl::khr::sub_group>`
31+
32+
These test cases should run ND-range kernels with `Dimensions` equal to 1, 2,
33+
and 3.
34+
35+
=== Test description
36+
37+
==== `work_group<Dimensions>` class
38+
39+
In the kernel scope, do the following:
40+
41+
* Define a `sycl::khr::work_group<Dimensions>` named `work_group` using `it.get_group()`.
42+
* Define a `sycl::group<Dimensions>` named `group` using `it.get_group()`.
43+
* Check that `work_group.id()` returns a `work_group<Dimensions>::id_type`.
44+
* Check that `work_group.id() == group.get_group_id()`.
45+
* Check that `work_group.linear_id()` returns a `work_group<Dimensions>::linear_id_type`.
46+
* Check that `work_group.linear_id() == group.get_group_linear_id()`.
47+
* Check that `work_group.range()` returns a `work_group<Dimensions>::range_type`.
48+
* Check that `work_group.range() == group.get_group_range()`.
49+
* Check that `work_group.size()` returns a `work_group<Dimensions>::size_type`.
50+
* Check that `work_group.size() == group.get_local_linear_range()`.
51+
* Check that `sycl::khr::leader_of(work_group)` returns a `bool`.
52+
* Check that `sycl::khr::leader_of(work_group) == group.leader()`.
53+
54+
Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following:
55+
56+
* Check that `work_group.extents()` returns a `work_group<Dimensions>::extents_type`.
57+
* Check that `work_group.extents() == std::dextents<std::size_t, Dimensions>(group.get_local_range()[0], ...)`.
58+
* Check that `work_group.extent(0)` returns a `work_group<Dimensions>::extents_type::index_type`.
59+
* For each dimension, `d`, check that `work_group.extent(d) == work_group.extents().extent(d)`
60+
* Check that `work_group<Dimensions>::rank()` returns a `work_group<Dimensions>::extents_type::rank_type`.
61+
* Check that `decltype(work_group)::rank() == decltype(work_group.extents())::rank()`
62+
* Check that `work_group<Dimensions>::rank_dynamic()` returns a `work_group<Dimensions>::extents_type::rank_type`.
63+
* Check that `decltype(work_group)::rank_dynamic() == decltype(work_group.extents())::rank_dynamic()`
64+
* Check that `work_group<Dimensions>::static_extent(0)` returns a `std::size_t`.
65+
* For each dimension, `d`, check that `decltype(work_group)::static_extent(d) == decltype(work_group.extents())::static_extent(d)`
66+
67+
==== `sub_group` class
68+
69+
In the kernel scope, do the following:
70+
71+
* Define a `sycl::khr::sub_group` name `sub_group` using `it.get_sub_group()`.
72+
* Define a `sycl::sub_group` name `group` using `it.get_sub_group()`.
73+
* Check that `sub_group.id()` returns a `sub_group::id_type`.
74+
* Check that `sub_group.id() == group.get_group_id()`.
75+
* Check that `sub_group.linear_id()` returns a `sub_group::linear_id_type`.
76+
* Check that `sub_group.linear_id() == group.get_group_linear_id()`.
77+
* Check that `sub_group.range()` returns a `sub_group::range_type`.
78+
* Check that `sub_group.range() == group.get_group_range()`.
79+
* Check that `sub_group.size()` returns a `sub_group::size_type`.
80+
* Check that `sub_group.size() == group.get_local_range()[0]`.
81+
* Check that `sub_group.max_size()` returns a `sub_group::size_type`.
82+
* Check that `sub_group.max_size() == group.get_max_local_range()[0]`.
83+
* Check that `sycl::khr::leader_of(sub_group)` returns a `bool`.
84+
* Check that `sycl::khr::leader_of(sub_group) == group.leader()`.
85+
86+
Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following:
87+
88+
* Check that `sub_group.extents()` returns a `sub_group::extents_type`.
89+
* Check that `sub_group.extents() == std::dextents<std::uint32_t, 1>(group.get_local_linear_range())`.
90+
* Check that `sub_group.extent(0)` returns a `sub_group::extents_type::index_type`.
91+
* Check that `sub_group.extent(0) == sub_group.extents().extent(0)`
92+
* Check that `sub_group::rank()` returns a `sub_group::extents_type::rank_type`.
93+
* Check that `decltype(sub_group)::rank() == decltype(sub_group.extents())::rank()`
94+
* Check that `sub_group::rank_dynamic()` returns a `sub_group::extents_type::rank_type`.
95+
* Check that `decltype(sub_group)::rank_dynamic() == decltype(sub_group.extents())::rank_dynamic()`
96+
* Check that `sub_group::static_extent(0)` returns a `std::size_t`.
97+
* check that `decltype(sub_group)::static_extent(0) == decltype(sub_group.extents())::static_extent(0)`
98+
99+
==== `work_item<work_group<Dimensions>>` class
100+
101+
In the kernel scope, do the following:
102+
103+
* Define a `sycl::group<Dimensions>` named `group` using `it.get_group()`.
104+
* Define a `sycl::khr::work_group<Dimensions>` named `work_group` using `it.get_group()`.
105+
* Define a type alias `wg_item` equal to `sycl::khr::work_item<sycl::khr::work_group<Dimensions>>`
106+
* Define a `wg_item` named `item` using `sycl::khr::get_item(work_group)`.
107+
* Check that `item.id()` returns a `wg_item::id_type`.
108+
* Check that `item.id() == group.get_local_id()`.
109+
* Check that `item.linear_id()` returns a `wg_item::linear_id_type`.
110+
* Check that `item.linear_id() == group.get_local_linear_id()`.
111+
* Check that `item.range()` returns a `wg_item::range_type`.
112+
* Check that `item.range() == group.get_local_range()`.
113+
* Check that `item.size()` returns a `wg_item::size_type`.
114+
* Check that `item.size() == 1`.
115+
116+
Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following:
117+
118+
* Check that `item.extents()` returns a `wg_item::extents_type`.
119+
* Check that `item.extents() == std::extents<std::size_t, 1, ...>()`.
120+
* Check that `item.extent(0)` returns a `wg_item::extents_type::index_type`.
121+
* For each dimension, `d`, check that `item.extent(d) == item.extents().extent(d)`
122+
* Check that `wg_item::rank()` returns a `wg_item::extents_type::rank_type`.
123+
* Check that `decltype(item)::rank() == decltype(item.extents())::rank()`
124+
* Check that `wg_item::rank_dynamic()` returns a `wg_item::extents_type::rank_type`.
125+
* Check that `decltype(item)::rank_dynamic() == decltype(item.extents())::rank_dynamic()`
126+
* Check that `wg_item::static_extent(0)` returns a `std::size_t`.
127+
* For each dimension, `d`, check that `decltype(item)::static_extent(d) == decltype(item.extents())::static_extent(d)`
128+
129+
==== `work_item<sub_group>` class
130+
131+
In the kernel scope, do the following:
132+
133+
* Define a `sycl::sub_group` named `group` using `it.get_sub_group()`.
134+
* Define a `sycl::khr::sub_group` named `sub_group` using `it.get_sub_group()`.
135+
* Define a type alias `wg_item` equal to `sycl::khr::work_item<sycl::khr::sub_group>`
136+
* Define a `wg_item` named `item` using `sycl::khr::get_item(sub_group)`.
137+
* Check that `item.id()` returns a `wg_item::id_type`.
138+
* Check that `item.id() == group.get_local_id()`.
139+
* Check that `item.linear_id()` returns a `wg_item::linear_id_type`.
140+
* Check that `item.linear_id() == group.get_local_linear_id()`.
141+
* Check that `item.range()` returns a `wg_item::range_type`.
142+
* Check that `item.range() == group.get_local_range()`.
143+
* Check that `item.size()` returns a `wg_item::size_type`.
144+
* Check that `item.size() == 1`.
145+
146+
Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following:
147+
148+
* Check that `item.extents()` returns a `wg_item::extents_type`.
149+
* Check that `item.extents() == std::extents<std::uint32_t, 1>()`.
150+
* Check that `item.extent(0)` returns a `wg_item::extents_type::index_type`.
151+
* Check that `item.extent(0) == item.extents().extent(0)`
152+
* Check that `wg_item::rank()` returns a `wg_item::extents_type::rank_type`.
153+
* Check that `decltype(item)::rank() == decltype(item.extents())::rank()`
154+
* Check that `wg_item::rank_dynamic()` returns a `wg_item::extents_type::rank_type`.
155+
* Check that `decltype(item)::rank_dynamic() == decltype(item.extents())::rank_dynamic()`
156+
* Check that `wg_item::static_extent(0)` returns a `std::size_t`.
157+
* Check that `decltype(item)::static_extent(0) == decltype(item.extents())::static_extent(0)`
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
:sectnums:
2+
:xrefstyle: short
3+
4+
= Test plan for sycl_ext_oneapi_num_compute_units
5+
6+
This is a test plan for the APIs described in
7+
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_num_compute_units.asciidoc[sycl_ext_oneapi_num_compute_units].
8+
9+
== Testing scope
10+
11+
=== Device coverage
12+
13+
All of the tests described below are performed only on the default device that
14+
is selected on the CTS command line.
15+
16+
=== Feature test macro
17+
18+
All of the tests should use `#ifdef SYCL_EXT_ONEAPI_NUM_COMPUTE_UNITS` so they
19+
can be skipped if feature is not supported.
20+
21+
== Tests
22+
23+
The extension introduces a new device descriptor: `sycl::ext::oneapi::info::device::num_compute_units`.
24+
25+
For this device descriptor, execute `sycl::device::get_info` and check that the following statements are true:
26+
27+
1. the return type of `sycl::device::get_info` call is expected, it should be `size_t`,
28+
2. the return value of `sycl::device::get_info` call should be greater than or equal to `1`.

tests/accessor_legacy/accessor_api_local_common.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ class check_local_accessor_api_methods {
9393
}
9494
}
9595
check_get_range(log, acc, range, typeName, is_zero_dim<dims>{});
96-
if constexpr (target == sycl::access::target::constant_buffer ||
97-
target == sycl::access::target::local ||
98-
target == sycl::access::target::host_buffer) {
96+
if constexpr (target == sycl::access::target::host_buffer) {
9997
/** check get_pointer() method for deprecated accessor targets
10098
*/
10199
auto pointer = acc.get_pointer();

tests/address_space/address_space_core.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ class TEST_NAME : public sycl_cts::util::test_base {
6363
#endif
6464
#ifdef UINT64_MAX
6565
test_types<std::uint64_t>(log);
66+
#endif
67+
68+
#ifdef SYCL_CTS_SYCL_NEXT_TESTS
69+
#if !SYCL_CTS_COMPILING_WITH_ADAPTIVECPP && \
70+
!SYCL_CTS_COMPILING_WITH_SIMSYCL && !SYCL_CTS_COMPILING_WITH_DPCPP
71+
// Tests are disabled because none of the implementations support them yet.
72+
// FIXME: re-enable tests once the implementations support them.
73+
static_assert(std::is_same_v<sycl::access::address_space, sycl::addrspace>);
74+
static_assert(
75+
std::is_same_v<sycl::addrspace::global_space, sycl::addrspace_global>);
76+
static_assert(
77+
std::is_same_v<sycl::addrspace::local_space, sycl::addrspace_local>);
78+
static_assert(std::is_same_v<sycl::addrspace::private_space,
79+
sycl::addrspace_private>);
80+
static_assert(std::is_same_v<sycl::addrspace::generic_space,
81+
sycl::addrspace_generic>);
82+
#endif
6683
#endif
6784
}
6885
};

tests/bit_cast/bit_cast_test.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class bit_cast_test {
6161
FromType from;
6262
value_operations::assign(from, expected_val);
6363
auto to = sycl::bit_cast<ToType>(from);
64-
result_acc[0] = std::memcmp(&to, &from, sizeof(from)) == 0;
64+
result_acc[0] =
65+
memcmp_no_ext_lib(&to, &from, sizeof(from)) == 0;
6566
if constexpr (!std::is_array_v<FromType>) {
6667
from = sycl::bit_cast<FromType>(to);
6768
result_acc[1] = value_operations::are_equal(from, expected);

tests/common/common.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,4 +890,20 @@ inline bool have_same_devices(std::vector<sycl::device> lhs,
890890
std::all_of(rhs.cbegin(), rhs.cend(), create_check_func(lhs));
891891
}
892892

893+
/**
894+
* @brief Helper function which implements the functionality of std::memcmp
895+
* without linking external library
896+
* @param lhs pointer to the memory buffer to compare
897+
* @param rhs pointer to the memory buffer to compare
898+
* @param count number of bytes to examine
899+
*/
900+
inline int memcmp_no_ext_lib(const void* lhs, const void* rhs, size_t count) {
901+
const unsigned char* c1 = static_cast<const unsigned char*>(lhs);
902+
const unsigned char* c2 = static_cast<const unsigned char*>(rhs);
903+
for (; count--; c1++, c2++) {
904+
if (*c1 != *c2) return *c1 < *c2 ? -1 : 1;
905+
}
906+
return 0;
907+
}
908+
893909
#endif // __SYCLCTS_TESTS_COMMON_COMMON_H

tests/common/common_vec.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@
4444

4545
namespace {
4646

47+
template <typename T>
48+
using rel_log_ret_t = std::conditional_t<
49+
sizeof(T) == 1, std::int8_t,
50+
std::conditional_t<
51+
sizeof(T) == 2, std::int16_t,
52+
std::conditional_t<sizeof(T) == 4, std::int32_t,
53+
std::conditional_t<sizeof(T) == 8, std::int64_t,
54+
void /*Not expected*/>>>>;
55+
4756
/**
4857
* @brief Helper function to check the size of a vector is correct.
4958
*/

0 commit comments

Comments
 (0)