diff --git a/Libraries/hipSPARSELt/CMakeLists.txt b/Libraries/hipSPARSELt/CMakeLists.txt index 1207a4e1b..3c9ccfe85 100644 --- a/Libraries/hipSPARSELt/CMakeLists.txt +++ b/Libraries/hipSPARSELt/CMakeLists.txt @@ -27,16 +27,6 @@ include(CTest) file(RELATIVE_PATH folder_bin ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin}) -# see https://github.com/ROCm/rocm-libraries/blob/40bbc75960836d1b9e0573606df9dd79800e412a/projects/hipsparselt/cmake/hipsparselt_supported_architectures.cmake#L10-L21 -set(HIPSPARSELT_SUPPORTED_ARCH gfx942 gfx950) - -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() - include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") @@ -47,6 +37,12 @@ else() if(NOT hipsparselt_FOUND) message(WARNING "hipSPARSELt could not be found, not building hipSPARSELt examples") else() + include("${CMAKE_CURRENT_LIST_DIR}/../../Common/FilterHIPArchitectures.cmake") + filter_hip_architectures("hipSPARSELt" "gfx942;gfx950" SHOULD_SKIP) + if(SHOULD_SKIP) + return() + endif() + add_subdirectory(spmm) add_subdirectory(spmm_advanced) endif() diff --git a/Libraries/hipSPARSELt/spmm/CMakeLists.txt b/Libraries/hipSPARSELt/spmm/CMakeLists.txt index 41289996d..4a9c99bc8 100644 --- a/Libraries/hipSPARSELt/spmm/CMakeLists.txt +++ b/Libraries/hipSPARSELt/spmm/CMakeLists.txt @@ -35,20 +35,17 @@ select_gpu_language() enable_language(${ROCM_EXAMPLES_GPU_LANGUAGE}) select_hip_platform() -# see https://github.com/ROCm/rocm-libraries/blob/40bbc75960836d1b9e0573606df9dd79800e412a/projects/hipsparselt/cmake/hipsparselt_supported_architectures.cmake#L10-L21 -set(HIPSPARSELT_SUPPORTED_ARCH gfx942 gfx950) - -foreach(ARCH ${CMAKE_HIP_ARCHITECTURES}) - if(NOT ARCH IN_LIST HIPSPARSELT_SUPPORTED_ARCH) - message(FATAL_ERROR "hipSPARSELt does not support architecture: ${ARCH}, not building hipSPARSELt examples") - endif() -endforeach() - include("${CMAKE_CURRENT_LIST_DIR}/../../../Common/ROCmPath.cmake") find_package(hip REQUIRED) find_package(hipsparselt REQUIRED) +include("${CMAKE_CURRENT_LIST_DIR}/../../../Common/FilterHIPArchitectures.cmake") +filter_hip_architectures("hipSPARSELt" "gfx942;gfx950" SHOULD_SKIP) +if(SHOULD_SKIP) + return() +endif() + 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 843904d64..d21646962 100644 --- a/Libraries/hipSPARSELt/spmm_advanced/CMakeLists.txt +++ b/Libraries/hipSPARSELt/spmm_advanced/CMakeLists.txt @@ -35,20 +35,17 @@ select_gpu_language() enable_language(${ROCM_EXAMPLES_GPU_LANGUAGE}) select_hip_platform() -# see https://github.com/ROCm/rocm-libraries/blob/40bbc75960836d1b9e0573606df9dd79800e412a/projects/hipsparselt/cmake/hipsparselt_supported_architectures.cmake#L10-L21 -set(HIPSPARSELT_SUPPORTED_ARCH gfx942 gfx950) - -foreach(ARCH ${CMAKE_HIP_ARCHITECTURES}) - if(NOT ARCH IN_LIST HIPSPARSELT_SUPPORTED_ARCH) - message(FATAL_ERROR "hipSPARSELt does not support architecture: ${ARCH}, not building hipSPARSELt examples") - endif() -endforeach() - include("${CMAKE_CURRENT_LIST_DIR}/../../../Common/ROCmPath.cmake") find_package(hip REQUIRED) find_package(hipsparselt REQUIRED) +include("${CMAKE_CURRENT_LIST_DIR}/../../../Common/FilterHIPArchitectures.cmake") +filter_hip_architectures("hipSPARSELt" "gfx942;gfx950" SHOULD_SKIP) +if(SHOULD_SKIP) + return() +endif() + add_executable(${example_name} main.cpp) # Make example runnable using CTest add_test(NAME ${example_name} COMMAND ${example_name})