From 36cd9776d52c98a1898f9b49445b7c41e462092a Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Thu, 21 May 2026 07:36:10 -0700 Subject: [PATCH 1/6] Add ProtoSYCL impl to CMake Signed-off-by: Michael Aziz --- CMakeLists.txt | 2 ++ cmake/AdaptProtoSYCL.cmake | 29 +++++++++++++++++++++++++++++ cmake/AddSYCLExecutable.cmake | 2 +- cmake/FindProtoSYCL.cmake | 28 ++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 cmake/AdaptProtoSYCL.cmake create mode 100644 cmake/FindProtoSYCL.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index abdd9f5c0..57ce0f968 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ project(sycl_cts LANGUAGES CXX) if(SYCL_IMPLEMENTATION STREQUAL SimSYCL) set(CMAKE_CXX_STANDARD 20) +elseif(SYCL_IMPLEMENTATION STREQUAL ProtoSYCL) + set(CMAKE_CXX_STANDARD 23) else() set(CMAKE_CXX_STANDARD 17) endif() diff --git a/cmake/AdaptProtoSYCL.cmake b/cmake/AdaptProtoSYCL.cmake new file mode 100644 index 000000000..46dad248c --- /dev/null +++ b/cmake/AdaptProtoSYCL.cmake @@ -0,0 +1,29 @@ +add_library(SYCL::SYCL INTERFACE IMPORTED GLOBAL) +target_link_libraries(SYCL::SYCL INTERFACE ProtoSYCL) +# add_sycl_executable_implementation function +# Builds a SYCL program, compiling multiple SYCL test case source files into a +# test executable, invoking a single-source/device compiler +# Parameters are: +# - NAME Name of the test executable +# - OBJECT_LIBRARY Name of the object library of all the compiled test cases +# - TESTS List of SYCL test case source files to be built into the +# test executable +function(add_sycl_executable_implementation) + cmake_parse_arguments(args "" "NAME;OBJECT_LIBRARY" "TESTS" ${ARGN}) + set(exe_name ${args_NAME}) + set(object_lib_name ${args_OBJECT_LIBRARY}) + set(test_cases_list ${args_TESTS}) + + add_library(${object_lib_name} OBJECT ${test_cases_list}) + add_executable(${exe_name} $) + + add_sycl_to_target(TARGET ${object_lib_name} SOURCES ${test_cases_list}) + + set_target_properties(${object_lib_name} PROPERTIES + INCLUDE_DIRECTORIES $ + COMPILE_DEFINITIONS $ + COMPILE_OPTIONS $ + COMPILE_FEATURES $ + POSITION_INDEPENDENT_CODE ON) + +endfunction() diff --git a/cmake/AddSYCLExecutable.cmake b/cmake/AddSYCLExecutable.cmake index 32fb962d2..b82b9f6ed 100644 --- a/cmake/AddSYCLExecutable.cmake +++ b/cmake/AddSYCLExecutable.cmake @@ -1,4 +1,4 @@ -set (KNOWN_SYCL_IMPLEMENTATIONS "DPCPP;AdaptiveCpp;SimSYCL") +set (KNOWN_SYCL_IMPLEMENTATIONS "DPCPP;AdaptiveCpp;SimSYCL;ProtoSYCL") if ("${SYCL_IMPLEMENTATION}" STREQUAL "" OR NOT ${SYCL_IMPLEMENTATION} IN_LIST KNOWN_SYCL_IMPLEMENTATIONS) message(FATAL_ERROR "The SYCL CTS requires specifying a SYCL implementation with " diff --git a/cmake/FindProtoSYCL.cmake b/cmake/FindProtoSYCL.cmake new file mode 100644 index 000000000..d701e21e6 --- /dev/null +++ b/cmake/FindProtoSYCL.cmake @@ -0,0 +1,28 @@ +include(FetchContent) +FetchContent_Declare( + ProtoSYCL + GIT_REPOSITORY https://github.com/0x12CC/ProtoSYCL.git + GIT_TAG main +) +FetchContent_MakeAvailable(ProtoSYCL) +FetchContent_GetProperties(ProtoSYCL BINARY_DIR PROTOSYCL_BINARY_DIR) +set(CMAKE_CXX_COMPILER "${PROTOSYCL_BINARY_DIR}/sycl++") + +# This is needed since ProtoSYCL must be the first target built. It ensures +# sycl++ is available and can be used to build the other targets. +add_dependencies(OpenCL_Proxy ProtoSYCL) + +function(add_sycl_to_target) + set(options) + set(one_value_keywords TARGET) + set(multi_value_keywords SOURCES) + cmake_parse_arguments(ADD_SYCL + "${options}" + "${one_value_keywords}" + "${multi_value_keywords}" + ${ARGN} + ) + + target_link_libraries(${ADD_SYCL_TARGET} PUBLIC ProtoSYCL) + +endfunction() From c80df22fa61ab62f9b28789ee3fa27b45be99531 Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Thu, 21 May 2026 07:36:18 -0700 Subject: [PATCH 2/6] Disambiguate `nextafter` Signed-off-by: Michael Aziz --- util/math_reference.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/math_reference.cpp b/util/math_reference.cpp index 9a38dd285..f2218bbd9 100644 --- a/util/math_reference.cpp +++ b/util/math_reference.cpp @@ -519,7 +519,8 @@ sycl::half fdim(sycl::half a, sycl::half b) { double resd = static_cast(a) - static_cast(b); sycl::half res = static_cast(resd); double diff = resd - static_cast(res); - sycl::half next = nextafter(res, static_cast(DBL_MAX * diff)); + sycl::half next = + reference::nextafter(res, static_cast(DBL_MAX * diff)); if (static_cast(next) - resd == diff) { int16_t rep; type_punn(next, rep); @@ -532,7 +533,8 @@ sycl::half fdim(sycl::half a, sycl::half b) { sycl::half fract(sycl::half a, sycl::half* b) { *b = std::floor(a); - return std::fmin(a - *b, nextafter(sycl::half(1.0), sycl::half(0.0))); + return std::fmin(a - *b, + reference::nextafter(sycl::half(1.0), sycl::half(0.0))); } sycl::half nan(unsigned short a) { return nan(unsigned(a)); } From 56092a027c816027d9a8dfefb745cae83ef3ac59 Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Thu, 21 May 2026 07:36:51 -0700 Subject: [PATCH 3/6] Add ProtoSYCL to CI Signed-off-by: Michael Aziz --- .github/workflows/cts_ci.yml | 4 ++++ ci/generate_exclude_filter.py | 4 ++-- ci/protosycl.filter | 4 ++++ docker/protosycl/Dockerfile | 15 +++++++++++++++ docker/protosycl/configure.sh | 14 ++++++++++++++ 5 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 ci/protosycl.filter create mode 100644 docker/protosycl/Dockerfile create mode 100644 docker/protosycl/configure.sh diff --git a/.github/workflows/cts_ci.yml b/.github/workflows/cts_ci.yml index c57043e03..0fba5a5b2 100644 --- a/.github/workflows/cts_ci.yml +++ b/.github/workflows/cts_ci.yml @@ -61,6 +61,8 @@ jobs: version: fcd26a61b600cd4b653724e59e72d4f7d1da259c - sycl-impl: simsycl version: 960c155109b066b26c1ecb6b2348ff9f6b69704d + - sycl-impl: protosycl + version: main steps: - name: Checkout uses: actions/checkout@v3 @@ -121,6 +123,8 @@ jobs: version: fcd26a61b600cd4b653724e59e72d4f7d1da259c - sycl-impl: simsycl version: 960c155109b066b26c1ecb6b2348ff9f6b69704d + - sycl-impl: protosycl + version: main env: container-workspace: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} parallel-build-jobs: 2 diff --git a/ci/generate_exclude_filter.py b/ci/generate_exclude_filter.py index 42f660d54..4a35e89bc 100755 --- a/ci/generate_exclude_filter.py +++ b/ci/generate_exclude_filter.py @@ -42,8 +42,8 @@ def parse_arguments(): configuration-time test category filters for all failing targets.""") parser.add_argument('sycl_implementation', metavar="SYCL-Implementation", - choices=['DPCPP', 'AdaptiveCpp', 'SimSYCL'], type=str, - help="The SYCL implementation to use") + choices=['DPCPP', 'AdaptiveCpp', 'SimSYCL', 'ProtoSYCL'], + type=str, help="The SYCL implementation to use") parser.add_argument('--cmake-args', type=str, help="Arguments to pass on to CMake during configuration") parser.add_argument('-j', type=int, default=0, dest='parallel_jobs', diff --git a/ci/protosycl.filter b/ci/protosycl.filter new file mode 100644 index 000000000..230e130ce --- /dev/null +++ b/ci/protosycl.filter @@ -0,0 +1,4 @@ +device +group_functions +math_builtin_api +property diff --git a/docker/protosycl/Dockerfile b/docker/protosycl/Dockerfile new file mode 100644 index 000000000..ba5cd10e7 --- /dev/null +++ b/docker/protosycl/Dockerfile @@ -0,0 +1,15 @@ +FROM khronosgroup/sycl-cts-ci:common + +ARG IMPL_VERSION +RUN test -n "$IMPL_VERSION" || ( echo "Error: IMPL_VERSION is not set"; exit 1 ) + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt update && \ + apt install -y --no-install-recommends clang \ + apt-get clean && \ + rm -rf /var/lib/apt/lists* + +ENV CC=clang +ENV CXX=clang++ + +COPY configure.sh /scripts/ diff --git a/docker/protosycl/configure.sh b/docker/protosycl/configure.sh new file mode 100644 index 000000000..475c72df0 --- /dev/null +++ b/docker/protosycl/configure.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -o errexit -o pipefail -o noclobber -o nounset +cmake . -G Ninja -B build \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DSYCL_IMPLEMENTATION=ProtoSYCL \ + -DCMAKE_PREFIX_PATH=/sycl \ + -DCMAKE_BUILD_TYPE=Release \ + -DSYCL_CTS_ENABLE_FULL_CONFORMANCE=OFF \ + -DSYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS=OFF \ + -DSYCL_CTS_ENABLE_CUDA_INTEROP_TESTS=OFF \ + -DSYCL_CTS_ENABLE_HALF_TESTS=ON \ + -DSYCL_CTS_ENABLE_DEPRECATED_FEATURES_TESTS=ON \ + -DSYCL_CTS_ENABLE_FEATURE_SET_FULL=ON \ + $@ From 85351639f9f5df6ce18e9275e811f889aabf69c0 Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Thu, 21 May 2026 08:16:57 -0700 Subject: [PATCH 4/6] Revert "Disambiguate `nextafter`" This reverts commit c80df22fa61ab62f9b28789ee3fa27b45be99531. Signed-off-by: Michael Aziz --- util/math_reference.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/util/math_reference.cpp b/util/math_reference.cpp index f2218bbd9..9a38dd285 100644 --- a/util/math_reference.cpp +++ b/util/math_reference.cpp @@ -519,8 +519,7 @@ sycl::half fdim(sycl::half a, sycl::half b) { double resd = static_cast(a) - static_cast(b); sycl::half res = static_cast(resd); double diff = resd - static_cast(res); - sycl::half next = - reference::nextafter(res, static_cast(DBL_MAX * diff)); + sycl::half next = nextafter(res, static_cast(DBL_MAX * diff)); if (static_cast(next) - resd == diff) { int16_t rep; type_punn(next, rep); @@ -533,8 +532,7 @@ sycl::half fdim(sycl::half a, sycl::half b) { sycl::half fract(sycl::half a, sycl::half* b) { *b = std::floor(a); - return std::fmin(a - *b, - reference::nextafter(sycl::half(1.0), sycl::half(0.0))); + return std::fmin(a - *b, nextafter(sycl::half(1.0), sycl::half(0.0))); } sycl::half nan(unsigned short a) { return nan(unsigned(a)); } From c202b19958c89805fa43256fd5e7980830e3ea07 Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Wed, 27 May 2026 08:11:46 -0700 Subject: [PATCH 5/6] Update container config Signed-off-by: Michael Aziz --- cmake/FindProtoSYCL.cmake | 9 +-------- docker/protosycl/Dockerfile | 33 ++++++++++++++++++++++++++++----- docker/protosycl/configure.sh | 5 +++-- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/cmake/FindProtoSYCL.cmake b/cmake/FindProtoSYCL.cmake index d701e21e6..0b6472e34 100644 --- a/cmake/FindProtoSYCL.cmake +++ b/cmake/FindProtoSYCL.cmake @@ -1,16 +1,9 @@ include(FetchContent) FetchContent_Declare( ProtoSYCL - GIT_REPOSITORY https://github.com/0x12CC/ProtoSYCL.git - GIT_TAG main + SOURCE_DIR /ProtoSYCL ) FetchContent_MakeAvailable(ProtoSYCL) -FetchContent_GetProperties(ProtoSYCL BINARY_DIR PROTOSYCL_BINARY_DIR) -set(CMAKE_CXX_COMPILER "${PROTOSYCL_BINARY_DIR}/sycl++") - -# This is needed since ProtoSYCL must be the first target built. It ensures -# sycl++ is available and can be used to build the other targets. -add_dependencies(OpenCL_Proxy ProtoSYCL) function(add_sycl_to_target) set(options) diff --git a/docker/protosycl/Dockerfile b/docker/protosycl/Dockerfile index ba5cd10e7..43f0bbb25 100644 --- a/docker/protosycl/Dockerfile +++ b/docker/protosycl/Dockerfile @@ -3,13 +3,36 @@ FROM khronosgroup/sycl-cts-ci:common ARG IMPL_VERSION RUN test -n "$IMPL_VERSION" || ( echo "Error: IMPL_VERSION is not set"; exit 1 ) -RUN export DEBIAN_FRONTEND=noninteractive && \ - apt update && \ - apt install -y --no-install-recommends clang \ - apt-get clean && \ - rm -rf /var/lib/apt/lists* +# Install LLVM script dependencies. +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + wget \ + gnupg \ + lsb-release \ + g++-14 \ + software-properties-common && \ + rm -rf /var/lib/apt/lists/* +# Install LLVM 22. +RUN wget https://apt.llvm.org/llvm.sh && \ + chmod +x llvm.sh && \ + ./llvm.sh 22 all && \ + rm llvm.sh + +# Set clang-22 as the default clang version. +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 100 ENV CC=clang ENV CXX=clang++ +# Build ProtoSYCL. +RUN git clone https://github.com/0x12CC/ProtoSYCL.git && \ + cd ProtoSYCL && \ + git checkout $IMPL_VERSION && \ + mkdir build && \ + cd build && \ + cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja && \ + ninja + +# Copy the configure script to the /scripts directory. COPY configure.sh /scripts/ diff --git a/docker/protosycl/configure.sh b/docker/protosycl/configure.sh index 475c72df0..352a8439f 100644 --- a/docker/protosycl/configure.sh +++ b/docker/protosycl/configure.sh @@ -2,9 +2,10 @@ set -o errexit -o pipefail -o noclobber -o nounset cmake . -G Ninja -B build \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DSYCL_IMPLEMENTATION=ProtoSYCL \ - -DCMAKE_PREFIX_PATH=/sycl \ + -DCMAKE_CXX_COMPILER=/ProtoSYCL/build/sycl++ \ + -DCMAKE_CXX_STANDARD=23 \ -DCMAKE_BUILD_TYPE=Release \ + -DSYCL_IMPLEMENTATION=ProtoSYCL \ -DSYCL_CTS_ENABLE_FULL_CONFORMANCE=OFF \ -DSYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS=OFF \ -DSYCL_CTS_ENABLE_CUDA_INTEROP_TESTS=OFF \ From a83b4dd0e5d63cb3081537c429fcf4dbb2095e18 Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Wed, 27 May 2026 08:15:22 -0700 Subject: [PATCH 6/6] Add commit hash Signed-off-by: Michael Aziz --- .github/workflows/cts_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cts_ci.yml b/.github/workflows/cts_ci.yml index 627f6b023..f0d3727a0 100644 --- a/.github/workflows/cts_ci.yml +++ b/.github/workflows/cts_ci.yml @@ -62,7 +62,7 @@ jobs: - sycl-impl: simsycl version: 960c155109b066b26c1ecb6b2348ff9f6b69704d - sycl-impl: protosycl - version: main + version: c57f50ceb66d33376d141de45fce6b1e7826f8ac steps: - name: Checkout uses: actions/checkout@v3 @@ -124,7 +124,7 @@ jobs: - sycl-impl: simsycl version: 960c155109b066b26c1ecb6b2348ff9f6b69704d - sycl-impl: protosycl - version: main + version: c57f50ceb66d33376d141de45fce6b1e7826f8ac env: container-workspace: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} parallel-build-jobs: 2