Skip to content

Commit

Permalink
Port address sanitizer changes to 6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmroberts authored Oct 11, 2024
2 parents 75b8283 + aedc46b commit 42e0528
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Documentation for hipFFT is available at

* The AMD backend is now compiled using amdclang++ instead of hipcc. The NVIDIA CUDA backend still uses hipcc-nvcc.
* CLI11 replaces Boost Program Options as the command line parser for clients.
* Building with the address sanitizer option sets xnack+ for the relevant GPU
architectures.

## hipFFT 1.0.16 for ROCm 6.2.4

Expand Down
44 changes: 36 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,38 @@ option(BUILD_ADDRESS_SANITIZER "Build with address sanitizer enabled" OFF)

option( WERROR "Treat warnings as errors" OFF )

set(DEFAULT_GPUS
gfx803
gfx900
gfx906
gfx908
gfx90a
gfx940
gfx941
gfx942
gfx1030
gfx1100
gfx1101
gfx1102
gfx1151
gfx1200
gfx1201)

if(BUILD_ADDRESS_SANITIZER)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
add_link_options(-shared-libasan)
SET(DEFAULT_GPUS
gfx908:xnack+
gfx90a:xnack+
gfx940:xnack+
gfx941:xnack+
gfx942:xnack+)
add_link_options(-fuse-ld=lld)
add_compile_definitions(ADDRESS_SANITIZER)
endif()


# Set internal BUILD_WITH_COMPILER.
if(NOT (CMAKE_CXX_COMPILER MATCHES ".*hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+"))
set( BUILD_WITH_COMPILER "HOST-default" )
Expand Down Expand Up @@ -121,19 +153,15 @@ if (BUILD_WITH_COMPILER STREQUAL "HIP-NVCC" )
endforeach()
set( WARNING_FLAGS ${NVCC_WARNING_FLAGS} )

else()
else()
# Define GPU targets
set( AMDGPU_TARGETS gfx803;gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201 CACHE STRING
"List of specific machine types for library to target" )
set(AMDGPU_TARGETS "${DEFAULT_GPUS}" CACHE STRING "Target default GPUs if AMDGPU_TARGETS is not defined.")
#rocm_check_target_ids(AMDGPU_TARGETS TARGETS "${AMDGPU_TARGETS}")


if( BUILD_WITH_COMPILER STREQUAL "HIP-CLANG" )
set( HIP_PLATFORM "amd" )
set( HIP_COMPILER "clang" )
if(BUILD_ADDRESS_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -shared-libasan")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -shared-libasan")
add_link_options(-fuse-ld=lld)
endif()
endif()
endif()

Expand Down

0 comments on commit 42e0528

Please sign in to comment.