fixed compilation targets on cmake (#182)

* fixed compilation targets on cmake
* moved gpu target generation


[ROCm/rocshmem commit: e2e334e630]
This commit is contained in:
akolliasAMD
2025-07-04 13:27:20 -06:00
committed by GitHub
parent 81b55c3769
commit 3bb0b22fa5
+37 -40
View File
@@ -92,6 +92,43 @@ include(ROCMCheckTargetIds)
rocm_setup_version(VERSION ${VERSION_STRING})
#############################################################################
# SET GPU ARCHITECTURES
#############################################################################
include(cmake/rocm_local_targets.cmake)
set(DEFAULT_GPUS
gfx90a:xnack-;
gfx90a:xnack+;
gfx942:xnack-;
gfx942:xnack+;
gfx950:xnack-;
gfx950:xnack+)
if (BUILD_LOCAL_GPU_TARGET_ONLY)
message(STATUS "Building only for local GPU target")
if (COMMAND rocm_local_targets)
rocm_local_targets(DEFAULT_GPUS)
else()
message(WARNING "Unable to determine local GPU targets. Falling back to default GPUs.")
endif()
endif()
set(DEFAULT_GPU_TARGETS "${DEFAULT_GPUS}" CACHE STRING
"Target default GPUs if GPU_TARGETS is not defined.")
if (COMMAND rocm_check_target_ids)
message(STATUS "Checking for ROCm support for GPU targets: " "${DEFAULT_GPU_TARGETS}")
rocm_check_target_ids(SUPPORTED_GPUS TARGETS ${DEFAULT_GPU_TARGETS})
else()
message(WARNING "Unable to check for supported GPU targets.")
set(SUPPORTED_GPUS ${DEFAULT_GPU_TARGETS})
endif()
set(GPU_TARGETS "${SUPPORTED_GPUS}" CACHE STRING "GPU architectures to compile for")
message(STATUS "Compiling for ${GPU_TARGETS}")
###############################################################################
# CREATE ROCSHMEM LIBRARY
###############################################################################
@@ -100,46 +137,6 @@ if (NOT BUILD_TESTS_ONLY)
add_library(roc::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
add_subdirectory(src)
#############################################################################
# SET GPU ARCHITECTURES
#############################################################################
include(cmake/rocm_local_targets.cmake)
set(DEFAULT_GPUS
gfx90a:xnack-;
gfx90a:xnack+;
gfx942:xnack-;
gfx942:xnack+;
gfx950:xnack-;
gfx950:xnack+)
if (BUILD_LOCAL_GPU_TARGET_ONLY)
message(STATUS "Building only for local GPU target")
if (COMMAND rocm_local_targets)
rocm_local_targets(DEFAULT_GPUS)
else()
message(WARNING "Unable to determine local GPU targets. Falling back to default GPUs.")
endif()
endif()
set(GPU_TARGETS "${DEFAULT_GPUS}" CACHE STRING
"Target default GPUs if GPU_TARGETS is not defined.")
if (COMMAND rocm_check_target_ids)
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.")
set(SUPPORTED_GPUS ${GPU_TARGETS})
endif()
set(COMPILING_TARGETS "${SUPPORTED_GPUS}" CACHE STRING "GPU targets to compile for.")
message(STATUS "Compiling for ${COMPILING_TARGETS}")
foreach (target ${COMPILING_TARGETS})
list(APPEND offload_flags --offload-arch=${target})
endforeach()
#############################################################################
# PACKAGE DEPENDENCIES
#############################################################################