Update SYCL options for --include-intel-llvm

This commit is contained in:
Tom Lin 2023-07-02 02:31:47 +01:00
parent 50fe7c102a
commit c3346318b9
2 changed files with 27 additions and 17 deletions

View File

@ -6,14 +6,16 @@ register_flag_optional(CMAKE_CXX_COMPILER
register_flag_required(SYCL_COMPILER register_flag_required(SYCL_COMPILER
"Compile using the specified SYCL compiler implementation "Compile using the specified SYCL compiler implementation
Supported values are 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) ONEAPI-ICPX - icpx as a standalone compiler
ONEAPI-Clang - oneAPI's Clang driver (enabled via `source /opt/intel/oneapi/setvars.sh --include-intel-llvm`)
DPCPP - dpc++ as a standalone compiler (https://github.com/intel/llvm) DPCPP - dpc++ as a standalone compiler (https://github.com/intel/llvm)
HIPSYCL - hipSYCL compiler (https://github.com/illuhad/hipSYCL) HIPSYCL - hipSYCL compiler (https://github.com/illuhad/hipSYCL)
COMPUTECPP - ComputeCpp compiler (https://developer.codeplay.com/products/computecpp/ce/home)") COMPUTECPP - ComputeCpp compiler (https://developer.codeplay.com/products/computecpp/ce/home)")
register_flag_optional(SYCL_COMPILER_DIR 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`: "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) ONEAPI-ICPX - `icpx` must be used for OneAPI 2023 and later on releases (i.e `source /opt/intel/oneapi/setvars.sh` first)
ONEAPI-Clang - set to the directory that contains the Intel clang++ binary.
HIPSYCL|DPCPP|COMPUTECPP - set to the root of the binary distribution that contains at least `bin/`, `include/`, and `lib/`" HIPSYCL|DPCPP|COMPUTECPP - set to the root of the binary distribution that contains at least `bin/`, `include/`, and `lib/`"
"") "")
@ -47,7 +49,8 @@ macro(setup)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
set(ComputeCpp_DIR ${SYCL_COMPILER_DIR}) set(ComputeCpp_DIR ${SYCL_COMPILER_DIR})
setup_opencl_header_includes() # don't point to the CL dir as the imports already have the CL prefix
set(OpenCL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}")
register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0) register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0)
# ComputeCpp needs OpenCL # ComputeCpp needs OpenCL
@ -59,12 +62,18 @@ macro(setup)
elseif (${SYCL_COMPILER} STREQUAL "DPCPP") elseif (${SYCL_COMPILER} STREQUAL "DPCPP")
set(CMAKE_CXX_COMPILER ${SYCL_COMPILER_DIR}/bin/clang++) set(CMAKE_CXX_COMPILER ${SYCL_COMPILER_DIR}/bin/clang++)
include_directories(${SYCL_COMPILER_DIR}/include/sycl) include_directories(${SYCL_COMPILER_DIR}/include/sycl)
register_definitions(CL_TARGET_OPENCL_VERSION=220)
register_append_cxx_flags(ANY -fsycl) register_append_cxx_flags(ANY -fsycl)
register_append_link_flags(-fsycl) register_append_link_flags(-fsycl)
elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-DPCPP") elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-ICPX")
set(CMAKE_CXX_COMPILER dpcpp) set(CMAKE_CXX_COMPILER icpx)
register_definitions(CL_TARGET_OPENCL_VERSION=220) set(CMAKE_C_COMPILER icx)
register_append_cxx_flags(ANY -fsycl)
register_append_link_flags(-fsycl)
elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-Clang")
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER clang)
register_append_cxx_flags(ANY -fsycl)
register_append_link_flags(-fsycl)
else () else ()
message(FATAL_ERROR "SYCL_COMPILER=${SYCL_COMPILER} is unsupported") message(FATAL_ERROR "SYCL_COMPILER=${SYCL_COMPILER} is unsupported")
endif () endif ()

View File

@ -6,16 +6,16 @@ register_flag_optional(CMAKE_CXX_COMPILER
register_flag_required(SYCL_COMPILER register_flag_required(SYCL_COMPILER
"Compile using the specified SYCL compiler implementation "Compile using the specified SYCL compiler implementation
Supported values are 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) ONEAPI-ICPX - icpx as a standalone compiler
ONEAPI-ICPX - icpx as a standalone compiler ONEAPI-Clang - oneAPI's Clang driver (enabled via `source /opt/intel/oneapi/setvars.sh --include-intel-llvm`)
DPCPP - dpc++ as a standalone compiler (https://github.com/intel/llvm) DPCPP - dpc++ as a standalone compiler (https://github.com/intel/llvm)
HIPSYCL - hipSYCL compiler (https://github.com/illuhad/hipSYCL) HIPSYCL - hipSYCL compiler (https://github.com/illuhad/hipSYCL)
COMPUTECPP - ComputeCpp compiler (https://developer.codeplay.com/products/computecpp/ce/home)") COMPUTECPP - ComputeCpp compiler (https://developer.codeplay.com/products/computecpp/ce/home)")
register_flag_optional(SYCL_COMPILER_DIR 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`: "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)
ONEAPI-ICPX - `icpx` must be used for OneAPI 2023 and later on releases (i.e `source /opt/intel/oneapi/setvars.sh` first) ONEAPI-ICPX - `icpx` must be used for OneAPI 2023 and later on releases (i.e `source /opt/intel/oneapi/setvars.sh` first)
ONEAPI-Clang - set to the directory that contains the Intel clang++ binary.
HIPSYCL|DPCPP|COMPUTECPP - set to the root of the binary distribution that contains at least `bin/`, `include/`, and `lib/`" HIPSYCL|DPCPP|COMPUTECPP - set to the root of the binary distribution that contains at least `bin/`, `include/`, and `lib/`"
"") "")
@ -49,7 +49,8 @@ macro(setup)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
set(ComputeCpp_DIR ${SYCL_COMPILER_DIR}) set(ComputeCpp_DIR ${SYCL_COMPILER_DIR})
setup_opencl_header_includes() # don't point to the CL dir as the imports already have the CL prefix
set(OpenCL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}")
register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0) register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0)
# ComputeCpp needs OpenCL # ComputeCpp needs OpenCL
@ -61,16 +62,16 @@ macro(setup)
elseif (${SYCL_COMPILER} STREQUAL "DPCPP") elseif (${SYCL_COMPILER} STREQUAL "DPCPP")
set(CMAKE_CXX_COMPILER ${SYCL_COMPILER_DIR}/bin/clang++) set(CMAKE_CXX_COMPILER ${SYCL_COMPILER_DIR}/bin/clang++)
include_directories(${SYCL_COMPILER_DIR}/include/sycl) include_directories(${SYCL_COMPILER_DIR}/include/sycl)
register_definitions(CL_TARGET_OPENCL_VERSION=220)
register_append_cxx_flags(ANY -fsycl) register_append_cxx_flags(ANY -fsycl)
register_append_link_flags(-fsycl) register_append_link_flags(-fsycl)
elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-DPCPP")
set(CMAKE_CXX_COMPILER dpcpp)
register_definitions(CL_TARGET_OPENCL_VERSION=220)
elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-ICPX") elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-ICPX")
set(CMAKE_CXX_COMPILER icpx) set(CMAKE_CXX_COMPILER icpx)
include_directories(${SYCL_COMPILER_DIR}/include/sycl) set(CMAKE_C_COMPILER icx)
register_definitions(CL_TARGET_OPENCL_VERSION=220) register_append_cxx_flags(ANY -fsycl)
register_append_link_flags(-fsycl)
elseif (${SYCL_COMPILER} STREQUAL "ONEAPI-Clang")
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER clang)
register_append_cxx_flags(ANY -fsycl) register_append_cxx_flags(ANY -fsycl)
register_append_link_flags(-fsycl) register_append_link_flags(-fsycl)
else () else ()