diff --git a/.github/workflows/cts_ci.yml b/.github/workflows/cts_ci.yml index c068884e6..f0d3727a0 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: c57f50ceb66d33376d141de45fce6b1e7826f8ac steps: - name: Checkout uses: actions/checkout@v3 @@ -121,6 +123,8 @@ jobs: version: fcd26a61b600cd4b653724e59e72d4f7d1da259c - sycl-impl: simsycl version: 960c155109b066b26c1ecb6b2348ff9f6b69704d + - sycl-impl: protosycl + version: c57f50ceb66d33376d141de45fce6b1e7826f8ac env: container-workspace: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} parallel-build-jobs: 2 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/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/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..0b6472e34 --- /dev/null +++ b/cmake/FindProtoSYCL.cmake @@ -0,0 +1,21 @@ +include(FetchContent) +FetchContent_Declare( + ProtoSYCL + SOURCE_DIR /ProtoSYCL +) +FetchContent_MakeAvailable(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() diff --git a/docker/protosycl/Dockerfile b/docker/protosycl/Dockerfile new file mode 100644 index 000000000..43f0bbb25 --- /dev/null +++ b/docker/protosycl/Dockerfile @@ -0,0 +1,38 @@ +FROM khronosgroup/sycl-cts-ci:common + +ARG IMPL_VERSION +RUN test -n "$IMPL_VERSION" || ( echo "Error: IMPL_VERSION is not set"; exit 1 ) + +# 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 new file mode 100644 index 000000000..352a8439f --- /dev/null +++ b/docker/protosycl/configure.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -o errexit -o pipefail -o noclobber -o nounset +cmake . -G Ninja -B build \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -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 \ + -DSYCL_CTS_ENABLE_HALF_TESTS=ON \ + -DSYCL_CTS_ENABLE_DEPRECATED_FEATURES_TESTS=ON \ + -DSYCL_CTS_ENABLE_FEATURE_SET_FULL=ON \ + $@