From 2b8c3d01effe9d70985f78637e734a00dbc91bda Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 11 Mar 2022 09:58:52 +0530 Subject: [PATCH] SWDEV-325491 - hip build when rocm_agent_enumerator returns no devices (#2535) Change-Id: I2fe58d1eaba82a3dab2472bd37a8ab26d105ac1c [ROCm/hip-tests commit: ef83ae6fd0a994bb56fce84d7c4ea0d4f50d8203] --- projects/hip-tests/catch/CMakeLists.txt | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/projects/hip-tests/catch/CMakeLists.txt b/projects/hip-tests/catch/CMakeLists.txt index e8abe8f038..0bc5231260 100644 --- a/projects/hip-tests/catch/CMakeLists.txt +++ b/projects/hip-tests/catch/CMakeLists.txt @@ -109,16 +109,19 @@ if(NOT DEFINED OFFLOAD_ARCH_STR AND EXISTS "${ROCM_PATH}/bin/rocm_agent_enumerat RESULT_VARIABLE ROCM_AGENT_ENUM_RESULT) # Trim out gfx000 string(REPLACE "gfx000\n" "" HIP_GPU_ARCH ${HIP_GPU_ARCH}) - string(LENGTH ${HIP_GPU_ARCH} HIP_GPU_ARCH_LEN) - - # If string has more gfx target except gfx000 - if(${HIP_GPU_ARCH_LEN} GREATER_EQUAL 1) - string(REGEX REPLACE "\n" ";" HIP_GPU_ARCH_LIST "${HIP_GPU_ARCH}") - set(OFFLOAD_ARCH_STR "") - foreach(_hip_gpu_arch ${HIP_GPU_ARCH_LIST}) - set(OFFLOAD_ARCH_STR " ${OFFLOAD_ARCH_STR} --offload-arch=${_hip_gpu_arch} ") - endforeach() - message(STATUS "Using offload arch string: ${OFFLOAD_ARCH_STR}") + if (NOT HIP_GPU_ARCH STREQUAL "") + string(LENGTH ${HIP_GPU_ARCH} HIP_GPU_ARCH_LEN) + # If string has more gfx target except gfx000 + if(${HIP_GPU_ARCH_LEN} GREATER_EQUAL 1) + string(REGEX REPLACE "\n" ";" HIP_GPU_ARCH_LIST "${HIP_GPU_ARCH}") + set(OFFLOAD_ARCH_STR "") + foreach(_hip_gpu_arch ${HIP_GPU_ARCH_LIST}) + set(OFFLOAD_ARCH_STR " ${OFFLOAD_ARCH_STR} --offload-arch=${_hip_gpu_arch} ") + endforeach() + message(STATUS "Using offload arch string: ${OFFLOAD_ARCH_STR}") + endif() + else() + message(STATUS "ROCm Agent Enumurator found no valid architectures") endif() endif()