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
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ include(${TORCH_XPU_OPS_ROOT}/cmake/SYCL.cmake)
include(${TORCH_XPU_OPS_ROOT}/cmake/ONEMKL.cmake)
include(${TORCH_XPU_OPS_ROOT}/cmake/BuildFlags.cmake)

set_build_flags()

# -- [ Re-generate the macros file for https://github.com/pytorch/pytorch/pull/147161
macro(update_caffe2_macros_file)
configure_file(
Expand All @@ -56,6 +58,11 @@ if(USE_XCCL)
endif()
endif()

set(USE_CUTLASS ON)
if (USE_CUTLASS)
include(${TORCH_XPU_OPS_ROOT}/cmake/CUTLASS.cmake)
endif()

if(BUILD_TEST)
add_subdirectory(${TORCH_XPU_OPS_ROOT}/test/sycl ${CMAKE_BINARY_DIR}/test_sycl)
endif()
Expand Down
253 changes: 138 additions & 115 deletions cmake/BuildFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,129 +23,152 @@ function(CHECK_SYCL_FLAG FLAG VARIABLE_NAME)
endfunction()

# Support GCC on Linux and MSVC on Windows at the moment.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# # -- Host flags (SYCL_CXX_FLAGS)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND SYCL_HOST_FLAGS /std:c++17)
list(APPEND SYCL_HOST_FLAGS /MD)
list(APPEND SYCL_HOST_FLAGS /EHsc) # exception handling
# SYCL headers warnings
list(APPEND SYCL_HOST_FLAGS /wd4996) # allow usage of deprecated functions
list(APPEND SYCL_HOST_FLAGS /wd4018) # allow signed and unsigned comparison
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
list(APPEND SYCL_HOST_FLAGS -fPIC)
list(APPEND SYCL_HOST_FLAGS -std=c++17)
list(APPEND SYCL_HOST_FLAGS -Wunused-variable)
# SYCL headers warnings
list(APPEND SYCL_HOST_FLAGS -Wno-deprecated-declarations)
list(APPEND SYCL_HOST_FLAGS -Wno-deprecated)
list(APPEND SYCL_HOST_FLAGS -Wno-attributes)
list(APPEND SYCL_HOST_FLAGS -Wno-sign-compare)
endif()
macro(set_build_flags)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(SYCL_HOST_FLAGS)
set(SYCL_KERNEL_OPTIONS)
set(SYCL_COMPILE_FLAGS ${SYCL_FLAGS})
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_LINK_FLAGS})
set(SYCL_OFFLINE_COMPILER_AOT_OPTIONS)
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS)
set(SYCL_OFFLINE_COMPILER_FLAGS)

