diff --git a/projects/hip/tests/README.md b/projects/hip/tests/README.md index e8f8116049..62e18c0787 100644 --- a/projects/hip/tests/README.md +++ b/projects/hip/tests/README.md @@ -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: ``` -BUILD: %t %s HIPCC_OPTIONS HCC_OPTIONS NVCC_OPTIONS EXCLUDE_HIP_PLATFORM DEPENDS +BUILD: %t %s HIPCC_OPTIONS HCC_OPTIONS NVCC_OPTIONS EXCLUDE_HIP_PLATFORM EXCLUDE_HIP_RUNTIME EXCLUDE_HIP_COMPILER DEPENDS ``` %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. @@ -55,6 +55,9 @@ HIPCC_OPTIONS: All options specified after this delimiter are passed to hipcc on HCC_OPTIONS: All options specified after this delimiter are passed to hipcc on HCC platform only. NVCC_OPTIONS: All options specified after this delimiter are passed to hipcc on NVCC platform only. 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 VDI 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. DEPENDS: This can be used to specify dependencies that need to be built before building the current target. @@ -62,7 +65,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: EXCLUDE_HIP_PLATFORM DEPENDS +BUILD_CMD: EXCLUDE_HIP_PLATFORM EXCLUDE_HIP_RUNTIME EXCLUDE_HIP_COMPILER DEPENDS ``` %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. @@ -73,6 +76,9 @@ BUILD_CMD: EXCLUDE_HIP_PLATFORM DEPE %S: refers to path to current source file. %T: refers to path to current build target. 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 VDI 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. DEPENDS: This can be used to specify dependencies that need to be built before building the current target. @@ -80,17 +86,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 EXCLUDE_HIP_PLATFORM +TEST: %t EXCLUDE_HIP_PLATFORM EXCLUDE_HIP_RUNTIME EXCLUDE_HIP_COMPILER ``` %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. Note that if the test has been excluded for a specific platform in the BUILD command, it is automatically excluded from the TEST command as well for the same platform. - +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 VDI 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. +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 EXCLUDE_HIP_PLATFORM +TEST: %t CMAKE_TEST_NAME EXCLUDE_HIP_PLATFORM EXCLUDE_HIP_RUNTIME EXCLUDE_HIP_COMPILER ``` diff --git a/projects/hip/tests/hit/HIT.cmake b/projects/hip/tests/hit/HIT.cmake index 3d8607f0f5..828fbe2cc7 100644 --- a/projects/hip/tests/hit/HIT.cmake +++ b/projects/hip/tests/hit/HIT.cmake @@ -3,7 +3,7 @@ find_package(HIP REQUIRED) #------------------------------------------------------------------------------- # Helper macro to parse BUILD instructions -macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_options _link_options _exclude_platforms _depends _dir) +macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_options _link_options _exclude_platforms _exclude_runtime _exclude_compiler _depends _dir) set(${_target}) set(${_sources}) set(${_hipcc_options}) @@ -11,6 +11,8 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt set(${_nvcc_options}) set(${_link_options}) set(${_exclude_platforms}) + set(${_exclude_runtime}) + set(${_exclude_compiler}) set(${_depends}) set(_target_found FALSE) set(_hipcc_options_found FALSE) @@ -18,6 +20,8 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt 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) @@ -29,6 +33,8 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt 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) @@ -36,6 +42,8 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt 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) @@ -43,6 +51,8 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt 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) @@ -50,6 +60,8 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt 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) @@ -57,6 +69,26 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt 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(_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(_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) @@ -64,6 +96,8 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt 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() if(_hipcc_options_found) @@ -76,6 +110,10 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt list(APPEND ${_link_options} ${arg}) elseif(_exclude_platforms_found) set(${_exclude_platforms} ${arg}) + elseif(_exclude_runtime_found) + set(${_exclude_runtime} ${arg}) + elseif(_exclude_compiler_found) + set(${_exclude_compiler} ${arg}) elseif(_depends_found) list(APPEND ${_depends} ${arg}) else() @@ -86,13 +124,15 @@ macro(PARSE_BUILD_COMMAND _target _sources _hipcc_options _hcc_options _nvcc_opt endmacro() # Helper macro to parse CUSTOM BUILD instructions -macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _depends) +macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _depends) set(${_target}) set(${_buildcmd} " ") set(${_exclude_platforms}) set(${_depends}) set(_target_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) @@ -100,13 +140,31 @@ macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _depends) set(${_target} ${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() if(_exclude_platforms_found) set(${_exclude_platforms} ${arg}) + elseif(_exclude_runtime_found) + set(${_exclude_runtime} ${arg}) + elseif(_exclude_compiler_found) + set(${_exclude_compiler} ${arg}) elseif(_depends_found) list(APPEND ${_depends} ${arg}) else() @@ -117,21 +175,39 @@ macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _depends) endmacro() # Helper macro to parse TEST instructions -macro(PARSE_TEST_COMMAND _target _arguments _exclude_platforms) +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(_target_found FALSE) 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") 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() if(_exclude_platforms_found) set(${_exclude_platforms} ${arg}) + elseif(_exclude_runtime_found) + set(${_exclude_runtime} ${arg}) + elseif(_exclude_compiler_found) + set(${_exclude_compiler} ${arg}) else() list(APPEND ${_arguments} ${arg}) endif() @@ -140,13 +216,15 @@ macro(PARSE_TEST_COMMAND _target _arguments _exclude_platforms) endmacro() # Helper macro to parse TEST_NAMED instructions -macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms) +macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler) set(${_target}) set(${_arguments} " ") set(${_exclude_platforms}) set(_target_found FALSE) set(_testname_found FALSE) 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) @@ -156,9 +234,23 @@ macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms) set(${_testname} ${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() if(_exclude_platforms_found) set(${_exclude_platforms} ${arg}) + elseif(_exclude_runtime_found) + set(${_exclude_runtime} ${arg}) + elseif(_exclude_compiler_found) + set(${_exclude_compiler} ${arg}) else() list(APPEND ${_arguments} ${arg}) endif() @@ -203,10 +295,16 @@ macro(HIT_ADD_FILES _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 _nvcc_options _link_options _exclude_platforms _depends ${_dir} ${_cmd}) + parse_build_command(_target _sources _hipcc_options _hcc_options _nvcc_options _link_options _exclude_platforms _exclude_runtime _exclude_compiler _depends ${_dir} ${_cmd}) string(REGEX REPLACE "/" "." target ${_label}/${_target}) - insert_into_map("_exclude" "${target}" "${_exclude_platforms}") if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM}) + insert_into_map("_exclude" "${target}" TRUE) + elseif(NOT _exclude_runtime AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + insert_into_map("_exclude" "${target}" TRUE) + elseif(NOT _exclude_compiler AND _exclude_runtime STREQUAL ${HIP_RUNTIME}) + insert_into_map("_exclude" "${target}" TRUE) + elseif(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + insert_into_map("_exclude" "${target}" TRUE) else() set_source_files_properties(${_sources} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1) hip_reset_flags() @@ -236,10 +334,16 @@ macro(HIT_ADD_FILES _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 _depends ${_cmd}) + parse_custombuild_command(_target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _depends ${_cmd}) string(REGEX REPLACE "/" "." target ${_label}/${_target}) - insert_into_map("_exclude" "${target}" "${_exclude_platforms}") if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM}) + insert_into_map("_exclude" "${target}" TRUE) + elseif(NOT _exclude_runtime AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + insert_into_map("_exclude" "${target}" TRUE) + elseif(NOT _exclude_compiler AND _exclude_runtime STREQUAL ${HIP_RUNTIME}) + insert_into_map("_exclude" "${target}" TRUE) + elseif(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + insert_into_map("_exclude" "${target}" TRUE) else() string(REGEX REPLACE ";" " " _buildcmd "${_buildcmd}") #string(CONCAT buildscript ${CMAKE_CURRENT_BINARY_DIR}/${target} ".sh") @@ -263,11 +367,14 @@ macro(HIT_ADD_FILES _dir _label _parent) string(REGEX REPLACE "\n" ";" _contents "${_contents}") foreach(_cmd ${_contents}) string(REGEX REPLACE " " ";" _cmd "${_cmd}") - parse_test_command(_target _arguments _exclude_platforms ${_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_platforms_from_build) - if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM} OR - _exclude_platforms_from_build STREQUAL "all" OR _exclude_platforms_from_build STREQUAL ${HIP_PLATFORM}) + read_from_map("_exclude" "${target}" _exclude_test_from_build) + if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM}) + elseif(NOT _exclude_runtime AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + elseif(NOT _exclude_compiler AND _exclude_runtime STREQUAL ${HIP_RUNTIME}) + elseif(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + elseif(_exclude_test_from_build STREQUAL TRUE) else() make_test(${_label}/${_target} ${_arguments}) endif() @@ -282,11 +389,14 @@ macro(HIT_ADD_FILES _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 ${_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_platforms_from_build) - if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM} OR - _exclude_platforms_from_build STREQUAL "all" OR _exclude_platforms_from_build STREQUAL ${HIP_PLATFORM}) + read_from_map("_exclude" "${target}" _exclude_test_from_build) + if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM}) + elseif(NOT _exclude_runtime AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + elseif(NOT _exclude_compiler AND _exclude_runtime STREQUAL ${HIP_RUNTIME}) + elseif(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND _exclude_compiler STREQUAL ${HIP_COMPILER}) + elseif(_exclude_test_from_build STREQUAL TRUE) else() make_named_test(${_label}/${_target} ${_label}/${_testname}.tst ${_arguments}) endif()