From 1152542dab97f32d7757d5483ad0a0d8a3d2ca59 Mon Sep 17 00:00:00 2001 From: Illia Silin <98187287+illsilin@users.noreply.github.com> Date: Mon, 5 Aug 2024 08:26:01 -0700 Subject: [PATCH] add --offload-compress compiler flag (#1433) * add --offload-compress compiler flag * only apply the --offload-compress flag to the ckProfiler * move the --offload-compress flag back to main cmake file * add offload-compress to target compile option of ckProfiler --------- Co-authored-by: carlushuang [ROCm/composable_kernel commit: 7f57b2e02c4312f179304952766e93f8b6d97b83] --- library/src/tensor_operation_instance/gpu/CMakeLists.txt | 7 +++++++ profiler/src/CMakeLists.txt | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/library/src/tensor_operation_instance/gpu/CMakeLists.txt b/library/src/tensor_operation_instance/gpu/CMakeLists.txt index 2081422e3a..eab81f215d 100644 --- a/library/src/tensor_operation_instance/gpu/CMakeLists.txt +++ b/library/src/tensor_operation_instance/gpu/CMakeLists.txt @@ -87,6 +87,13 @@ function(add_instance_library INSTANCE_NAME) endforeach() add_library(${INSTANCE_NAME} OBJECT ${INST_OBJ}) target_compile_features(${INSTANCE_NAME} PUBLIC) + + # flags to compress the library + if(NOT WIN32 AND ${hip_VERSION_FLAT} GREATER 600241132) + message("Adding --offload-compress flag for ${INSTANCE_NAME}") + target_compile_options(${INSTANCE_NAME} PRIVATE --offload-compress) + endif() + set_target_properties(${INSTANCE_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) clang_tidy_check(${INSTANCE_NAME}) set(result 0) diff --git a/profiler/src/CMakeLists.txt b/profiler/src/CMakeLists.txt index 44f65674be..3fcf87d6a3 100755 --- a/profiler/src/CMakeLists.txt +++ b/profiler/src/CMakeLists.txt @@ -82,6 +82,11 @@ set(PROFILER_EXECUTABLE ckProfiler) add_executable(${PROFILER_EXECUTABLE} ${PROFILER_SOURCES}) target_compile_options(${PROFILER_EXECUTABLE} PRIVATE -Wno-global-constructors) +# flags to compress the library +if(NOT WIN32 AND ${hip_VERSION_FLAT} GREATER 600241132) + message("Adding --offload-compress flag for ${PROFILER_EXECUTABLE}") + target_compile_options(${PROFILER_EXECUTABLE} PRIVATE --offload-compress) +endif() target_link_libraries(${PROFILER_EXECUTABLE} PRIVATE utility getopt::getopt) target_link_libraries(${PROFILER_EXECUTABLE} PRIVATE device_gemm_instance)