if(CMAKE_BUILD_TYPE MATCHES Debug)
list(APPEND SYCL_HOST_FLAGS -g -fno-omit-frame-pointer -O0)
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
list(APPEND SYCL_HOST_FLAGS -g -O2)
endif()
if(USE_PER_OPERATOR_HEADERS)
list(APPEND SYCL_HOST_FLAGS -DAT_PER_OPERATOR_HEADERS)
endif()
list(APPEND SYCL_HOST_FLAGS -D__INTEL_LLVM_COMPILER_VERSION=${__INTEL_LLVM_COMPILER})
# -- Kernel flags (SYCL_KERNEL_OPTIONS)
# The fast-math will be enabled by default in SYCL compiler.
# Refer to [https://clang.llvm.org/docs/UsersManual.html#cmdoption-fno-fast-math]
# 1. We enable below flags here to be warn about NaN and Infinity,
# which will be hidden by fast-math by default.
# 2. The associative-math in fast-math allows floating point
# operations to be reassociated, which will lead to non-deterministic
# results compared with CUDA backend.
# 3. The approx-func allows certain math function calls (such as log, sqrt, pow, etc)
# to be replaced with an approximately equivalent set of instructions or
# alternative math function calls, which have great errors.
#
# PSEUDO of separate compilation with DPCPP compiler.
# 1. Kernel source compilation:
# icpx -fsycl -fsycl-target=${SYCL_TARGETS_OPTION} ${SYCL_FLAGS} -fsycl-host-compiler=gcc -fsycl-host-compiler-options='${CMAKE_HOST_FLAGS}' kernel.cpp -o kernel.o
# 2. Device code linkage:
# icpx -fsycl -fsycl-target=${SYCL_TARGETS_OPTION} -fsycl-link ${SYCL_DEVICE_LINK_FLAGS} -Xs '${SYCL_OFFLINE_COMPILER_FLAGS}' kernel.o -o device-code.o
# 3. Host only source compilation:
# gcc ${CMAKE_HOST_FLAGS} host.cpp -o host.o
# 4. Linkage:
# gcc -shared host.o kernel.o device-code.o -o libxxx.so
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fno-sycl-unnamed-lambda)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -sycl-std=2020)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} /fp:strict)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fhonor-nans)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fhonor-infinities)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fno-associative-math)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fno-approx-func)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -Wno-absolute-value)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -no-ftz)
endif()
if(REPLACE_FLAGS_FOR_CUTLASS)
set(CPP_STD c++20)
else()
set(CPP_STD c++17)
endif()
# # -- Host flags (SYCL_CXX_FLAGS)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND SYCL_HOST_FLAGS /std:${CPP_STD})
list(APPEND SYCL_HOST_FLAGS /MD)
list(APPEND SYCL_HOST_FLAGS /EHsc) # exception handling
# SYCL headers warnings
list(APPEND SYCL_HOST_FLAGS /wd4996) # allow usage of deprecated functions
list(APPEND SYCL_HOST_FLAGS /wd4018) # allow signed and unsigned comparison
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
list(APPEND SYCL_HOST_FLAGS -fPIC)
list(APPEND SYCL_HOST_FLAGS -std=${CPP_STD})
list(APPEND SYCL_HOST_FLAGS -Wunused-variable)
# SYCL headers warnings
list(APPEND SYCL_HOST_FLAGS -Wno-deprecated-declarations)
list(APPEND SYCL_HOST_FLAGS -Wno-deprecated)
list(APPEND SYCL_HOST_FLAGS -Wno-attributes)
list(APPEND SYCL_HOST_FLAGS -Wno-sign-compare)
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -g -O0 -Rno-debug-disables-optimization)
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -gline-tables-only -O2)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
list(APPEND SYCL_HOST_FLAGS -g -fno-omit-frame-pointer -O0)
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
list(APPEND SYCL_HOST_FLAGS -g -O2)
endif()
if(USE_PER_OPERATOR_HEADERS)
list(APPEND SYCL_HOST_FLAGS -DAT_PER_OPERATOR_HEADERS)
endif()
list(APPEND SYCL_HOST_FLAGS -D__INTEL_LLVM_COMPILER_VERSION=${__INTEL_LLVM_COMPILER})
# -- Kernel flags (SYCL_KERNEL_OPTIONS)
# The fast-math will be enabled by default in SYCL compiler.
# Refer to [https://clang.llvm.org/docs/UsersManual.html#cmdoption-fno-fast-math]
# 1. We enable below flags here to be warn about NaN and Infinity,
# which will be hidden by fast-math by default.
# 2. The associative-math in fast-math allows floating point
# operations to be reassociated, which will lead to non-deterministic
# results compared with CUDA backend.
# 3. The approx-func allows certain math function calls (such as log, sqrt, pow, etc)
# to be replaced with an approximately equivalent set of instructions or
# alternative math function calls, which have great errors.
#
# PSEUDO of separate compilation with DPCPP compiler.
# 1. Kernel source compilation:
# icpx -fsycl -fsycl-target=${SYCL_TARGETS_OPTION} ${SYCL_KERNEL_OPTIONS} -fsycl-host-compiler=gcc -fsycl-host-compiler-options='${CMAKE_HOST_FLAGS}' kernel.cpp -o kernel.o
# 2. Device code linkage:
# icpx -fsycl -fsycl-target=${SYCL_TARGETS_OPTION} -fsycl-link ${SYCL_DEVICE_LINK_FLAGS} -Xs '${SYCL_OFFLINE_COMPILER_FLAGS}' kernel.o -o device-code.o
# 3. Host only source compilation:
# gcc ${CMAKE_HOST_FLAGS} host.cpp -o host.o
# 4. Linkage:
# gcc -shared host.o kernel.o device-code.o -o libxxx.so
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fno-sycl-unnamed-lambda)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -sycl-std=2020)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} /fp:strict)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fhonor-nans)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fhonor-infinities)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fno-associative-math)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fno-approx-func)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -Wno-absolute-value)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -no-ftz)
endif()

