From 4f31ab85eae67968ef2e70017394100aa372a80e Mon Sep 17 00:00:00 2001 From: Nilesh M Negi Date: Tue, 6 Aug 2024 10:53:51 -0500 Subject: [PATCH] [BUILD] Update gfxTargets for ASAN build (#1242) Signed-off-by: nileshnegi --- CMakeLists.txt | 25 ++++++++++++++++++------- README.md | 2 ++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e5065a27e..2cac2be33d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,12 +38,9 @@ option(TRACE "Enable additional tracing" # Default GPU architectures to build #================================================================================================== set(DEFAULT_GPUS - gfx803 - gfx900:xnack- - gfx906:xnack- - gfx908:xnack- - gfx90a:xnack- - gfx90a:xnack+ + gfx906 + gfx908 + gfx90a gfx940 gfx941 gfx942 @@ -75,13 +72,27 @@ endif() # Determine which GPU architectures to build for set(AMDGPU_TARGETS "${DEFAULT_GPUS}" CACHE STRING "Target default GPUs if AMDGPU_TARGETS is not defined.") + +# Modify GPU architectures for Address Sanitizer builds by appending "xnack+" +if (BUILD_ADDRESS_SANITIZER) + SET(amdgpu_targets "") + foreach(amdgpu_target IN LISTS AMDGPU_TARGETS) + if(NOT amdgpu_target STREQUAL "") + list(APPEND amdgpu_targets "${amdgpu_target}:xnack+") + endif() + endforeach() + SET(AMDGPU_TARGETS "${amdgpu_targets}" CACHE STRING "Modified GPU list for Address-Sanitizer enabled build." FORCE) +endif() + +# Check if clang compiler can offload to AMDGPU_TARGETS if (COMMAND rocm_check_target_ids) - message(STATUS "Checking for ROCm support for GPU targets:") + message(STATUS "Checking for ROCm support for GPU targets: " "${AMDGPU_TARGETS}") rocm_check_target_ids(SUPPORTED_GPUS TARGETS ${AMDGPU_TARGETS}) else() message(WARNING "Unable to check for supported GPU targets. Falling back to default GPUs.") set(SUPPORTED_GPUS ${DEFAULT_GPUS}) endif() + set(GPU_TARGETS "${SUPPORTED_GPUS}" CACHE STRING "GPU targets to compile for.") message(STATUS "Compiling for ${GPU_TARGETS}") diff --git a/README.md b/README.md index 13f7643eff..abaac66a13 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ RCCL build & installation helper script --verbose Show compile commands ``` +By default, RCCL builds for all GPU targets defined in `DEFAULT_GPUS` in `CMakeLists.txt`. To target specific GPU(s), and potentially reduce build time, use `--amdgpu_targets` as a `;` separated string listing GPU(s) to target. + ## Manual build ### To build the library using CMake: