Skip to content

Commit

Permalink
Use --offload-compress linker option to compress offload sections
Browse files Browse the repository at this point in the history
See https://www.intel.com/content/www/us/en/developer/articles/technical/sycl-compilation-device-image-compression.html

It is applicable for any SYCL targets. This change results in 28.4% reduction in
shared objects sizes with offload sections on Linux.
  • Loading branch information
oleksandr-pavlyk committed Jan 10, 2025
1 parent 9f8f90b commit 62d0888
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dpctl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ function(build_dpctl_ext _trgt _src _dest)
Python_add_library(${_trgt} MODULE WITH_SOABI ${_generated_src})
if (BUILD_DPCTL_EXT_SYCL)
add_sycl_to_target(TARGET ${_trgt} SOURCES ${_generated_src})
target_compile_options(${_trgt} PRIVATE -fno-sycl-id-queries-fit-in-int)
target_link_options(${_trgt} PRIVATE -fsycl-device-code-split=per_kernel --offload-compress)
if(_dpctl_sycl_targets)
# make fat binary
target_compile_options(
Expand Down
2 changes: 1 addition & 1 deletion dpctl/tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ endforeach()
set(_linker_options "LINKER:${DPCTL_LDFLAGS}")
foreach(python_module_name ${_py_trgts})
target_compile_options(${python_module_name} PRIVATE -fno-sycl-id-queries-fit-in-int)
target_link_options(${python_module_name} PRIVATE -fsycl-device-code-split=per_kernel)
target_link_options(${python_module_name} PRIVATE -fsycl-device-code-split=per_kernel --offload-compress)
target_include_directories(${python_module_name}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/include
Expand Down
2 changes: 1 addition & 1 deletion dpctl/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ list(APPEND _pybind11_targets ${python_module_name})
set(_linker_options "LINKER:${DPCTL_LDFLAGS}")
foreach(python_module_name ${_pybind11_targets})
target_compile_options(${python_module_name} PRIVATE -fno-sycl-id-queries-fit-in-int)
target_link_options(${python_module_name} PRIVATE -fsycl-device-code-split=per_kernel)
target_link_options(${python_module_name} PRIVATE -fsycl-device-code-split=per_kernel --offload-compress)
target_include_directories(${python_module_name}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/include
Expand Down

0 comments on commit 62d0888

Please sign in to comment.