Revert "Make directed_test support static libs"

This reverts commit b41a769517.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Ib2d1084ea21461f70f96f95c6025a08f88288357
This commit is contained in:
Tao Sang
2020-10-09 21:13:34 -04:00
committed by Maneesh Gupta
szülő c36c0bad22
commit 5b7533e49f
18 fájl változott, egészen pontosan 270 új sor hozzáadva és 288 régi sor törölve
+5 -9
Fájl megtekintése
@@ -26,7 +26,7 @@ Copy this to a new test name and modify it.
### HIP Integrated Tester (HIT)
The HIT framework automatically finds and adds test cases to the CMAKE testing environment. It achives this by parsing all files in the tests/src folder.
The HIT framework sutomatically finds and adds test cases to the CMAKE testing environment. It achives this by parsing all files in the tests/src folder.
The parser looks for a code block similar to the one below.
```
/* HIT_START
@@ -47,7 +47,7 @@ In the above, BUILD commands provide instructions on how to build the test case
The supported syntax for the BUILD command is:
<<<<<<< HEAD
BUILD: %t %s HIPCC_OPTIONS <hipcc_specific_options> HCC_OPTIONS <hcc_specific_options> CLANG_OPTIONS <clang_specific_options> NVCC_OPTIONS <nvcc_specific_options> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang> EXCLUDE_HIP_LIB_TYPE <static|shared> DEPENDS <dependencies>
BUILD: %t %s HIPCC_OPTIONS <hipcc_specific_options> HCC_OPTIONS <hcc_specific_options> CLANG_OPTIONS <clang_specific_options> NVCC_OPTIONS <nvcc_specific_options> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang> DEPENDS <dependencies>
```
%s: refers to current source file name. Additional source files needed for the test can be specified by name (including relative path).
%t: refers to target executable named derived by removing the extension from the current source file. Alternatively a target executable name can be specified.
@@ -59,7 +59,6 @@ EXCLUDE_HIP_PLATFORM: This can be used to exclude a test case from HCC, NVCC or
EXCLUDE_HIP_RUNTIME: This can be used to exclude a test case from HCC or ROCclr runtime.
EXCLUDE_HIP_COMPILER: This can be used to exclude a test case from hcc or clang compiler.
EXCLUDE_HIP_RUNTIME AND EXCLUDE_HIP_COMPILER: when both options are specified it excludes test case from particular runtime and compiler.
EXCLUDE_HIP_LIB_TYPE: This can be used to exclude a test case from static or shared libs.
DEPENDS: This can be used to specify dependencies that need to be built before building the current target.
@@ -67,7 +66,7 @@ DEPENDS: This can be used to specify dependencies that need to be built before b
The supported syntax for the BUILD_CMD command is:
```
BUILD_CMD: <targetname> <build_command> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang> EXCLUDE_HIP_LIB_TYPE <static|shared> DEPENDS <dependencies>
BUILD_CMD: <targetname> <build_command> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang> DEPENDS <dependencies>
```
%s: refers to current source file name. Additional source files needed for the test can be specified by name (including relative path).
%t: refers to target executable named derived by removing the extension from the current source file. Alternatively a target executable name can be specified.
@@ -81,7 +80,6 @@ EXCLUDE_HIP_PLATFORM: This can be used to exclude a test case from HCC, NVCC or
EXCLUDE_HIP_RUNTIME: This can be used to exclude a test case from HCC or ROCclr runtime.
EXCLUDE_HIP_COMPILER: This can be used to exclude a test case from hcc or clang compiler.
EXCLUDE_HIP_RUNTIME AND EXCLUDE_HIP_COMPILER: when both options are specified it excludes test from particular runtime and compiler.
EXCLUDE_HIP_LIB_TYPE: This can be used to exclude a test case from static or shared libs.
DEPENDS: This can be used to specify dependencies that need to be built before building the current target.
@@ -89,22 +87,20 @@ DEPENDS: This can be used to specify dependencies that need to be built before b
The supported syntax for the TEST command is:
```
TEST: %t <arguments_to_test_executable> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang> EXCLUDE_HIP_LIB_TYPE <static|shared>
TEST: %t <arguments_to_test_executable> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang>
```
%t: refers to target executable named derived by removing the extension from the current source file. Alternatively a target executable name can be specified.
EXCLUDE_HIP_PLATFORM: This can be used to exclude a test case from HCC, NVCC or both platforms.
EXCLUDE_HIP_RUNTIME: This can be used to exclude a test case from HCC or ROCclr runtime.
EXCLUDE_HIP_COMPILER: This can be used to exclude a test case from hcc or clang compiler.
EXCLUDE_HIP_RUNTIME AND EXCLUDE_HIP_COMPILER: when both options are specified it excludes test from particular runtime and compiler.
EXCLUDE_HIP_LIB_TYPE: This can be used to exclude a test case from static or shared libs.
Note that if the test has been excluded for a specific platform/runtime/compiler in the BUILD command, it is automatically excluded from the TEST command as well for the sameplatform.
#### TEST_NAMED command
When using the TEST command, HIT will squash and append the arguments specified to the test executable name to generate the CMAKE test name. Sometimes we might want to specify a more descriptive name. The TEST_NAMED command is used for that. The supported syntax for the TEST_NAMED command is:
```
TEST: %t CMAKE_TEST_NAME <arguments_to_test_executable> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang> EXCLUDE_HIP_LIB_TYPE <static|shared>
TEST: %t CMAKE_TEST_NAME <arguments_to_test_executable> EXCLUDE_HIP_PLATFORM <hcc|nvcc|all> EXCLUDE_HIP_RUNTIME <HCC|ROCclr> EXCLUDE_HIP_COMPILER <hcc|clang>
```
+219 -181
Fájl megtekintése
@@ -3,14 +3,10 @@ find_package(HIP REQUIRED)
set(HIP_CTEST_CONFIG_DEFAULT "default")
set(HIP_CTEST_CONFIG_PERFORMANCE "performance")
set(HIP_LIB_TYPE "shared")
if (NOT ${BUILD_SHARED_LIBS})
set(HIP_LIB_TYPE "static")
endif()
message(STATUS "HIP_LIB_TYPE - ${HIP_LIB_TYPE}")
#-------------------------------------------------------------------------------
# Helper macro to parse BUILD instructions
macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _clang_options _nvcc_options _link_options _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type _depends _dir)
macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _clang_options _nvcc_options _link_options _exclude_platforms _exclude_runtime _exclude_compiler _depends _dir)
set(${_target})
set(${_sources})
set(${_hipcc_options})
@@ -21,181 +17,239 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _clang_op
set(${_exclude_platforms})
set(${_exclude_runtime})
set(${_exclude_compiler})
set(${_exclude_lib_type})
set(${_depends})
set(_target_found FALSE)
set(_flag "")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
foreach(arg ${ARGN})
if(NOT _target_found)
set(_target_found TRUE)
set(${_target} ${arg})
elseif("x${arg}" STREQUAL "xHIPCC_OPTIONS"
OR "x${arg}" STREQUAL "xHCC_OPTIONS"
OR "x${arg}" STREQUAL "xCLANG_OPTIONS"
OR "x${arg}" STREQUAL "xNVCC_OPTIONS"
OR "x${arg}" STREQUAL "xLINK_OPTIONS"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE"
OR "x${arg}" STREQUAL "xDEPENDS")
set(_flag ${arg})
elseif("x${_flag}" STREQUAL "xHIPCC_OPTIONS")
list(APPEND ${_hipcc_options} ${arg})
elseif("x${_flag}" STREQUAL "xHCC_OPTIONS")
list(APPEND ${_hcc_options} ${arg})
elseif("x${_flag}" STREQUAL "xCLANG_OPTIONS")
list(APPEND ${_clang_options} ${arg})
elseif("x${_flag}" STREQUAL "xNVCC_OPTIONS")
list(APPEND ${_nvcc_options} ${arg})
elseif("x${_flag}" STREQUAL "xLINK_OPTIONS")
list(APPEND ${_link_options} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
list(APPEND ${_exclude_platforms} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
list(APPEND ${_exclude_runtime} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_COMPILER")
list(APPEND ${_exclude_compiler} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE")
list(APPEND ${_exclude_lib_type} ${arg})
elseif("x${_flag}" STREQUAL "xDEPENDS")
list(APPEND ${_depends} ${arg})
elseif("x${arg}" STREQUAL "xHIPCC_OPTIONS")
set(_hipcc_options_found TRUE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xHCC_OPTIONS")
set(_hipcc_options_found FALSE)
set(_hcc_options_found TRUE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xCLANG_OPTIONS")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found TRUE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xNVCC_OPTIONS")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found TRUE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xLINK_OPTIONS")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found TRUE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found TRUE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found TRUE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found TRUE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xDEPENDS")
set(_hipcc_options_found FALSE)
set(_hcc_options_found FALSE)
set(_clang_options_found FALSE)
set(_nvcc_options_found FALSE)
set(_link_options_found FALSE)
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found TRUE)
else()
list(APPEND ${_sources} "${_dir}/${arg}")
if(_hipcc_options_found)
list(APPEND ${_hipcc_options} ${arg})
elseif(_hcc_options_found)
list(APPEND ${_hcc_options} ${arg})
elseif(_clang_options_found)
list(APPEND ${_clang_options} ${arg})
elseif(_nvcc_options_found)
list(APPEND ${_nvcc_options} ${arg})
elseif(_link_options_found)
list(APPEND ${_link_options} ${arg})
elseif(_exclude_platforms_found)
list(APPEND ${_exclude_platforms} ${arg})
elseif(_exclude_runtime_found)
list(APPEND ${_exclude_runtime} ${arg})
elseif(_exclude_compiler_found)
list(APPEND ${_exclude_compiler} ${arg})
elseif(_depends_found)
list(APPEND ${_depends} ${arg})
else()
list(APPEND ${_sources} "${_dir}/${arg}")
endif()
endif()
endforeach()
endmacro()
# Helper macro to parse CUSTOM BUILD instructions
macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type _depends)
macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _depends)
set(${_target})
set(${_buildcmd})
set(${_buildcmd} " ")
set(${_exclude_platforms})
set(${_exclude_runtime})
set(${_exclude_compiler})
set(${_exclude_lib_type})
set(${_depends})
set(_target_found FALSE)
set(_flag "")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
foreach(arg ${ARGN})
if(NOT _target_found)
set(_target_found TRUE)
set(${_target} ${arg})
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE"
OR "x${arg}" STREQUAL "xDEPENDS")
set(_flag ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
list(APPEND ${_exclude_platforms} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
list(APPEND ${_exclude_runtime} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_COMPILER")
list(APPEND ${_exclude_compiler} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE")
list(APPEND ${_exclude_lib_type} ${arg})
elseif("x${_flag}" STREQUAL "xDEPENDS")
list(APPEND ${_depends} ${arg})
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
set(_exclude_platforms_found TRUE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found TRUE)
set(_exclude_compiler_found FALSE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found TRUE)
set(_depends_found FALSE)
elseif("x${arg}" STREQUAL "xDEPENDS")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
set(_depends_found TRUE)
else()
list(APPEND ${_buildcmd} ${arg}) # always before exclude lists
endif()
endforeach()
endmacro()
# Helper macro to parse command part of CUSTOM BUILD instructions
macro(PARSE_CUSTOMBUILD_COMMAND_PART _compiler _target _target_type _sources _options)
set(${_compiler})
set(${_target})
set(${_target_type} "EXECUTABLE")
set(${_sources})
set(${_options})
set(_compiler_found FALSE)
set(_target_found FALSE)
foreach(arg ${ARGN})
if(NOT _compiler_found)
set(_compiler_found TRUE)
set(${_compiler} ${arg})
elseif("x${arg}" STREQUAL "x-o")
set(_target_found TRUE)
elseif(_target_found)
set(${_target} ${arg})
set(_target_found FALSE)
elseif("x${arg}" STREQUAL "x-c" OR "x${arg}" STREQUAL "x--genco")
set(${_target_type} "OBJECT")
list(APPEND ${_options} ${arg})
elseif("x${arg}" STREQUAL "x-shared")
# Note: Currently all directed_tests are linux based.
set(${_target_type} "SHARED")
list(APPEND ${_options} ${arg})
elseif("x${arg}" MATCHES "^x-I")
# -I
list(APPEND ${_options} ${arg})
elseif("x${arg}" MATCHES "^x.*\.cpp$")
# cpp file
list(APPEND ${_sources} ${arg})
elseif("x${arg}" MATCHES "^x.*\.c$")
# c file
list(APPEND ${_sources} ${arg})
else()
list(APPEND ${_options} ${arg})
if(_exclude_platforms_found)
list(APPEND ${_exclude_platforms} ${arg})
elseif(_exclude_runtime_found)
list(APPEND ${_exclude_runtime} ${arg})
elseif(_exclude_compiler_found)
list(APPEND ${_exclude_compiler} ${arg})
elseif(_depends_found)
list(APPEND ${_depends} ${arg})
else()
list(APPEND ${_buildcmd} ${arg})
endif()
endif()
endforeach()
endmacro()
# Helper macro to parse TEST instructions
macro(PARSE_TEST_COMMAND _target _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type)
macro(PARSE_TEST_COMMAND _target _arguments _exclude_platforms _exclude_runtime _exclude_compiler)
set(${_target})
set(${_arguments} " ")
set(${_exclude_platforms})
set(${_exclude_runtime})
set(${_exclude_compiler})
set(${_exclude_lib_type})
set(_target_found FALSE)
set(_flag "")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
foreach(arg ${ARGN})
if(NOT _target_found)
set(_target_found TRUE)
set(${_target} ${arg})
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE")
set(_flag ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
list(APPEND ${_exclude_platforms} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
list(APPEND ${_exclude_runtime} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_COMPILER")
list(APPEND ${_exclude_compiler} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE")
list(APPEND ${_exclude_lib_type} ${arg})
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
set(_exclude_platforms_found TRUE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found TRUE)
set(_exclude_compiler_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found TRUE)
else()
list(APPEND ${_arguments} ${arg}) # always before exclude lists
if(_exclude_platforms_found)
list(APPEND ${_exclude_platforms} ${arg})
elseif(_exclude_runtime_found)
list(APPEND ${_exclude_runtime} ${arg})
elseif(_exclude_compiler_found)
list(APPEND ${_exclude_compiler} ${arg})
else()
list(APPEND ${_arguments} ${arg})
endif()
endif()
endforeach()
endmacro()
# Helper macro to parse TEST_NAMED instructions
macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type)
macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler)
set(${_target})
set(${_arguments} " ")
set(${_exclude_platforms})
set(${_exclude_runtime})
set(${_exclude_compiler})
set(${_exclude_lib_type})
set(_target_found FALSE)
set(_testname_found FALSE)
set(_flag "")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
foreach(arg ${ARGN})
if(NOT _target_found)
set(_target_found TRUE)
@@ -203,21 +257,28 @@ macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms _
elseif(NOT _testname_found)
set(_testname_found TRUE)
set(${_testname} ${arg})
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER"
OR "x${arg}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE")
set(_flag ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
list(APPEND ${_exclude_platforms} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
list(APPEND ${_exclude_runtime} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_COMPILER")
list(APPEND ${_exclude_compiler} ${arg})
elseif("x${_flag}" STREQUAL "xEXCLUDE_HIP_LIB_TYPE")
list(APPEND ${_exclude_lib_type} ${arg})
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_PLATFORM")
set(_exclude_platforms_found TRUE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_RUNTIME")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found TRUE)
set(_exclude_compiler_found FALSE)
elseif("x${arg}" STREQUAL "xEXCLUDE_HIP_COMPILER")
set(_exclude_platforms_found FALSE)
set(_exclude_runtime_found FALSE)
set(_exclude_compiler_found TRUE)
else()
list(APPEND ${_arguments} ${arg}) # always before exclude lists
if(_exclude_platforms_found)
list(APPEND ${_exclude_platforms} ${arg})
elseif(_exclude_runtime_found)
list(APPEND ${_exclude_runtime} ${arg})
elseif(_exclude_compiler_found)
list(APPEND ${_exclude_compiler} ${arg})
else()
list(APPEND ${_arguments} ${arg})
endif()
endif()
endforeach()
endmacro()
@@ -268,7 +329,7 @@ macro(HIT_ADD_FILES _config _dir _label _parent)
string(REGEX REPLACE "\n" ";" _contents "${_contents}")
foreach(_cmd ${_contents})
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
parse_build_command(_target _sources _hipcc_options _hcc_options _clang_options _nvcc_options _link_options _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type _depends ${_dir} ${_cmd})
parse_build_command(_target _sources _hipcc_options _hcc_options _clang_options _nvcc_options _link_options _exclude_platforms _exclude_runtime _exclude_compiler _depends ${_dir} ${_cmd})
string(REGEX REPLACE "/" "." target ${_label}/${_target})
if("all" IN_LIST _exclude_platforms OR ${HIP_PLATFORM} IN_LIST _exclude_platforms)
insert_into_map("_exclude" "${target}" TRUE)
@@ -276,9 +337,7 @@ macro(HIT_ADD_FILES _config _dir _label _parent)
insert_into_map("_exclude" "${target}" TRUE)
elseif(NOT _exclude_compiler AND ${HIP_RUNTIME} IN_LIST _exclude_runtime)
insert_into_map("_exclude" "${target}" TRUE)
elseif(${HIP_RUNTIME} IN_LIST _exclude_runtime AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
insert_into_map("_exclude" "${target}" TRUE)
elseif(${HIP_LIB_TYPE} IN_LIST _exclude_lib_type)
elseif(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
insert_into_map("_exclude" "${target}" TRUE)
else()
set_source_files_properties(${_sources} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
@@ -309,7 +368,7 @@ macro(HIT_ADD_FILES _config _dir _label _parent)
string(REGEX REPLACE "%T" ${_label} _contents "${_contents}")
foreach(_cmd ${_contents})
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
parse_custombuild_command(_target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type _depends ${_cmd})
parse_custombuild_command(_target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _depends ${_cmd})
string(REGEX REPLACE "/" "." target ${_label}/${_target})
if("all" IN_LIST _exclude_platforms OR ${HIP_PLATFORM} IN_LIST _exclude_platforms)
insert_into_map("_exclude" "${target}" TRUE)
@@ -317,33 +376,14 @@ macro(HIT_ADD_FILES _config _dir _label _parent)
insert_into_map("_exclude" "${target}" TRUE)
elseif(NOT _exclude_compiler AND ${HIP_RUNTIME} IN_LIST _exclude_runtime)
insert_into_map("_exclude" "${target}" TRUE)
elseif(${HIP_RUNTIME} IN_LIST _exclude_runtime AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
insert_into_map("_exclude" "${target}" TRUE)
elseif(${HIP_LIB_TYPE} IN_LIST _exclude_lib_type)
elseif(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
insert_into_map("_exclude" "${target}" TRUE)
else()
parse_custombuild_command_part(_compiler _target_r _target_type _sources _options ${_buildcmd})
string(REGEX REPLACE ";" " " _buildcmd "${_buildcmd}")
string(REGEX REPLACE ";" " " _options "${_options}")
set(CHOICE_FLAG "${HIP_LIB_TYPE}" STREQUAL "static" AND "${_compiler}" MATCHES "hipcc$"
AND "${HIP_RUNTIME}" STREQUAL "ROCclr" AND "${HIP_COMPILER}" STREQUAL "clang")
if (${CHOICE_FLAG} AND "${_target_type}" STREQUAL "EXECUTABLE")
# message(STATUS "hip_add_executable*:_target_r= ${_target_r} --- target= ${target} --- _sources=${_sources} --- _options=${_options}")
set_source_files_properties(${_sources} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
hip_reset_flags()
hip_add_executable(${target} ${_sources} HIPCC_OPTIONS ${_options} EXCLUDE_FROM_ALL)
set_target_properties(${target} PROPERTIES OUTPUT_NAME ${_target_r} RUNTIME_OUTPUT_DIRECTORY "." LINK_DEPENDS "${HIP_LIB_FILES}")
elseif(${CHOICE_FLAG} AND "${_target_type}" STREQUAL "SHARED")
# message(STATUS "hip_add_library*:_target_r= ${_target_r} --- target= ${target} --- _sources=${_sources} --- _options=${_options}")
set_source_files_properties(${_sources} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
hip_reset_flags()
hip_add_library(${target} ${_sources} HIPCC_OPTIONS ${_options} EXCLUDE_FROM_ALL ${_target_type})
set_target_properties(${target} PROPERTIES OUTPUT_NAME ${_target_r} RUNTIME_OUTPUT_DIRECTORY "." LINK_DEPENDS "${HIP_LIB_FILES}" PREFIX "" SUFFIX "")
else()
# message(STATUS "add_custom_target*: target= ${target} _buildcmd= ${_buildcmd}")
add_custom_target(${target} COMMAND sh -c "${_buildcmd}")
endif()
#string(CONCAT buildscript ${CMAKE_CURRENT_BINARY_DIR}/${target} ".sh")
#file(WRITE ${buildscript} ${_buildcmd})
#add_custom_target(${target} COMMAND ${buildscript})
add_custom_target(${target} COMMAND sh -c "${_buildcmd}")
add_dependencies(${_parent} ${target})
foreach(_dependency ${_depends})
string(REGEX REPLACE "/" "." _dependency ${_label}/${_dependency})
@@ -361,14 +401,13 @@ macro(HIT_ADD_FILES _config _dir _label _parent)
string(REGEX REPLACE "\n" ";" _contents "${_contents}")
foreach(_cmd ${_contents})
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
parse_test_command(_target _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type ${_cmd})
parse_test_command(_target _arguments _exclude_platforms _exclude_runtime _exclude_compiler ${_cmd})
string(REGEX REPLACE "/" "." target ${_label}/${_target})
read_from_map("_exclude" "${target}" _exclude_test_from_build)
if("all" IN_LIST _exclude_platforms OR ${HIP_PLATFORM} IN_LIST _exclude_platforms)
elseif(NOT _exclude_runtime AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
elseif(NOT _exclude_compiler AND ${HIP_RUNTIME} IN_LIST _exclude_runtime)
elseif(${HIP_RUNTIME} IN_LIST _exclude_runtime AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
elseif(${HIP_LIB_TYPE} IN_LIST _exclude_lib_type)
elseif(_exclude_test_from_build STREQUAL TRUE)
else()
make_test(${_config} ${_label}/${_target} ${_arguments})
@@ -384,14 +423,13 @@ macro(HIT_ADD_FILES _config _dir _label _parent)
string(REGEX REPLACE "\n" ";" _contents "${_contents}")
foreach(_cmd ${_contents})
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
parse_test_named_command(_target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type ${_cmd})
parse_test_named_command(_target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler ${_cmd})
string(REGEX REPLACE "/" "." target ${_label}/${_target})
read_from_map("_exclude" "${target}" _exclude_test_from_build)
if("all" IN_LIST _exclude_platforms OR ${HIP_PLATFORM} IN_LIST _exclude_platforms)
elseif(NOT _exclude_runtime AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
elseif(NOT _exclude_compiler AND ${HIP_RUNTIME} IN_LIST _exclude_runtime)
elseif(${HIP_RUNTIME} IN_LIST _exclude_runtime AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
elseif(${HIP_LIB_TYPE} IN_LIST _exclude_lib_type)
elseif(_exclude_test_from_build STREQUAL TRUE)
else()
make_named_test(${_config} ${_label}/${_target} ${_label}/${_testname}.tst ${_arguments})
@@ -21,9 +21,9 @@ THE SOFTWARE.
*/
/* HIT_START
* BUILD_CMD: libfoo_amd %hc %S/%s -o libfoo.so -Xcompiler -fPIC -lpthread -shared -DTEST_SHARED_LIBRARY EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
* BUILD_CMD: libfoo_amd %hc %S/%s -o libfoo.so -Xcompiler -fPIC -lpthread -shared -DTEST_SHARED_LIBRARY EXCLUDE_HIP_PLATFORM nvcc
* BUILD_CMD: libfoo_nvidia %hc %S/%s -o libfoo.so -Xcompiler -fPIC -lpthread -shared -DTEST_SHARED_LIBRARY EXCLUDE_HIP_PLATFORM hcc rocclr
* BUILD_CMD: %t %hc %S/%s -o %T/%t -ldl EXCLUDE_HIP_LIB_TYPE static
* BUILD_CMD: %t %hc %S/%s -o %T/%t -ldl
* TEST: %t
* HIT_END
*/
+2 -2
Fájl megtekintése
@@ -18,8 +18,8 @@
* */
/* HIT_START
* BUILD_CMD: hipMalloc %cxx -D__HIP_PLATFORM_HCC__ -I%hip-path/include -I/opt/rocm/include %S/%s -Wl,--rpath=%hip-path/lib %hip-path/lib/libamdhip64.so -o %T/%t -std=c++11 EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
* TEST: %t EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
* BUILD_CMD: hipMalloc %cxx -D__HIP_PLATFORM_HCC__ -I%hip-path/include -I/opt/rocm/include %S/%s -Wl,--rpath=%hip-path/lib %hip-path/lib/libamdhip64.so -o %T/%t -std=c++11 EXCLUDE_HIP_PLATFORM nvcc
* TEST: %t EXCLUDE_HIP_PLATFORM nvcc
* HIT_END
*/
+2 -2
Fájl megtekintése
@@ -21,8 +21,8 @@
/* HIT_START
* BUILD_CMD: gpu.o %hc -I%hip-path/include -g -c %S/gpu.cpp -o %T/gpu.o EXCLUDE_HIP_PLATFORM nvcc rocclr
* BUILD_CMD: launchkernel.o %hc -D__HIP_PLATFORM_HCC__ -g -I%hip-path/include -c %S/LaunchKernel.c -o %T/launchkernel.o EXCLUDE_HIP_PLATFORM nvcc rocclr
* BUILD_CMD: LaunchKernel %hc %T/launchkernel.o %T/gpu.o -g -Wl,--rpath=%hip-path/lib %hip-path/lib/libamdhip64.so -o %T/%t DEPENDS gpu.o launchkernel.o EXCLUDE_HIP_PLATFORM nvcc rocclr EXCLUDE_HIP_LIB_TYPE static
* TEST: %t EXCLUDE_HIP_PLATFORM nvcc rocclr EXCLUDE_HIP_LIB_TYPE static
* BUILD_CMD: LaunchKernel %hc %T/launchkernel.o %T/gpu.o -g -Wl,--rpath=%hip-path/lib %hip-path/lib/libamdhip64.so -o %T/%t DEPENDS gpu.o launchkernel.o EXCLUDE_HIP_PLATFORM nvcc rocclr
* TEST: %t EXCLUDE_HIP_PLATFORM nvcc rocclr
* HIT_END
*/
+2 -2
Fájl megtekintése
@@ -19,9 +19,9 @@
/* HIT_START
* BUILD_CMD: hipMalloc %cc -D__HIP_PLATFORM_NVCC__ -I%hip-path/include -I/usr/local/cuda/include %S/%s -o %T/hipMalloc_nv -L/usr/local/cuda/lib64 -lcudart EXCLUDE_HIP_PLATFORM hcc rocclr
* BUILD_CMD: hipMalloc %cc -D__HIP_PLATFORM_HCC__ -I%hip-path/include %S/%s -Wl,--rpath=%hip-path/lib %hip-path/lib/libamdhip64.so -o %T/hipMalloc_hcc EXCLUDE_HIP_PLATFORM nvcc rocclr EXCLUDE_HIP_LIB_TYPE static
* BUILD_CMD: hipMalloc %cc -D__HIP_PLATFORM_HCC__ -I%hip-path/include %S/%s -Wl,--rpath=%hip-path/lib %hip-path/lib/libamdhip64.so -o %T/hipMalloc_hcc EXCLUDE_HIP_PLATFORM nvcc rocclr
* TEST: hipMalloc_nv EXCLUDE_HIP_PLATFORM hcc rocclr
* TEST: hipMalloc_hcc EXCLUDE_HIP_PLATFORM nvcc rocclr EXCLUDE_HIP_LIB_TYPE static
* TEST: hipMalloc_hcc EXCLUDE_HIP_PLATFORM nvcc rocclr
* HIT_END
*/
@@ -24,7 +24,7 @@
//
/* HIT_START
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc
* TEST: %t
* HIT_END
*/
@@ -23,7 +23,7 @@
*/
/* HIT_START
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc
* TEST: %t
* HIT_END
*/
@@ -22,7 +22,7 @@
*/
/* HIT_START
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc
* TEST: %t
* HIT_END
*/