From f93a5933f19f90bff9f8a18f504996984fa8467d Mon Sep 17 00:00:00 2001 From: zichguan-amd Date: Mon, 3 Nov 2025 15:15:50 -0500 Subject: [PATCH] Check hipSPARSELt for supported architectures Signed-off-by: zichguan-amd --- Libraries/hipSPARSELt/CMakeLists.txt | 8 ++++++++ Libraries/hipSPARSELt/spmm/CMakeLists.txt | 8 ++++++++ Libraries/hipSPARSELt/spmm_advanced/CMakeLists.txt | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/Libraries/hipSPARSELt/CMakeLists.txt b/Libraries/hipSPARSELt/CMakeLists.txt index 62242bbe4..f8344c438 100644 --- a/Libraries/hipSPARSELt/CMakeLists.txt +++ b/Libraries/hipSPARSELt/CMakeLists.txt @@ -51,6 +51,14 @@ else() if(NOT hipsparselt_FOUND) message(STATUS "hipSPARSELt could not be found, not building hipSPARSELt examples") else() + hipsparselt_get_supported_architectures(HIPSPARSELT_SUPPORTED_ARCH) + foreach(ARCH ${CMAKE_HIP_ARCHITECTURES}) + if(NOT ARCH IN_LIST HIPSPARSELT_SUPPORTED_ARCH) + message(WARNING "hipSPARSELt does not support architecture: ${ARCH}, not building hipSPARSELt examples") + return() + endif() + endforeach() + add_subdirectory(spmm) add_subdirectory(spmm_advanced) endif() diff --git a/Libraries/hipSPARSELt/spmm/CMakeLists.txt b/Libraries/hipSPARSELt/spmm/CMakeLists.txt index ade3c6274..6e66269ca 100644 --- a/Libraries/hipSPARSELt/spmm/CMakeLists.txt +++ b/Libraries/hipSPARSELt/spmm/CMakeLists.txt @@ -54,6 +54,14 @@ list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}") find_package(hip REQUIRED) find_package(hipsparselt REQUIRED) +hipsparselt_get_supported_architectures(HIPSPARSELT_SUPPORTED_ARCH) +foreach(ARCH ${CMAKE_HIP_ARCHITECTURES}) + if(NOT ARCH IN_LIST HIPSPARSELT_SUPPORTED_ARCH) + message(WARNING "hipSPARSELt does not support architecture: ${ARCH}, not building hipSPARSELt examples") + return() + endif() +endforeach() + add_executable(${example_name} main.cpp) # Make example runnable using CTest add_test(NAME ${example_name} COMMAND ${example_name}) diff --git a/Libraries/hipSPARSELt/spmm_advanced/CMakeLists.txt b/Libraries/hipSPARSELt/spmm_advanced/CMakeLists.txt index 3685fa741..446b5c504 100644 --- a/Libraries/hipSPARSELt/spmm_advanced/CMakeLists.txt +++ b/Libraries/hipSPARSELt/spmm_advanced/CMakeLists.txt @@ -54,6 +54,14 @@ list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}") find_package(hip REQUIRED) find_package(hipsparselt REQUIRED) +hipsparselt_get_supported_architectures(HIPSPARSELT_SUPPORTED_ARCH) +foreach(ARCH ${CMAKE_HIP_ARCHITECTURES}) + if(NOT ARCH IN_LIST HIPSPARSELT_SUPPORTED_ARCH) + message(WARNING "hipSPARSELt does not support architecture: ${ARCH}, not building hipSPARSELt examples") + return() + endif() +endforeach() + add_executable(${example_name} main.cpp) # Make example runnable using CTest add_test(NAME ${example_name} COMMAND ${example_name})