set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -D__INTEL_LLVM_COMPILER_VERSION=${__INTEL_LLVM_COMPILER})
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -g -O0 -Rno-debug-disables-optimization)
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -gline-tables-only -O2)
endif()

CHECK_SYCL_FLAG("-fsycl-fp64-conv-emu" SUPPORTS_FP64_CONV_EMU)
if(SUPPORTS_FP64_CONV_EMU)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fsycl-fp64-conv-emu)
else()
message(WARNING "The compiler does not support the '-fsycl-fp64-conv-emu' flag, \
will disable it. On some platforms that don't support FP64, \
running operations with the FP64 datatype will raise a Runtime error: Required aspect fp64 is not supported on the device \
or a Native API failed error.")
endif()
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -D__INTEL_LLVM_COMPILER_VERSION=${__INTEL_LLVM_COMPILER})

set(TORCH_XPU_OPS_FLAGS ${SYCL_HOST_FLAGS})
CHECK_SYCL_FLAG("-fsycl-fp64-conv-emu" SUPPORTS_FP64_CONV_EMU)
if(SUPPORTS_FP64_CONV_EMU)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fsycl-fp64-conv-emu)
else()
message(WARNING "The compiler does not support the '-fsycl-fp64-conv-emu' flag, \
will disable it. On some platforms that don't support FP64, \
running operations with the FP64 datatype will raise a Runtime error: Required aspect fp64 is not supported on the device \
or a Native API failed error.")
endif()

# -- SYCL device object linkage flags
include(ProcessorCount)
ProcessorCount(proc_cnt)
if((DEFINED ENV{MAX_JOBS}) AND ("$ENV{MAX_JOBS}" LESS_EQUAL ${proc_cnt}))
set(SYCL_MAX_PARALLEL_LINK_JOBS $ENV{MAX_JOBS})
else()
set(SYCL_MAX_PARALLEL_LINK_JOBS ${proc_cnt})
endif()
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} -fsycl-max-parallel-link-jobs=${SYCL_MAX_PARALLEL_LINK_JOBS})
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} --offload-compress)
set(TORCH_XPU_OPS_FLAGS ${SYCL_HOST_FLAGS})

set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-poison-unsupported-fp64-kernels")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-intel-enable-auto-large-GRF-mode")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-fp32-correctly-rounded-divide-sqrt")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-intel-greater-than-4GB-buffer-required")
# -- SYCL device object linkage flags
include(ProcessorCount)
ProcessorCount(proc_cnt)
if((DEFINED ENV{MAX_JOBS}) AND ("$ENV{MAX_JOBS}" LESS_EQUAL ${proc_cnt}))
set(SYCL_MAX_PARALLEL_LINK_JOBS $ENV{MAX_JOBS})
else()
set(SYCL_MAX_PARALLEL_LINK_JOBS ${proc_cnt})
endif()
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} -fsycl-max-parallel-link-jobs=${SYCL_MAX_PARALLEL_LINK_JOBS})
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} --offload-compress)

set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-poison-unsupported-fp64-kernels")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-intel-enable-auto-large-GRF-mode")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-fp32-correctly-rounded-divide-sqrt")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-intel-greater-than-4GB-buffer-required")

