From 2f1187f0d5290d1f59b0882f40f09895fd5d4198 Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Thu, 9 Dec 2021 11:40:30 +0000 Subject: [PATCH] Move SYCL2020 to subdirectory --- CMakeLists.txt | 3 +- src/sycl2020/.SYCLStream2020.h.swp | Bin 0 -> 12288 bytes src/{sycl => sycl2020}/SYCLStream2020.cpp | 0 src/{sycl => sycl2020}/SYCLStream2020.h | 3 +- src/sycl2020/model.cmake | 86 ++++++++++++++++++++++ 5 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 src/sycl2020/.SYCLStream2020.h.swp rename src/{sycl => sycl2020}/SYCLStream2020.cpp (100%) rename src/{sycl => sycl2020}/SYCLStream2020.h (95%) create mode 100644 src/sycl2020/model.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 58e0a3b..ad12dbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,7 @@ register_model(hip HIP HIPStream.cpp) register_model(cuda CUDA CUDAStream.cu) register_model(kokkos KOKKOS KokkosStream.cpp) register_model(sycl SYCL SYCLStream.cpp) +register_model(sycl2020 SYCL2020 SYCLStream2020.cpp) register_model(acc ACC ACCStream.cpp) # defining RAJA collides with the RAJA namespace so USE_RAJA register_model(raja USE_RAJA RAJAStream.cpp) @@ -206,4 +207,4 @@ if (COMMAND setup_target) setup_target(${EXE_NAME}) endif () -install(TARGETS ${EXE_NAME} DESTINATION bin) \ No newline at end of file +install(TARGETS ${EXE_NAME} DESTINATION bin) diff --git a/src/sycl2020/.SYCLStream2020.h.swp b/src/sycl2020/.SYCLStream2020.h.swp new file mode 100644 index 0000000000000000000000000000000000000000..4b4ae277bfb5a4610edfce2e422910db10b9e910 GIT binary patch literal 12288 zcmeI2O^+Kj7{^_Xg#zN`z=b}f5^SZs?Y5;T8$!EjU?XLhg`^0|A@a;P8<&~!V0*Hp zg>pjTQ1Kl=AjA;~z5yo$M{aNf4hTL&`FkeY-R-K|9w~C9pC-1Sd2Ije87Yc`=3D&@ zI$uA_@OhlEKmPib|8n!s$|oN)W>w;9@A8=;DXX#_kFv9Vh4 zq+xW}F!L~8X|6OI!*{xaVNvgj_34obeWN$v4cwoB+)ipQonU8HmYeQ|Q#;koi=w}H1Kxl);0<^K z-hemY4R{0IfH&X`cmv+R189IpjIAGM?83tsJpTXR{r!LIF~)uXUxP2f+n^8D!76Bh z7r@itDZs$3M;ZGa{0x2qUx3fSXW%NBf_Fg=)IkkA1AaTf*!SQ&@D;cT47dVb0UdA_ zoB_wdKaVi>H~0~J13m=;TmUD*v*1_E=Rn7Vi@~ql`+C+Cbi9Z zOhq0XhmFQuYd$wi#zw8yOoUeH_Nenb@haU}6&$V#Pm`Jntz{%u59gPuw7dC7YhrAxRF-6Fv9L&!~gCW?G!H#X^_jMyPQfq*+$yAbG)Vzs$yE->bk}*_PUna rQ%g&D1*|le&()S+q>)PKlHl*jv`RynsFXIserlDO)`khvR~h>k;R44k literal 0 HcmV?d00001 diff --git a/src/sycl/SYCLStream2020.cpp b/src/sycl2020/SYCLStream2020.cpp similarity index 100% rename from src/sycl/SYCLStream2020.cpp rename to src/sycl2020/SYCLStream2020.cpp diff --git a/src/sycl/SYCLStream2020.h b/src/sycl2020/SYCLStream2020.h similarity index 95% rename from src/sycl/SYCLStream2020.h rename to src/sycl2020/SYCLStream2020.h index 7481d16..74b4221 100644 --- a/src/sycl/SYCLStream2020.h +++ b/src/sycl2020/SYCLStream2020.h @@ -12,7 +12,8 @@ #include "Stream.h" -#include +//#include +#include #define IMPLEMENTATION_STRING "SYCL 2020" diff --git a/src/sycl2020/model.cmake b/src/sycl2020/model.cmake new file mode 100644 index 0000000..e7b5a1c --- /dev/null +++ b/src/sycl2020/model.cmake @@ -0,0 +1,86 @@ + +register_flag_optional(CMAKE_CXX_COMPILER + "Any CXX compiler that is supported by CMake detection, this is used for host compilation when required by the SYCL compiler" + "c++") + +register_flag_required(SYCL_COMPILER + "Compile using the specified SYCL compiler implementation + Supported values are + ONEAPI-DPCPP - dpc++ that is part of an oneAPI Base Toolkit distribution (https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html) + DPCPP - dpc++ as a standalone compiler (https://github.com/intel/llvm) + HIPSYCL - hipSYCL compiler (https://github.com/illuhad/hipSYCL) + COMPUTECPP - ComputeCpp compiler (https://developer.codeplay.com/products/computecpp/ce/home)") + +register_flag_optional(SYCL_COMPILER_DIR + "Absolute path to the selected SYCL compiler directory, most are packaged differently so set the path according to `SYCL_COMPILER`: + ONEAPI-DPCPP - not required but `dpcpp` must be on PATH, load oneAPI as per documentation (i.e `source /opt/intel/oneapi/setvars.sh` first) + HIPSYCL|DPCPP|COMPUTECPP - set to the root of the binary distribution that contains at least `bin/`, `include/`, and `lib/`" + "") + +register_flag_optional(OpenCL_LIBRARY + "[ComputeCpp only] Path to OpenCL library, usually called libOpenCL.so" + "${OpenCL_LIBRARY}") + +macro(setup) + set(CMAKE_CXX_STANDARD 17) + + + if (${SYCL_COMPILER} STREQUAL "HIPSYCL") + + + set(hipSYCL_DIR ${SYCL_COMPILER_DIR}/lib/cmake/hipSYCL) + + if (NOT EXISTS "${hipSYCL_DIR}") + message(WARNING "Falling back to hipSYCL < 0.9.0 CMake structure") + set(hipSYCL_DIR ${SYCL_COMPILER_DIR}/lib/cmake) + endif () + if (NOT EXISTS "${hipSYCL_DIR}") + message(FATAL_ERROR "Can't find the appropriate CMake definitions for hipSYCL") + endif () + + # register_definitions(_GLIBCXX_USE_CXX11_ABI=0) + find_package(hipSYCL CONFIG REQUIRED) + message(STATUS "ok") + + elseif (${SYCL_COMPILER} STREQUAL "COMPUTECPP") + + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + set(ComputeCpp_DIR ${SYCL_COMPILER_DIR}) + + setup_opencl_header_includes() + + register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0) + # ComputeCpp needs OpenCL + find_package(ComputeCpp REQUIRED) + + # this must come after FindComputeCpp (!) + set(COMPUTECPP_USER_FLAGS -O3 -no-serial-memop) + + elseif (${SYCL_COMPILER} STREQUAL "DPCPP") + set(CMAKE_CXX_COMPILER ${SYCL_COMPILER_DIR}/bin/clang++) + include_directories(${SYCL_COMPILER_DIR}/include/sycl) + register_definitions(CL_TARGET_OPENCL_VERSION=220) + register_append_cxx_flags(ANY -fsycl) + register_append_link_flags(-fsycl) + elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-DPCPP") + set(CMAKE_CXX_COMPILER dpcpp) + register_definitions(CL_TARGET_OPENCL_VERSION=220) + else () + message(FATAL_ERROR "SYCL_COMPILER=${SYCL_COMPILER} is unsupported") + endif () + +endmacro() + + +macro(setup_target NAME) + if ( + (${SYCL_COMPILER} STREQUAL "COMPUTECPP") OR + (${SYCL_COMPILER} STREQUAL "HIPSYCL")) + # so ComputeCpp and hipSYCL has this weird (and bad) CMake usage where they append their + # own custom integration header flags AFTER the target has been specified + # hence this macro here + add_sycl_to_target( + TARGET ${NAME} + SOURCES ${IMPL_SOURCES}) + endif () +endmacro()