Skip to content

Commit ab48005

Browse files
xuhancnStonepia
andauthored
add CMAKE_SYCL_COMPILER_LAUNCHER for sccache. (#2260)
Add `CMAKE_SYCL_COMPILER_LAUNCHER` for sccache enabling, please reference to https://github.com/pytorch/pytorch/blob/7d67a41db4801632d5862e99c79b766284dfd307/.ci/pytorch/windows/build_pytorch.bat#L91C13-L91C41 When we setup `CMAKE_SYCL_COMPILER_LAUNCHER` to sccache binary, it will enable sccache. When we didn't set `CMAKE_SYCL_COMPILER_LAUNCHER`, it should be blank, and didn't change original logical. Sccache usage: https://github.com/mozilla/sccache?tab=readme-ov-file#usage Co-authored-by: Stonepia <[email protected]>
1 parent 8e51ba6 commit ab48005

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmake/Modules/FindSYCL.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
#
3636
# SYCL_ADD_LIBRARY
3737

38+
if(NOT CMAKE_SYCL_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_SYCL_COMPILER_LAUNCHER})
39+
set(CMAKE_SYCL_COMPILER_LAUNCHER "$ENV{CMAKE_SYCL_COMPILER_LAUNCHER}"
40+
CACHE STRING "Compiler launcher for SYCL.")
41+
endif()
42+
3843
macro(SYCL_FIND_HELPER_FILE _name _extension)
3944
set(_full_name "${_name}.${_extension}")
4045
# CMAKE_CURRENT_LIST_FILE contains the full path to the file currently being
@@ -405,7 +410,7 @@ macro(SYCL_LINK_DEVICE_OBJECTS output_file sycl_target)
405410
add_custom_command(
406411
OUTPUT ${output_file}
407412
DEPENDS ${object_files}
408-
COMMAND ${SYCL_EXECUTABLE}
413+
COMMAND ${CMAKE_SYCL_COMPILER_LAUNCHER} ${SYCL_EXECUTABLE}
409414
${SYCL_device_link_flags}
410415
-fsycl-link ${object_files}
411416
-Xs ${SYCL_OFFLINE_COMPILER_FLAGS}

0 commit comments

Comments
 (0)