Skip to content

Commit

Permalink
Merge pull request #247 from CongMa13/asan_targets
Browse files Browse the repository at this point in the history
Update gfxTargets for ASAN pipeline
  • Loading branch information
CongMa13 authored Jul 16, 2024
2 parents c949394 + 5ededed commit bb310ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,23 @@ include(ROCMPackageConfigHelpers)
include(ROCMInstallSymlinks)
include(CheckCXXCompilerFlag)

# check if asan is enabled
if (NOT DEFINED ADDRESS_SANITIZER AND DEFINED ENV{ADDRESS_SANITIZER})
set(ADDRESS_SANITIZER $ENV{ADDRESS_SANITIZER})
endif()
if (ADDRESS_SANITIZER OR CMAKE_CXX_FLAGS MATCHES "-fsanitize=address")
set(ADDRESS_SANITIZER_ENABLED ON)
else()
set(ADDRESS_SANITIZER_ENABLED OFF)
endif()

if (ADDRESS_SANITIZER_ENABLED)
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
TARGETS "gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx940;gfx941;gfx942" )
TARGETS "gfx90a:xnack+;gfx940:xnack+;gfx941:xnack+;gfx942:xnack+" )
else()
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
TARGETS "gfx908;gfx90a;gfx940;gfx941;gfx942" )
endif()

# Variable AMDGPU_TARGET must be a cached variable and must be specified before calling find_package(hip)
# This is because hip-config.cmake sets --offload-arch via AMDGPU_TARGET cached variable __after__ setting
Expand Down
6 changes: 1 addition & 5 deletions library/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ include_directories(BEFORE
${PROJECT_SOURCE_DIR}/library/src/include
)

if (NOT DEFINED ADDRESS_SANITIZER AND DEFINED ENV{ADDRESS_SANITIZER})
set(ADDRESS_SANITIZER $ENV{ADDRESS_SANITIZER})
endif()

if (ADDRESS_SANITIZER OR CMAKE_CXX_FLAGS MATCHES "-fsanitize=address")
if (ADDRESS_SANITIZER_ENABLED)
add_compile_options(-mcmodel=large)
add_link_options(-mcmodel=large)
endif()
Expand Down

0 comments on commit bb310ca

Please sign in to comment.