diff --git a/projects/hip-tests/catch/cmake/hip-tests.cmake b/projects/hip-tests/catch/cmake/hip-tests.cmake index 23fd7528db..bee293da57 100644 --- a/projects/hip-tests/catch/cmake/hip-tests.cmake +++ b/projects/hip-tests/catch/cmake/hip-tests.cmake @@ -14,14 +14,55 @@ function(hip_add_exe_to_target) "${args}" "${list_args}" ) + hip_gen_exe_target( + NAME ${_NAME} + TEST_TARGET_NAME ${_TEST_TARGET_NAME} + TEST_SRC ${_TEST_SRC} + LINKER_LIBS ${_LINKER_LIBS} + COMMON_SHARED_SRC ${_COMMON_SHARED_SRC} + COMPILE_OPTIONS ${_COMPILE_OPTIONS} + PROPERTY ${_PROPERTY} + STANDALONE_FLAG 0 + ) + # If STANDALONE_TESTS==1, also generate per-file targets + if(STANDALONE_TESTS EQUAL "1") + hip_gen_exe_target( + NAME ${_NAME} + TEST_TARGET_NAME ${_TEST_TARGET_NAME} + TEST_SRC ${_TEST_SRC} + LINKER_LIBS ${_LINKER_LIBS} + COMMON_SHARED_SRC ${_COMMON_SHARED_SRC} + COMPILE_OPTIONS ${_COMPILE_OPTIONS} + PROPERTY ${_PROPERTY} + STANDALONE_FLAG 1 + ) + endif() + +endfunction() + +function(hip_gen_exe_target) + set(options) + set(args NAME TEST_TARGET_NAME PLATFORM COMPILE_OPTIONS STANDALONE_FLAG) + set(list_args TEST_SRC LINKER_LIBS COMMON_SHARED_SRC PROPERTY) + cmake_parse_arguments( + PARSE_ARGV 0 + "" # variable prefix + "${options}" + "${args}" + "${list_args}" + ) foreach(SRC_NAME ${TEST_SRC}) - if(NOT STANDALONE_TESTS EQUAL "1") + if(NOT _STANDALONE_FLAG EQUAL "1") set(_EXE_NAME ${_NAME}) set(SRC_NAME ${TEST_SRC}) else() # strip extension of src and use exe name as src name get_filename_component(_EXE_NAME ${SRC_NAME} NAME_WLE) + if(TARGET ${_EXE_NAME}) + message(WARNING "Duplicate per-file target name detected: ${_EXE_NAME}. Skipping this target!") + continue() + endif() endif() # Create shared lib of all tests @@ -79,9 +120,8 @@ function(hip_add_exe_to_target) file(GLOB CTEST_INC_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME}-*_include.cmake") set_property(GLOBAL APPEND PROPERTY G_INSTALL_CTEST_INCLUDE_FILES ${CTEST_INC_FILES}) - if(NOT STANDALONE_TESTS EQUAL "1") + if(NOT _STANDALONE_FLAG EQUAL "1") break() endif() endforeach() -endfunction() - +endfunction() \ No newline at end of file diff --git a/projects/hip-tests/catch/hipTestMain/standalone_main.cc b/projects/hip-tests/catch/hipTestMain/standalone_main.cc deleted file mode 100644 index 90248bc63e..0000000000 --- a/projects/hip-tests/catch/hipTestMain/standalone_main.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#define CATCH_CONFIG_MAIN -#include -#include - -CmdOptions cmd_options; diff --git a/projects/hip-tests/catch/unit/compiler/CMakeLists.txt b/projects/hip-tests/catch/unit/compiler/CMakeLists.txt index 818f987913..5dbf9a6fc0 100644 --- a/projects/hip-tests/catch/unit/compiler/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/compiler/CMakeLists.txt @@ -18,7 +18,7 @@ if(HIP_PLATFORM MATCHES "amd") TEST_SRC ${TEST_SRC} TEST_TARGET_NAME build_tests) - set(OFFLOAD_ARCH_GENERIC_STR + set(OFFLOAD_ARCH_GENERIC_STR --offload-arch=gfx9-generic --offload-arch=gfx9-4-generic:sramecc+:xnack- --offload-arch=gfx9-4-generic:sramecc-:xnack- @@ -76,11 +76,11 @@ if(HIP_PLATFORM MATCHES "amd") set(TEST_SRC hipSquareGenericTarget.cc ) - hip_add_exe_to_target(NAME hipSquareGenericTarget + hip_add_exe_to_target(NAME hipSquareGenericTargetDefault TEST_SRC ${TEST_SRC} TEST_TARGET_NAME build_tests) - set_target_properties(hipSquareGenericTarget PROPERTIES COMPILE_FLAGS "-mcode-object-version=6 ${DISABLE_GENERIC_TARGET_ONLY}") - target_compile_options(hipSquareGenericTarget PUBLIC ${OFFLOAD_ARCH_GENERIC_STR}) + set_target_properties(hipSquareGenericTargetDefault PROPERTIES COMPILE_FLAGS "-mcode-object-version=6 ${DISABLE_GENERIC_TARGET_ONLY}") + target_compile_options(hipSquareGenericTargetDefault PUBLIC ${OFFLOAD_ARCH_GENERIC_STR}) hip_add_exe_to_target(NAME hipSquareGenericTargetCompressed TEST_SRC ${TEST_SRC} @@ -88,10 +88,10 @@ if(HIP_PLATFORM MATCHES "amd") set_target_properties(hipSquareGenericTargetCompressed PROPERTIES COMPILE_FLAGS " -DGENERIC_COMPRESSED ${DISABLE_GENERIC_TARGET_ONLY} -mcode-object-version=6 --offload-compress") target_compile_options(hipSquareGenericTargetCompressed PUBLIC ${OFFLOAD_ARCH_GENERIC_STR}) - add_dependencies(hipSquareGenericTarget hipSquareGenericTargetCompressed) + add_dependencies(hipSquareGenericTargetDefault hipSquareGenericTargetCompressed) if(BUILD_SHARED_LIBS) - add_dependencies(hipSquareGenericTarget hipSquareGenericTargetOnly) - add_dependencies(hipSquareGenericTarget hipSquareGenericTargetOnlyCompressed) + add_dependencies(hipSquareGenericTargetDefault hipSquareGenericTargetOnly) + add_dependencies(hipSquareGenericTargetDefault hipSquareGenericTargetOnlyCompressed) endif() # SWDEV-548807 skip building hipSpirvTest diff --git a/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt b/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt index a4ed4eb5fe..fe079b22ee 100644 --- a/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt @@ -66,7 +66,7 @@ endif() # AMD only tests set(AMD_TEST_SRC - unsafeAtomicAdd.cc + unsafeAtomicAddDevice.cc mbcnt.cc bitExtract.cc bitInsert.cc diff --git a/projects/hip-tests/catch/unit/deviceLib/unsafeAtomicAdd.cc b/projects/hip-tests/catch/unit/deviceLib/unsafeAtomicAddDevice.cc similarity index 100% rename from projects/hip-tests/catch/unit/deviceLib/unsafeAtomicAdd.cc rename to projects/hip-tests/catch/unit/deviceLib/unsafeAtomicAddDevice.cc diff --git a/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt b/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt index 065920fc0a..7f6187c07d 100644 --- a/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt @@ -32,7 +32,7 @@ hip_add_exe_to_target(NAME dynamicLoading TEST_TARGET_NAME build_tests) if(HIP_PLATFORM MATCHES "amd") - add_custom_target(libLazyLoad.so COMMAND ${CMAKE_HIP_COMPILER} -fPIC -lpthread -shared + add_custom_target(libLazyLoad.so COMMAND ${CMAKE_HIP_COMPILER} -fPIC -lpthread -shared ${OFFLOAD_ARCH_LIST} -x hip ${CMAKE_CURRENT_SOURCE_DIR}/liblazyLoad.cc -I${CMAKE_CURRENT_SOURCE_DIR}/../../include ${HIP_PATH_OPT} -I${Catch2_SOURCE_DIR}/src -I${Catch2_BINARY_DIR}/generated-includes diff --git a/projects/hip-tests/catch/unit/executionControl/CMakeLists.txt b/projects/hip-tests/catch/unit/executionControl/CMakeLists.txt index b8e063a4da..242fbae333 100644 --- a/projects/hip-tests/catch/unit/executionControl/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/executionControl/CMakeLists.txt @@ -1,6 +1,6 @@ set(TEST_SRC execution_control_common.cc - hipFuncGetAttributes.cc + hipFuncGetAttributesBasic.cc hipLaunchKernel.cc hipLaunchCooperativeKernel.cc hipLaunchCooperativeKernelMultiDevice.cc diff --git a/projects/hip-tests/catch/unit/executionControl/hipFuncGetAttributes.cc b/projects/hip-tests/catch/unit/executionControl/hipFuncGetAttributesBasic.cc similarity index 100% rename from projects/hip-tests/catch/unit/executionControl/hipFuncGetAttributes.cc rename to projects/hip-tests/catch/unit/executionControl/hipFuncGetAttributesBasic.cc diff --git a/projects/hip-tests/catch/unit/graph/CMakeLists.txt b/projects/hip-tests/catch/unit/graph/CMakeLists.txt index fbaed8017e..c2c95f8c8a 100644 --- a/projects/hip-tests/catch/unit/graph/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/graph/CMakeLists.txt @@ -139,7 +139,7 @@ set(TEST_SRC hipGraphDestroy.cc hipStreamUpdateCaptureDependencies.cc hipThreadExchangeStreamCaptureMode.cc - hipLaunchHostFunc.cc + hipLaunchHostFuncWithGraph.cc hipStreamGetCaptureInfo_v2_old.cc hipUserObjectCreate.cc hipUserObjectRelease.cc diff --git a/projects/hip-tests/catch/unit/graph/hipLaunchHostFunc.cc b/projects/hip-tests/catch/unit/graph/hipLaunchHostFuncWithGraph.cc similarity index 100% rename from projects/hip-tests/catch/unit/graph/hipLaunchHostFunc.cc rename to projects/hip-tests/catch/unit/graph/hipLaunchHostFuncWithGraph.cc diff --git a/projects/hip-tests/catch/unit/kernel/CMakeLists.txt b/projects/hip-tests/catch/unit/kernel/CMakeLists.txt index ca11dd9358..5e3fc2f559 100644 --- a/projects/hip-tests/catch/unit/kernel/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/kernel/CMakeLists.txt @@ -32,7 +32,7 @@ set(TEST_SRC hipTestConstant.cc hipTestGlobalVariable.cc hipTestMemKernel.cc - launch_bounds.cc + hipLaunchBoundsBasic.cc hipAutoThreadIdx.cc hipLaunchKernelEx.cc ) @@ -44,7 +44,7 @@ endif() # only for AMD if(HIP_PLATFORM MATCHES "amd") set(AMD_SRC - hipExtLaunchKernelGGL.cc + hipExtLaunchKernelGGLBasic.cc hipSetupArgument.cc hipConfigureCall.cc ) diff --git a/projects/hip-tests/catch/unit/kernel/hipExtLaunchKernelGGL.cc b/projects/hip-tests/catch/unit/kernel/hipExtLaunchKernelGGLBasic.cc similarity index 100% rename from projects/hip-tests/catch/unit/kernel/hipExtLaunchKernelGGL.cc rename to projects/hip-tests/catch/unit/kernel/hipExtLaunchKernelGGLBasic.cc diff --git a/projects/hip-tests/catch/unit/kernel/launch_bounds.cc b/projects/hip-tests/catch/unit/kernel/hipLaunchBoundsBasic.cc similarity index 100% rename from projects/hip-tests/catch/unit/kernel/launch_bounds.cc rename to projects/hip-tests/catch/unit/kernel/hipLaunchBoundsBasic.cc diff --git a/projects/hip-tests/catch/unit/memory/CMakeLists.txt b/projects/hip-tests/catch/unit/memory/CMakeLists.txt index ccfa0c9a16..7ae8eb635f 100644 --- a/projects/hip-tests/catch/unit/memory/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/memory/CMakeLists.txt @@ -27,8 +27,8 @@ set(COMMON_SHARED_SRC DriverContext.cc) # But this exposes several problems with hipcc and build system on windows. # While those are fixed, this hack should allow us to pass windows CI. set(TEST_SRC - memset.cc malloc.cc + hipMemsetBasic.cc hipMemcpy2DToArray.cc hipMemcpy2DToArray_old.cc hipMemcpy2DToArrayAsync.cc diff --git a/projects/hip-tests/catch/unit/memory/memset.cc b/projects/hip-tests/catch/unit/memory/hipMemsetBasic.cc similarity index 100% rename from projects/hip-tests/catch/unit/memory/memset.cc rename to projects/hip-tests/catch/unit/memory/hipMemsetBasic.cc diff --git a/projects/hip-tests/catch/unit/module/CMakeLists.txt b/projects/hip-tests/catch/unit/module/CMakeLists.txt index 7426f73481..94f1334064 100644 --- a/projects/hip-tests/catch/unit/module/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/module/CMakeLists.txt @@ -349,13 +349,13 @@ set(TEST_SRC hipFuncSetAttribute.cc hipFuncGetAttributes.cc hipFuncSetSharedMemConfig.cc - hipManagedKeyword.cc + hipManagedKeywordBasic.cc hipModule.cc hipModuleLoadMultProcessOnMultGPU.cc ) set(AMD_TEST_SRC hipExtLaunchKernelGGL.cc - hipExtLaunchMultiKernelMultiDevice.cc + hipExtLaunchMultiKernelMultiDevFunctional.cc ) if(HIP_PLATFORM MATCHES "amd") diff --git a/projects/hip-tests/catch/unit/module/hipExtLaunchMultiKernelMultiDevice.cc b/projects/hip-tests/catch/unit/module/hipExtLaunchMultiKernelMultiDevFunctional.cc similarity index 100% rename from projects/hip-tests/catch/unit/module/hipExtLaunchMultiKernelMultiDevice.cc rename to projects/hip-tests/catch/unit/module/hipExtLaunchMultiKernelMultiDevFunctional.cc diff --git a/projects/hip-tests/catch/unit/module/hipManagedKeyword.cc b/projects/hip-tests/catch/unit/module/hipManagedKeywordBasic.cc similarity index 100% rename from projects/hip-tests/catch/unit/module/hipManagedKeyword.cc rename to projects/hip-tests/catch/unit/module/hipManagedKeywordBasic.cc