From 5725d45c5a1b8903a4e3f3b7ecee4e5a30b85cd4 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Thu, 21 Apr 2022 14:34:17 +0530 Subject: [PATCH] SWDEV-327563 - Windows: enable deviceLib catch tests (#2642) Change-Id: I10094c31d0f51c311618ecdc193e7411316d00ef [ROCm/hip commit: 117ec319aee1956435cf578f585849e199ee9cd1] --- projects/hip/tests/catch/CMakeLists.txt | 14 ++++++++++++++ projects/hip/tests/catch/unit/CMakeLists.txt | 3 ++- .../hip/tests/catch/unit/deviceLib/CMakeLists.txt | 11 +++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/projects/hip/tests/catch/CMakeLists.txt b/projects/hip/tests/catch/CMakeLists.txt index f1f54e545b..40a61fd6f7 100644 --- a/projects/hip/tests/catch/CMakeLists.txt +++ b/projects/hip/tests/catch/CMakeLists.txt @@ -30,6 +30,20 @@ if(NOT DEFINED HIP_PATH) endif() message(STATUS "HIP Path: ${HIP_PATH}") +# Set ROCM Path +if(NOT DEFINED ROCM_PATH) + if(DEFINED ENV{ROCM_PATH}) + set(ROCM_PATH $ENV{ROCM_PATH} CACHE STRING "ROCM Path") + else() + cmake_path(GET HIP_PATH PARENT_PATH ROCM_PATH) + if (NOT EXISTS "${ROCM_PATH}/bin/rocm_agent_enumerator") + set(ROCM_PATH "/opt/rocm/") + endif() + endif() +endif() +message(STATUS "ROCM Path: ${ROCM_PATH}") + + if(UNIX) set(CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc") set(CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc") diff --git a/projects/hip/tests/catch/unit/CMakeLists.txt b/projects/hip/tests/catch/unit/CMakeLists.txt index 60a2941124..7dd03f79a9 100644 --- a/projects/hip/tests/catch/unit/CMakeLists.txt +++ b/projects/hip/tests/catch/unit/CMakeLists.txt @@ -21,8 +21,9 @@ # build fails in windows if (UNIX) add_subdirectory(rtc) - add_subdirectory(deviceLib) endif() + +add_subdirectory(deviceLib) add_subdirectory(graph) add_subdirectory(memory) add_subdirectory(stream) diff --git a/projects/hip/tests/catch/unit/deviceLib/CMakeLists.txt b/projects/hip/tests/catch/unit/deviceLib/CMakeLists.txt index df74a6dbb5..84be08bc33 100644 --- a/projects/hip/tests/catch/unit/deviceLib/CMakeLists.txt +++ b/projects/hip/tests/catch/unit/deviceLib/CMakeLists.txt @@ -50,7 +50,13 @@ set(AMD_ARCH_SPEC_TEST_SRC ) if(HIP_PLATFORM MATCHES "amd") - string(FIND ${OFFLOAD_ARCH_STR} "gfx90a" ARCH_CHECK) + if (DEFINED OFFLOAD_ARCH_STR) + string(FIND ${OFFLOAD_ARCH_STR} "gfx90a" ARCH_CHECK) + elseif(DEFINED $ENV{HCC_AMDGPU_TARGET}) + string(FIND $ENV{HCC_AMDGPU_TARGET} "gfx90a" ARCH_CHECK) + else() + set(ARCH_CHECK -1) + endif() set(TEST_SRC ${TEST_SRC} ${AMD_TEST_SRC}) set_source_files_properties(floatTM.cc PROPERTIES COMPILE_FLAGS -std=c++17) if(${ARCH_CHECK} GREATER_EQUAL 0) @@ -70,7 +76,8 @@ if(${ARCH_CHECK} GREATER_EQUAL 0) endif() hip_add_exe_to_target(NAME UnitDeviceTests TEST_SRC ${TEST_SRC} - TEST_TARGET_NAME build_tests) + TEST_TARGET_NAME build_tests + LINKER_LIBS hiprtc) elseif(HIP_PLATFORM MATCHES "nvidia") hip_add_exe_to_target(NAME UnitDeviceTests TEST_SRC ${TEST_SRC}