Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SimSYCL as a SYCL implementation #871

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions .github/workflows/cts_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
version: 2025-01-14
- sycl-impl: adaptivecpp
version: 061e2d6ffe1084021d99f22ac1f16e28c6dab899
- sycl-impl: simsycl
version: 39368b9a54f1b6a5d9d583497dbf56e5bb8b5543
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -117,6 +119,8 @@ jobs:
version: 2025-01-14
- sycl-impl: adaptivecpp
version: 061e2d6ffe1084021d99f22ac1f16e28c6dab899
- sycl-impl: simsycl
version: 39368b9a54f1b6a5d9d583497dbf56e5bb8b5543
env:
container-workspace: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
parallel-build-jobs: 2
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
cmake_minimum_required(VERSION 3.15)
project(sycl_cts LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
if(SYCL_IMPLEMENTATION STREQUAL SimSYCL)
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
endif()

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON) # Required for hex floats in C++11 mode on gcc 6+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To compile the CTS, the following dependencies are required:
- Python 3.7 or higher
- CMake 3.15 or higher
- A SYCL implementation
- The CTS currently supports DPC++ and AdaptiveCpp
- The CTS currently supports DPC++, AdaptiveCpp and SimSYCL
- See the [AddSYCLExecutable.cmake](cmake/AddSYCLExecutable.cmake) module on
how to add support for additional SYCL implementations

Expand All @@ -35,7 +35,7 @@ cloning this repository and its submodules:

Then enter the `SYCL-CTS` folder and configure the build using CMake:

`cmake -S . -B build -DSYCL_IMPLEMENTATION=<DPCPP|AdaptiveCpp>`
`cmake -S . -B build -DSYCL_IMPLEMENTATION=<DPCPP|AdaptiveCpp|SimSYCL>`

