Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use --offload-compress linker option to compress offload sections #1961

Merged
merged 3 commits into from
Jan 14, 2025
Merged
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
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ set(DPCTL_TARGET_HIP
CACHE STRING
"Build DPCTL to target a HIP device architecture"
)
option(DPCTL_WITH_REDIST "Build DPCTL assuming DPC++ redistributable is installed into Python prefix" OFF)
option(
DPCTL_WITH_REDIST
"Build DPCTL assuming DPC++ redistributable is installed into Python prefix"
OFF)
option(
DPCTL_OFFLOAD_COMPRESS
"Build using offload section compression feature of DPC++ to reduce \
size of shared object with offloading sections"
OFF
)

find_package(IntelSYCL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/cmake NO_DEFAULT_PATH)

Expand Down
5 changes: 5 additions & 0 deletions dpctl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ 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)
if (DPCTL_OFFLOAD_COMPRESS)
target_link_options(${_trgt} PRIVATE --offload-compress)
endif()
if(_dpctl_sycl_targets)
# make fat binary
target_compile_options(
Expand Down
6 changes: 5 additions & 1 deletion dpctl/tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ 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)
if (DPCTL_OFFLOAD_COMPRESS)
target_link_options(${python_module_name} PRIVATE --offload-compress)
endif()

target_include_directories(${python_module_name}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/include
Expand All @@ -279,7 +283,7 @@ foreach(python_module_name ${_py_trgts})
target_compile_options(${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
endif()
endif()
target_link_options(${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
Expand Down
6 changes: 5 additions & 1 deletion dpctl/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ 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)
if (DPCTL_OFFLOAD_COMPRESS)
target_link_options(${python_module_name} PRIVATE --offload-compress)
endif()

target_include_directories(${python_module_name}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/include
Expand All @@ -40,7 +44,7 @@ foreach(python_module_name ${_pybind11_targets})
target_compile_options(${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
endif()
endif()
target_link_options(${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
Expand Down
Loading