if(WIN32)
set(AOT_TARGETS "mtl,mtl-h,bmg,dg2,arl-h,lnl-m")
else()
set(AOT_TARGETS "pvc,bmg,dg2,arl-h,mtl-h,lnl-m")
endif()
if(TORCH_XPU_ARCH_LIST)
set(AOT_TARGETS "${TORCH_XPU_ARCH_LIST}")
endif()
if(AOT_TARGETS STREQUAL "none")
set(TORCH_XPU_ARCH_LIST "" PARENT_SCOPE)
else()
set(SYCL_TARGETS_OPTION -fsycl-targets=spir64_gen,spir64)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} ${SYCL_TARGETS_OPTION})
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} ${SYCL_TARGETS_OPTION})
set(SYCL_OFFLINE_COMPILER_AOT_OPTIONS "-device ${AOT_TARGETS}")
set(TORCH_XPU_ARCH_LIST ${AOT_TARGETS} PARENT_SCOPE)
endif()
message(STATUS "Compile Intel GPU AOT Targets for ${AOT_TARGETS}")

set(SYCL_FLAGS ${SYCL_FLAGS} ${SYCL_KERNEL_OPTIONS})
if(REPLACE_FLAGS_FOR_CUTLASS)
set(SYCL_TARGETS_OPTION -fsycl-targets=spir64_gen)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} ${SYCL_TARGETS_OPTION})
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} ${SYCL_TARGETS_OPTION})
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} "-Xspirv-translator;-spirv-ext=+SPV_INTEL_split_barrier,+SPV_INTEL_2d_block_io,+SPV_INTEL_subgroup_matrix_multiply_accumulate")
set(SYCL_OFFLINE_COMPILER_AOT_OPTIONS "-device pvc,bmg")
else()
if(WIN32)
set(AOT_TARGETS "mtl,mtl-h,bmg,dg2,arl-h,lnl-m")
else()
set(AOT_TARGETS "pvc,bmg,dg2,arl-h,mtl-h,lnl-m")
endif()
if(TORCH_XPU_ARCH_LIST)
set(AOT_TARGETS "${TORCH_XPU_ARCH_LIST}")
endif()
if(AOT_TARGETS STREQUAL "none")
set(TORCH_XPU_ARCH_LIST "" PARENT_SCOPE)
else()
set(SYCL_TARGETS_OPTION -fsycl-targets=spir64_gen,spir64)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} ${SYCL_TARGETS_OPTION})
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} ${SYCL_TARGETS_OPTION})
set(SYCL_OFFLINE_COMPILER_AOT_OPTIONS "-device ${AOT_TARGETS}")
set(TORCH_XPU_ARCH_LIST ${AOT_TARGETS} PARENT_SCOPE)
endif()
message(STATUS "Compile Intel GPU AOT Targets for ${AOT_TARGETS}")
endif()

set(SYCL_COMPILE_FLAGS ${SYCL_COMPILE_FLAGS} ${SYCL_KERNEL_OPTIONS})

set(SYCL_OFFLINE_COMPILER_FLAGS "${SYCL_OFFLINE_COMPILER_AOT_OPTIONS}${SYCL_OFFLINE_COMPILER_CG_OPTIONS}")
else()
message("Not compiling with XPU. Currently only support GCC compiler on Linux and MSVC compiler on Windows as CXX compiler.")
return()
endif()
set(SYCL_OFFLINE_COMPILER_FLAGS "${SYCL_OFFLINE_COMPILER_AOT_OPTIONS}${SYCL_OFFLINE_COMPILER_CG_OPTIONS}")
else()
message("Not compiling with XPU. Currently only support GCC compiler on Linux and MSVC compiler on Windows as CXX compiler.")
return()
endif()
endmacro()
29 changes: 29 additions & 0 deletions cmake/CUTLASS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
macro(replace_cmake_build_flags)
set(CMAKE_C_FLAG_BK "${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_BK "${CMAKE_CXX_FLAGS}")
string(REPLACE "-Werror=format" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "-Werror=format" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endmacro()

macro(restore_cmake_build_flags)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAG_BK}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BK}")
endmacro()

