Skip to content

Commit

Permalink
changed the CMake option from AMDGPU_TARGETS to GPU_TARGETS (#1440)
Browse files Browse the repository at this point in the history
  • Loading branch information
akolliasAMD authored Dec 12, 2024
1 parent 7386fac commit 45c1c1a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,33 @@ if (BUILD_LOCAL_GPU_TARGET_ONLY)
endif()

# Determine which GPU architectures to build for
set(AMDGPU_TARGETS "${DEFAULT_GPUS}" CACHE STRING "Target default GPUs if AMDGPU_TARGETS is not defined.")
set(GPU_TARGETS "${DEFAULT_GPUS}" CACHE STRING "Target default GPUs if GPU_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)
foreach(amdgpu_target IN LISTS GPU_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)
SET(GPU_TARGETS "${amdgpu_targets}" CACHE STRING "Modified GPU list for Address-Sanitizer enabled build." FORCE)
endif()

# Check if clang compiler can offload to AMDGPU_TARGETS
# Check if clang compiler can offload to GPU_TARGETS
if (COMMAND rocm_check_target_ids)
message(STATUS "Checking for ROCm support for GPU targets: " "${AMDGPU_TARGETS}")
rocm_check_target_ids(SUPPORTED_GPUS TARGETS ${AMDGPU_TARGETS})
message(STATUS "Checking for ROCm support for GPU targets: " "${GPU_TARGETS}")
rocm_check_target_ids(SUPPORTED_GPUS TARGETS ${GPU_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}")
set(COMPILING_TARGETS "${SUPPORTED_GPUS}" CACHE STRING "GPU targets to compile for.")
message(STATUS "Compiling for ${COMPILING_TARGETS}")

## NOTE: Reload rocm-cmake in order to update GPU_TARGETS
include(cmake/Dependencies.cmake) # Reloading to use desired GPU_TARGETS instead of defaults
## NOTE: Reload rocm-cmake in order to update COMPILING_TARGETS
include(cmake/Dependencies.cmake) # Reloading to use desired COMPILING_TARGETS instead of defaults

# Try to establish ROCM_PATH (for find_package)
#==================================================================================================
Expand Down Expand Up @@ -301,7 +301,7 @@ endif()

## Disable building MSCCL++ if the build environment is invalid
## Currently MSCCL++ is supported only on gfx942
if (ENABLE_MSCCLPP AND NOT ("gfx942" IN_LIST GPU_TARGETS OR "gfx942:xnack-" IN_LIST GPU_TARGETS OR "gfx942:xnack+" IN_LIST GPU_TARGETS))
if (ENABLE_MSCCLPP AND NOT ("gfx942" IN_LIST COMPILING_TARGETS OR "gfx942:xnack-" IN_LIST COMPILING_TARGETS OR "gfx942:xnack+" IN_LIST COMPILING_TARGETS))
set(ENABLE_MSCCLPP OFF)
message(WARNING "Can only build MSCCL++ for gfx942; disabling MSCCL++ build")
endif()
Expand Down Expand Up @@ -744,7 +744,7 @@ if (HAVE_KERNARG_PRELOAD)
endif()

## NOTE: This is currently being handled by rocm-cmake, however may need to be re-enabled in the future
#foreach(target ${GPU_TARGETS})
#foreach(target ${COMPILING_TARGETS})
# target_compile_options(rccl PRIVATE --offload-arch=${target})
#endforeach()

Expand Down Expand Up @@ -868,7 +868,7 @@ if(NOT BUILD_SHARED_LIBS)
endif()
endforeach()

foreach(target ${GPU_TARGETS})
foreach(target ${COMPILING_TARGETS})
list(APPEND static_link_flags --offload-arch=${target})
endforeach()
list(JOIN static_link_flags " " flags_str)
Expand Down
4 changes: 2 additions & 2 deletions cmake/MSCCLPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if(ENABLE_MSCCLPP)
)

message(STATUS "Building mscclpp only for gfx942.")

mscclpp_cmake_arg(CMAKE_PREFIX_PATH)
mscclpp_cmake_arg(CMAKE_INSTALL_RPATH_USE_LINK_PATH)
mscclpp_cmake_arg(HIP_COMPILER)
Expand All @@ -82,7 +82,7 @@ if(ENABLE_MSCCLPP)
if(BUILD_ADDRESS_SANITIZER)
set(GFX942_VARIANT "gfx942:xnack+")
endif()

download_project(PROJ mscclpp_nccl
# GIT_REPOSITORY https://github.com/microsoft/mscclpp.git
# GIT_TAG 1e82dd444fc1ed8b7add354eebaab8a94e67d5fc
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ fi

# Build for specified GPU target(s) only
if [[ ! -z "${build_amdgpu_targets}" ]]; then
cmake_common_options="${cmake_common_options} -DAMDGPU_TARGETS=${build_amdgpu_targets}"
cmake_common_options="${cmake_common_options} -DGPU_TARGETS=${build_amdgpu_targets}"
fi

# shared vs static
Expand Down

0 comments on commit 45c1c1a

Please sign in to comment.