Skip to content

Commit

Permalink
Added BUILD_OFFLOAD_COMPRESS
Browse files Browse the repository at this point in the history
  • Loading branch information
dlangbe committed Dec 3, 2024
1 parent ada3f97 commit e4f504a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ if( CMAKE_PROJECT_NAME STREQUAL "rocwmma" )
option( ROCWMMA_BUILD_TESTS "Build rocWMMA tests" ON )
option( ROCWMMA_BUILD_SAMPLES "Build rocWMMA samples" ON )
option( ROCWMMA_BUILD_ASSEMBLY "Output assembly files" OFF )
option( BUILD_OFFLOAD_COMPRESS "Build rocWMMA with offload compression" ON )
endif()

if( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
Expand Down Expand Up @@ -105,11 +106,13 @@ endif()

# Check if offload compression is supported
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("--offload-compress" CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
if (NOT CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
set(CMAKE_NO_BUILTIN_CHRPATH ON)
elseif(CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
set(CMAKE_NO_BUILTIN_CHRPATH OFF)
if (BUILD_OFFLOAD_COMPRESS)
check_cxx_compiler_flag("--offload-compress" CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
if (NOT CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
set(CMAKE_NO_BUILTIN_CHRPATH ON)
elseif(CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
set(CMAKE_NO_BUILTIN_CHRPATH OFF)
endif()
endif()


Expand Down
6 changes: 5 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# MIT License
#
# Copyright (C) 2021-2024 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2021-2025 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -88,6 +88,10 @@ function(add_rocwmma_test TEST_TARGET TEST_SOURCE)
target_include_directories(${TEST_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${ROCWMMA_TEST_INCLUDE_DIRS})
# Use offload compress flag if it is supported
if(BUILD_OFFLOAD_COMPRESS AND CXX_COMPILER_SUPPORTS_OFFLOAD_COMPRESS)
target_compile_options(${COMPONENT_NAME} PRIVATE "--offload-compress" )
endif()

# Add support to include extended test coverage
if(ROCWMMA_BUILD_EXTENDED_TESTS)
Expand Down

0 comments on commit e4f504a

Please sign in to comment.