if(NOT __CUTLASS_INCLUDED)
set(__CUTLASS_INCLUDED TRUE)
include(FetchContent)
FetchContent_Declare(
repo-cutlass-sycl
GIT_REPOSITORY https://github.com/LiyangLingIntel/cutlass-sycl.git # https://github.com/intel/cutlass-sycl
GIT_TAG liyang/unnamed-poc # main
GIT_SHALLOW OFF
)
FetchContent_GetProperties(repo-cutlass-sycl)
if(NOT repo-cutlass-sycl_POPULATED)
FetchContent_Populate(repo-cutlass-sycl)
endif()
set(CUTLASS_SYCL_INCLUDE_DIRS ${repo-cutlass-sycl_SOURCE_DIR}/include
${repo-cutlass-sycl_SOURCE_DIR}/tools/util/include)
set(CUTLASS_SYCL_COMPILE_DEFINITIONS CUTLASS_ENABLE_SYCL SYCL_INTEL_TARGET)
endif()
4 changes: 1 addition & 3 deletions cmake/Modules/FindSYCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# SYCL_COMPILER
# -- SYCL compiler's executable.
#
# SYCL_FLAGS
# SYCL_COMPILE_FLAGS
# -- SYCL compiler's compilation command line arguments.
#
# SYCL_HOST_FLAGS
Expand Down Expand Up @@ -212,7 +212,6 @@ endfunction()

macro(SYCL_WRAP_SRCS sycl_target generated_files)
# Optional arguments
set(SYCL_flags "")
set(generated_extension ${CMAKE_${SYCL_C_OR_CXX}_OUTPUT_EXTENSION})

set(SYCL_include_dirs "${SYCL_INCLUDE_DIR}")
Expand Down Expand Up @@ -383,7 +382,6 @@ macro(SYCL_LINK_DEVICE_OBJECTS output_file sycl_target)
set(SYCL_device_link_flags
${link_type_flag}
${important_host_flags}
${SYCL_FLAGS}
${SYCL_DEVICE_LINK_FLAGS})

file(RELATIVE_PATH output_file_relative_path "${CMAKE_BINARY_DIR}" "${output_file}")
Expand Down
10 changes: 5 additions & 5 deletions cmake/Modules/FindSYCL/run_sycl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(SYCL_host_compiler "@SYCL_HOST_COMPILER@") # path
set(generated_file_path "@generated_file_path@") # path
set(generated_file_internal "@generated_file@") # path
set(SYCL_executable "@SYCL_EXECUTABLE@") # path
set(SYCL_flags @SYCL_FLAGS@) # list
set(SYCL_compile_flags @SYCL_COMPILE_FLAGS@) # list
set(SYCL_include_dirs [==[@SYCL_include_dirs@]==]) # list
set(SYCL_compile_definitions [==[@SYCL_compile_definitions@]==]) # list

Expand All @@ -47,10 +47,10 @@ foreach(dir ${SYCL_include_dirs})
endif()
endforeach()

# Clean up list of compile definitions, add -D flags, and append to SYCL_flags
# Clean up list of compile definitions, add -D flags, and append to SYCL_compile_flags
list(REMOVE_DUPLICATES SYCL_compile_definitions)
foreach(def ${SYCL_compile_definitions})
list(APPEND SYCL_flags "-D${def}")
list(APPEND SYCL_compile_flags "-D${def}")
endforeach()

# Choose host flags in FindSYCL.cmake
Expand All @@ -72,7 +72,7 @@ foreach(def ${SYCL_compile_definitions})
endforeach()

# string(APPEND SYCL_host_compiler_flags "\"")
set(SYCL_host_compiler "-fsycl-host-compiler=${SYCL_host_compiler}")
set(SYCL_host_compiler "-fsycl-host-compiler=g++-13")

# SYCL_execute_process - Executes a command with optional command echo and status message.
#
Expand Down Expand Up @@ -134,7 +134,7 @@ SYCL_execute_process(
${SYCL_include_args}
${SYCL_host_compiler}
${SYCL_host_compiler_flags}
${SYCL_flags}
${SYCL_compile_flags}
)

if(SYCL_result)
Expand Down
Loading