See [CMake Configuration Options](#cmake-configuration-options) for additional
configuration options that can be passed here.
Expand All @@ -52,7 +52,7 @@ placed in the `build/bin` directory.
The CTS can be configured using the following CMake configuration options:

`SYCL_IMPLEMENTATION` (default: None)
`DPCPP` or `AdaptiveCpp`.
`DPCPP`, `AdaptiveCpp` or `SimSYCL`.

`SYCL_CTS_EXCLUDE_TEST_CATEGORIES` (default: None)
Optional file specifying a list of test categories to be excluded from the build.
Expand Down
2 changes: 1 addition & 1 deletion ci/generate_exclude_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def parse_arguments():
configuration-time test category filters for all failing targets.""")

parser.add_argument('sycl_implementation', metavar="SYCL-Implementation",
choices=['DPCPP', 'AdaptiveCpp'], type=str,
choices=['DPCPP', 'AdaptiveCpp', 'SimSYCL'], type=str,
help="The SYCL implementation to use")
parser.add_argument('--cmake-args', type=str,
help="Arguments to pass on to CMake during configuration")
Expand Down
15 changes: 15 additions & 0 deletions ci/simsycl.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
accessor_legacy
atomic
atomic_ref_stress
exception_handling
image
image_accessor
kernel
kernel_args
kernel_bundle
math_builtin_api
multi_ptr
reduction
sampler
spec_constants
stream
32 changes: 32 additions & 0 deletions cmake/AdaptSimSYCL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
add_library(SYCL::SYCL INTERFACE IMPORTED GLOBAL)
psalz marked this conversation as resolved.
Show resolved Hide resolved
target_link_libraries(SYCL::SYCL INTERFACE SimSYCL::simsycl)
# 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}>)

# SimSYCL needs the macro to be called on both the object library
# and the executable to set CXXFLAGS for enabling AddressSanitizer.
add_sycl_to_target(TARGET ${object_lib_name} SOURCES ${test_cases_list})
add_sycl_to_target(TARGET ${exe_name})

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()

4 changes: 2 additions & 2 deletions cmake/AddSYCLExecutable.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
set (KNOWN_SYCL_IMPLEMENTATIONS "DPCPP;AdaptiveCpp")
set (KNOWN_SYCL_IMPLEMENTATIONS "DPCPP;AdaptiveCpp;SimSYCL")
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 "
"-DSYCL_IMPLEMENTATION=[DPCPP;AdaptiveCpp]")
"-DSYCL_IMPLEMENTATION=[${KNOWN_SYCL_IMPLEMENTATIONS}]")
endif()

if(NOT TARGET OpenCL_Proxy)
Expand Down
30 changes: 30 additions & 0 deletions docker/simsycl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SimSYCL version (git revision) to install
ARG IMPL_VERSION

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 \
libboost-context-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists*

RUN git clone https://github.com/celerity/SimSYCL.git \
--branch=master --single-branch --shallow-since=2024-12-01 \
--recurse-submodules /tmp/SimSYCL && \
cd /tmp/SimSYCL && \
git checkout $IMPL_VERSION && \
cmake /tmp/SimSYCL -G Ninja -B /tmp/build \
-DSIMSYCL_ANNOTATE_SYCL_DEPRECATIONS=OFF \
-DSIMSYCL_ENABLE_ASAN=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=/sycl && \
cmake --build /tmp/build --target install && \
rm -rf /tmp/SimSYCL /tmp/build

COPY configure.sh /scripts/
14 changes: 14 additions & 0 deletions docker/simsycl/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -o errexit -o pipefail -o noclobber -o nounset

cmake . -G Ninja -B build \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DSYCL_IMPLEMENTATION=SimSYCL \
-DCMAKE_PREFIX_PATH=/sycl \
-DCMAKE_BUILD_TYPE=Debug \
-DSYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS=0 \
-DSYCL_CTS_ENABLE_HALF_TESTS=0 \
-DSYCL_CTS_ENABLE_FULL_CONFORMANCE=0 \
-DSYCL_CTS_ENABLE_DEPRECATED_FEATURES_TESTS=1 \
$@
2 changes: 1 addition & 1 deletion docs/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ The CTS currently provides the following macros for compile-time disabling test
* `DISABLED_FOR_TEST_CASE(<impls...>)(<description>, <tags>)(<body>)`
* `DISABLED_FOR_TEMPLATE_TEST_CASE_SIG(<impls...>)(<description>, <tags>, <signature>, <types...>)(<body>)`

where `<impls...>` is a comma-separated list of `AdaptiveCpp` and/or `DPCPP`.
where `<impls...>` is a comma-separated list out of `AdaptiveCpp`, `DPCPP`, and `SimSYCL`.

NOTE: #**TODO:** Custom matchers.#

Expand Down
1 change: 0 additions & 1 deletion tests/accessor_generic/generic_accessor_linearization.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class run_linearization_tests {
const std::string &access_mode_name,
const std::string &target_name) {
auto queue = once_per_unit::get_queue();
auto r = util::get_cts_object::range<dims>::get(1, 1, 1);

SECTION(
get_section_name<dims>(type_name, access_mode_name, target_name, "")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ void test_placeholder_buffer_constructor(const std::string& type_name,
const std::string& access_mode_name,
const std::string& target_name) {
constexpr int buf_dims = (0 == Dimension) ? 1 : Dimension;
auto r = util::get_cts_object::range<buf_dims>::get(1, 1, 1);

auto section_name =
get_section_name<Dimension>(type_name, access_mode_name, target_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ void test_placeholder_buffer_range_constructor(
const std::string& type_name, const std::string& access_mode_name,
const std::string& target_name) {
auto r = util::get_cts_object::range<Dimension>::get(1, 1, 1);
auto offset = util::get_cts_object::id<Dimension>::get(0, 0, 0);
auto r_zero = util::get_cts_object::range<Dimension>::get(0, 0, 0);

auto section_name = get_section_name<Dimension>(
type_name, access_mode_name, target_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void test_placeholder_buffer_range_offset_constructor(
const std::string& target_name) {
auto r = util::get_cts_object::range<Dimension>::get(1, 1, 1);
auto offset = util::get_cts_object::id<Dimension>::get(0, 0, 0);
auto r_zero = util::get_cts_object::range<Dimension>::get(0, 0, 0);

auto section_name = get_section_name<Dimension>(
type_name, access_mode_name, target_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ template <typename DataT, int Dimension, sycl::access_mode AccessMode,
void test_placeholder_zero_length_buffer_range_constructor(
const std::string& type_name, const std::string& access_mode_name,
const std::string& target_name) {
auto r = util::get_cts_object::range<Dimension>::get(1, 1, 1);
auto offset = util::get_cts_object::id<Dimension>::get(0, 0, 0);
auto r_zero = util::get_cts_object::range<Dimension>::get(0, 0, 0);

auto section_name = get_section_name<Dimension>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ template <typename DataT, int Dimension, sycl::access_mode AccessMode,
void test_placeholder_zero_length_buffser_range_offset_constructor(
const std::string& type_name, const std::string& access_mode_name,
const std::string& target_name) {
auto r = util::get_cts_object::range<Dimension>::get(1, 1, 1);
auto offset = util::get_cts_object::id<Dimension>::get(0, 0, 0);
auto r_zero = util::get_cts_object::range<Dimension>::get(0, 0, 0);

Expand Down
1 change: 0 additions & 1 deletion tests/atomic_fence/atomic_fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ class run_atomic_fence {
auto data_acc = get_accessor(cgh, data_buffer);
cgh.parallel_for(sycl::nd_range<1>(global_range, local_range),
[=](sycl::nd_item<1> nditem) {
auto g = nditem.get_group();
sycl::atomic_ref<int, sycl::memory_order::relaxed,
sycl::memory_scope::work_group>
sync_flag(sync_flag_acc[0]);
Expand Down
Loading
Loading