Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion .github/workflows/cts_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
version: fcd26a61b600cd4b653724e59e72d4f7d1da259c
- sycl-impl: simsycl
version: 960c155109b066b26c1ecb6b2348ff9f6b69704d
- sycl-impl: protosycl
version: f48ad43d9c1f85d6ac5cc3abb00ee764d7f1edbd
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -121,9 +123,11 @@ jobs:
version: fcd26a61b600cd4b653724e59e72d4f7d1da259c
- sycl-impl: simsycl
version: 960c155109b066b26c1ecb6b2348ff9f6b69704d
- sycl-impl: protosycl
version: f48ad43d9c1f85d6ac5cc3abb00ee764d7f1edbd
env:
container-workspace: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
parallel-build-jobs: 2
parallel-build-jobs: 4
container:
image: khronosgroup/sycl-cts-ci:${{ matrix.sycl-impl }}-${{ matrix.version }}
steps:
Expand Down Expand Up @@ -152,6 +156,7 @@ jobs:
run: |
echo "CCACHE_DEPEND=1" >> "$GITHUB_ENV"
echo "CCACHE_DIR=${{ env.container-workspace }}/.ccache" >> "$GITHUB_ENV"
echo "CCACHE_COMPILER_TYPE=clang" >> "$GITHUB_ENV"
- name: Build 'oclmath'
working-directory: ${{ env.container-workspace }}/build
run: cmake --build . --target oclmath
Expand All @@ -172,6 +177,11 @@ jobs:
with:
name: build-times-${{ matrix.sycl-impl }}
path: ${{ env.container-workspace }}/build/build_times.log
- name: Upload test binaries artifact
uses: actions/upload-artifact@v4
with:
name: test-binaries-${{ matrix.sycl-impl }}
path: ${{ env.container-workspace }}/build/bin

# This job simply summarizes the results of the "compile-cts" matrix build job above.
# It can then be used in a branch protection rule instead of having to enumerate all
Expand All @@ -188,3 +198,47 @@ jobs:
else
exit 1
fi

run-cts:
needs: cts-compiles-for-all-implementations
if: needs.cts-compiles-for-all-implementations.result == 'success'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- sycl-impl: protosycl
version: f48ad43d9c1f85d6ac5cc3abb00ee764d7f1edbd
env:
container-workspace: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
container:
image: khronosgroup/sycl-cts-ci:${{ matrix.sycl-impl }}-${{ matrix.version }}
steps:
- name: Download test binaries artifact
uses: actions/download-artifact@v4
with:
name: test-binaries-${{ matrix.sycl-impl }}
path: ${{ env.container-workspace }}/bin
- name: Run the tests
working-directory: ${{ env.container-workspace }}
run: |
chmod -R +x bin/
find bin/ -type f -executable | while read -r binary; do
echo "=== Running test category: $binary ==="
"$binary"
done

cts-passes-for-all-implementations:
needs: run-cts
if: always()
runs-on: ubuntu-22.04
steps:
- name: Summarize matrix test results
run: |
if [[ "${{ needs.run-cts.result }}" == "success" ]]; then
echo "CTS tests succeeded for all implementations. Ready to run tests in separate workflow."
exit 0
else
echo "CTS tests failed for at least one implementation. Please check the 'run-cts' job for details."
exit 1
fi
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions ci/generate_exclude_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions ci/protosycl.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
context
device
group_functions
kernel_bundle
math_builtin_api
property
29 changes: 29 additions & 0 deletions cmake/AdaptProtoSYCL.cmake
Original file line number Diff line number Diff line change
@@ -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} $<TARGET_OBJECTS:${object_lib_name}>)

add_sycl_to_target(TARGET ${object_lib_name} SOURCES ${test_cases_list})

set_target_properties(${object_lib_name} PROPERTIES
INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${exe_name},INCLUDE_DIRECTORIES>
COMPILE_DEFINITIONS $<TARGET_PROPERTY:${exe_name},COMPILE_DEFINITIONS>
COMPILE_OPTIONS $<TARGET_PROPERTY:${exe_name},COMPILE_OPTIONS>
COMPILE_FEATURES $<TARGET_PROPERTY:${exe_name},COMPILE_FEATURES>
POSITION_INDEPENDENT_CODE ON)

endfunction()
2 changes: 1 addition & 1 deletion cmake/AddSYCLExecutable.cmake
Original file line number Diff line number Diff line change
@@ -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 "
Expand Down
21 changes: 21 additions & 0 deletions cmake/FindProtoSYCL.cmake
Original file line number Diff line number Diff line change
@@ -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()
41 changes: 41 additions & 0 deletions docker/protosycl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM khronosgroup/sycl-cts-ci:common

ARG IMPL_VERSION
RUN test -n "$IMPL_VERSION" || ( echo "Error: IMPL_VERSION is not set"; exit 1 )

# Install dependencies.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common && \
add-apt-repository ppa:ubuntu-toolchain-r/test && \
apt-get update && \
apt-get install -y --no-install-recommends \
wget \
gnupg \
lsb-release \
g++-15 && \
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 && \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the FetchContent in ‎cmake/FindProtoSYCL.cmake not enough?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FetchContent will build the compiler and runtime library. The reason I've set it up this way is so that we can select the implementation version in .github/workflows/cts_ci.yml just like for other implementations. It also ensures the SYCL compiler is built before the first target in the CTS. I'm hoping there will be a better way once CMake supports SYCL.

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/
15 changes: 15 additions & 0 deletions docker/protosycl/configure.sh
Original file line number Diff line number Diff line change
@@ -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 \
$@
2 changes: 2 additions & 0 deletions tests/common/disabled_for_test_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
#define INTERNAL_CTS_SYCL_IMPL_AdaptiveCpp ()
#elif SYCL_CTS_COMPILING_WITH_SIMSYCL
#define INTERNAL_CTS_SYCL_IMPL_SimSYCL ()
#elif SYCL_CTS_COMPILING_WITH_PROTOSYCL
#define INTERNAL_CTS_SYCL_IMPL_ProtoSYCL ()
#else
#error Unknown SYCL implementation
#endif
Expand Down
Loading