Skip to content

Commit

Permalink
Update gfxTargets for ASAN pipeline
Browse files Browse the repository at this point in the history
ASAN needs xnack feature. Enable xnack of all targets.
  • Loading branch information
CongMa13 committed Jul 10, 2024
1 parent c949394 commit 9ddf4e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 15 additions & 0 deletions 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+;gfx940:xnack+;gfx941:xnack+;gfx942:xnack+" )
else()
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
TARGETS "gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;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 9ddf4e5

Please sign in to comment.