Make directed_test support static libs
1.Make directed_test apps linked against static libs
of hip, rocclr, rocr, roct and amd_comgr.
2.Remove custom_target amdhip64_static_combiner.
3.Support EXCLUDE_HIP_LIB_TYPE <static|shared>.
4.Simplify argument list parsing.
5.Fix hip_pch.o missing issue in samples' build.
6.Fix some original small bugs.
Change-Id: I30f5e65367613152ce86b80b13e1c9f2a28da803
[ROCm/clr commit: 36c5679efc]
Tento commit je obsažen v:
@@ -11,6 +11,7 @@ set(HIP_HCC_FLAGS "" CACHE STRING "Semicolon delimited flags for HCC")
|
||||
set(HIP_CLANG_FLAGS "" CACHE STRING "Semicolon delimited flags for CLANG")
|
||||
set(HIP_NVCC_FLAGS "" CACHE STRING "Semicolon delimted flags for NVCC")
|
||||
mark_as_advanced(HIP_HIPCC_FLAGS HIP_HCC_FLAGS HIP_CLANG_FLAGS HIP_NVCC_FLAGS)
|
||||
|
||||
set(_hip_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
|
||||
list(REMOVE_DUPLICATES _hip_configuration_types)
|
||||
foreach(config ${_hip_configuration_types})
|
||||
@@ -221,7 +222,7 @@ elseif("${HIP_COMPILER}" STREQUAL "clang")
|
||||
endif()
|
||||
if(HIP_CLANG_NUM_PARALLEL_JOBS GREATER 1)
|
||||
if(${HIP_CLANG_SUPPORTS_PARALLEL_JOBS})
|
||||
set(HIP_CLANG_PARALLEL_BUILD_COMPILE_OPTIONS "-parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS} -Wno-format-nonliteral")
|
||||
set(HIP_CLANG_PARALLEL_BUILD_COMPILE_OPTIONS "-Wno-format-nonliteral -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS}")
|
||||
set(HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS "-parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS}")
|
||||
else()
|
||||
message("clang compiler doesn't support parallel jobs")
|
||||
@@ -232,6 +233,22 @@ elseif("${HIP_COMPILER}" STREQUAL "clang")
|
||||
set(CMAKE_HIP_CREATE_SHARED_LIBRARY "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HIP_CLANG_PATH} ${HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS} <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
set(CMAKE_HIP_CREATE_SHARED_MODULE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HIP_CLANG_PATH} ${HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS} <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <LINK_LIBRARIES> -shared" )
|
||||
set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HIP_CLANG_PATH} ${HIP_CLANG_PARALLEL_BUILD_LINK_OPTIONS} <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
|
||||
if("${HIP_RUNTIME}" STREQUAL "ROCclr")
|
||||
if(TARGET host)
|
||||
message(STATUS "host interface - found")
|
||||
set(HIP_HOST_INTERFACE host)
|
||||
else()
|
||||
# Find hip
|
||||
find_package(hip)
|
||||
if(TARGET hip::host)
|
||||
message(STATUS "hip::host interface - found")
|
||||
set(HIP_HOST_INTERFACE hip::host)
|
||||
else()
|
||||
message(STATUS "hip::host interface - not found")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
@@ -644,6 +661,11 @@ macro(HIP_ADD_EXECUTABLE hip_target)
|
||||
add_executable(${hip_target} ${_cmake_options} ${_generated_files} ${_sources})
|
||||
endif()
|
||||
set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE HIP)
|
||||
# Link with host
|
||||
if (HIP_HOST_INTERFACE)
|
||||
# hip rt should be ROCclr, compiler should be clang
|
||||
target_link_libraries(${hip_target} ${HIP_HOST_INTERFACE})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
@@ -662,6 +684,11 @@ macro(HIP_ADD_LIBRARY hip_target)
|
||||
add_library(${hip_target} ${_cmake_options} ${_generated_files} ${_sources})
|
||||
endif()
|
||||
set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE ${HIP_C_OR_CXX})
|
||||
# Link with host
|
||||
if (HIP_HOST_INTERFACE)
|
||||
# hip rt should be ROCclr, compiler should be clang
|
||||
target_link_libraries(${hip_target} ${HIP_HOST_INTERFACE})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# vim: ts=4:sw=4:expandtab:smartindent
|
||||
|
||||
@@ -101,6 +101,7 @@ include( "${CMAKE_CURRENT_LIST_DIR}/hip-targets.cmake" )
|
||||
# without worrying other transitive dependencies
|
||||
find_dependency(hsa-runtime64)
|
||||
find_dependency(Threads)
|
||||
find_dependency(ROCclr)
|
||||
|
||||
#get_filename_component cannot resolve the symlinks if called from /opt/rocm/lib/hip
|
||||
#and do three level up again
|
||||
|
||||
@@ -38,8 +38,9 @@ set(USE_PROF_API "1")
|
||||
|
||||
find_package(ROCclr REQUIRED CONFIG
|
||||
PATHS
|
||||
/opt/rocm
|
||||
/opt/rocm/rocclr)
|
||||
/opt/rocm/rocclr
|
||||
PATH_SUFFIXES
|
||||
lib/cmake/rocclr)
|
||||
|
||||
#############################
|
||||
# Profiling API support
|
||||
@@ -217,14 +218,14 @@ endif()
|
||||
set_target_properties(amdhip64 PROPERTIES LINK_FLAGS_RELEASE -s)
|
||||
set_target_properties(amdhip64 PROPERTIES PUBLIC_HEADER ${PROF_API_STR})
|
||||
add_library(host INTERFACE)
|
||||
target_link_libraries(host INTERFACE hip::amdhip64)
|
||||
target_link_libraries(host INTERFACE amdhip64)
|
||||
|
||||
add_library(device INTERFACE)
|
||||
target_link_libraries(device INTERFACE host)
|
||||
|
||||
# Short-Term solution for pre-compiled headers for online compilation
|
||||
if(__HIP_ENABLE_PCH)
|
||||
target_link_libraries(amdhip64 PRIVATE ${CMAKE_BINARY_DIR}/hip_pch.o)
|
||||
if(${__HIP_ENABLE_PCH})
|
||||
target_sources(amdhip64 PRIVATE ${CMAKE_BINARY_DIR}/hip_pch.o)
|
||||
endif()
|
||||
|
||||
# TODO: we may create host_static and device_static to let app
|
||||
@@ -232,31 +233,14 @@ endif()
|
||||
|
||||
# FIXME: Linux convention is to create static library with same base
|
||||
# filename.
|
||||
if(${BUILD_SHARED_LIBS})
|
||||
target_link_libraries(amdhip64 PRIVATE amdrocclr_static Threads::Threads dl hsa-runtime64::hsa-runtime64)
|
||||
target_link_libraries(amdhip64 PRIVATE amdrocclr_static Threads::Threads dl hsa-runtime64::hsa-runtime64)
|
||||
|
||||
add_custom_command(TARGET amdhip64 POST_BUILD COMMAND
|
||||
${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/.hipInfo ${PROJECT_BINARY_DIR}/lib/.hipInfo)
|
||||
add_custom_command(TARGET amdhip64 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include)
|
||||
|
||||
INSTALL(PROGRAMS $<TARGET_FILE:amdhip64> DESTINATION lib COMPONENT MAIN)
|
||||
else()
|
||||
target_link_libraries(amdhip64 PRIVATE Threads::Threads dl hsa-runtime64::hsa-runtime64 amd_comgr)
|
||||
# combine objects of vid and hip into amdhip64_static
|
||||
add_custom_target(
|
||||
amdhip64_static_combiner
|
||||
ALL
|
||||
COMMAND rm -rf static_lib_temp && mkdir static_lib_temp && cd static_lib_temp # Create temp folder to contain *.o
|
||||
COMMAND ${CMAKE_AR} -x $<TARGET_FILE:amdrocclr_static> # Extract *.o from amdrocclr_static
|
||||
COMMAND ${CMAKE_AR} -rcs $<TARGET_FILE:amdhip64> *.o # Append *.o to amdhip64_static
|
||||
COMMAND cd .. && rm -rf static_lib_temp # Remove temp folder
|
||||
DEPENDS amdhip64 amdrocclr_static # To make sure this is the last step
|
||||
COMMENT "Combining static libs into amdhip64_static"
|
||||
)
|
||||
INSTALL(PROGRAMS $<TARGET_FILE:amdhip64> DESTINATION lib COMPONENT MAIN)
|
||||
endif()
|
||||
add_custom_command(TARGET amdhip64 POST_BUILD COMMAND
|
||||
${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/.hipInfo ${PROJECT_BINARY_DIR}/lib/.hipInfo)
|
||||
add_custom_command(TARGET amdhip64 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include)
|
||||
|
||||
INSTALL(PROGRAMS $<TARGET_FILE:amdhip64> DESTINATION lib COMPONENT MAIN)
|
||||
|
||||
INSTALL(TARGETS amdhip64 host device EXPORT hip-targets DESTINATION ${LIB_INSTALL_DIR})
|
||||
INSTALL(EXPORT hip-targets DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR} NAMESPACE hip::)
|
||||
|
||||
@@ -2,6 +2,14 @@ project(bit_extract)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
if(NOT DEFINED __HIP_ENABLE_PCH)
|
||||
set(__HIP_ENABLE_PCH ON CACHE BOOL "enable/disable pre-compiled hip headers")
|
||||
endif()
|
||||
|
||||
if(${__HIP_ENABLE_PCH})
|
||||
add_definitions(-D__HIP_ENABLE_PCH)
|
||||
endif()
|
||||
|
||||
# Search for rocm in common locations
|
||||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
|
||||
|
||||
|
||||
@@ -54,6 +54,20 @@ int main(int argc, char* argv[]) {
|
||||
size_t N = 1000000;
|
||||
size_t Nbytes = N * sizeof(uint32_t);
|
||||
|
||||
#ifdef __HIP_ENABLE_PCH
|
||||
// Verify hip_pch.o
|
||||
const char* pch = nullptr;
|
||||
unsigned int size = 0;
|
||||
__hipGetPCH(&pch, &size);
|
||||
printf("pch size: %u\n", size);
|
||||
if (size == 0) {
|
||||
printf("__hipGetPCH failed!\n");
|
||||
return -1;
|
||||
} else {
|
||||
printf("__hipGetPCH succeeded!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
int deviceId;
|
||||
CHECK(hipGetDevice(&deviceId));
|
||||
hipDeviceProp_t props;
|
||||
|
||||
@@ -7,6 +7,9 @@ cmake_minimum_required(VERSION 3.10)
|
||||
# Search for rocm in common locations
|
||||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
|
||||
|
||||
# create square.cpp
|
||||
execute_process(COMMAND sh -c "/opt/rocm/hip/bin/hipify-perl ../square.cu > ../square.cpp")
|
||||
|
||||
# Find hip
|
||||
find_package(hip)
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ if(NOT DEFINED HIP_PATH)
|
||||
endif()
|
||||
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
# Search for rocm in common locations
|
||||
list(APPEND CMAKE_PREFIX_PATH ${HIP_PATH} /opt/rocm)
|
||||
|
||||
project(12_cmake)
|
||||
|
||||
set(HIP_CLANG_NUM_PARALLEL_JOBS 2)
|
||||
|
||||
@@ -37,7 +37,13 @@ Use the following commands to build and execute the sample
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
For shared lib of hip rt,
|
||||
cmake ..
|
||||
Or for static lib of hip rt,
|
||||
cmake -DCMAKE_PREFIX_PATH="/opt/rocm/llvm/lib/cmake" ..
|
||||
|
||||
Then,
|
||||
make
|
||||
./MatrixTranspose
|
||||
```
|
||||
|
||||
@@ -12,16 +12,22 @@ make
|
||||
|
||||
2.CMakeLists.txt can support shared and static libs of hip-rocclr runtime.
|
||||
|
||||
To build a sample, type in sample folder,
|
||||
To build a sample, run in the sample folder,
|
||||
|
||||
mkdir build (if build folder is missing)
|
||||
mkdir -p build && cd build
|
||||
|
||||
cd build
|
||||
rm -rf * (to clear up)
|
||||
|
||||
a. to build with shared libs, run
|
||||
|
||||
cmake ..
|
||||
|
||||
b. to build with static libs, run
|
||||
|
||||
cmake -DCMAKE_PREFIX_PATH="/opt/rocm/llvm/lib/cmake" ..
|
||||
|
||||
Then run,
|
||||
|
||||
make
|
||||
|
||||
If you want debug version, follow,
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
Note that if you want debug version, add "-DCMAKE_BUILD_TYPE=Debug" in cmake cmd.
|
||||
@@ -26,7 +26,7 @@ Copy this to a new test name and modify it.
|
||||
|
||||
### HIP Integrated Tester (HIT)
|
||||
|
||||
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 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 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> 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> EXCLUDE_HIP_LIB_TYPE <static|shared> 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,6 +59,7 @@ 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.
|
||||
|
||||
|
||||
@@ -66,7 +67,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> DEPENDS <dependencies>
|
||||
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>
|
||||
```
|
||||
%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.
|
||||
@@ -80,6 +81,7 @@ 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.
|
||||
|
||||
|
||||
@@ -87,20 +89,22 @@ 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>
|
||||
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>
|
||||
```
|
||||
%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>
|
||||
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>
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -3,10 +3,14 @@ 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 _depends _dir)
|
||||
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)
|
||||
set(${_target})
|
||||
set(${_sources})
|
||||
set(${_hipcc_options})
|
||||
@@ -17,239 +21,181 @@ 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(_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)
|
||||
set(_flag "")
|
||||
|
||||
foreach(arg ${ARGN})
|
||||
if(NOT _target_found)
|
||||
set(_target_found TRUE)
|
||||
set(${_target} ${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)
|
||||
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})
|
||||
else()
|
||||
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()
|
||||
list(APPEND ${_sources} "${_dir}/${arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Helper macro to parse CUSTOM BUILD instructions
|
||||
macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _depends)
|
||||
macro(PARSE_CUSTOMBUILD_COMMAND _target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type _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(_exclude_platforms_found FALSE)
|
||||
set(_exclude_runtime_found FALSE)
|
||||
set(_exclude_compiler_found FALSE)
|
||||
set(_depends_found FALSE)
|
||||
set(_flag "")
|
||||
|
||||
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)
|
||||
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)
|
||||
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})
|
||||
else()
|
||||
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()
|
||||
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})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Helper macro to parse TEST instructions
|
||||
macro(PARSE_TEST_COMMAND _target _arguments _exclude_platforms _exclude_runtime _exclude_compiler)
|
||||
macro(PARSE_TEST_COMMAND _target _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type)
|
||||
set(${_target})
|
||||
set(${_arguments} " ")
|
||||
set(${_exclude_platforms})
|
||||
set(${_exclude_runtime})
|
||||
set(${_exclude_compiler})
|
||||
set(${_exclude_lib_type})
|
||||
|
||||
set(_target_found FALSE)
|
||||
set(_exclude_platforms_found FALSE)
|
||||
set(_exclude_runtime_found FALSE)
|
||||
set(_exclude_compiler_found FALSE)
|
||||
set(_flag "")
|
||||
|
||||
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)
|
||||
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})
|
||||
else()
|
||||
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()
|
||||
list(APPEND ${_arguments} ${arg}) # always before exclude lists
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Helper macro to parse TEST_NAMED instructions
|
||||
macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler)
|
||||
macro(PARSE_TEST_NAMED_COMMAND _target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type)
|
||||
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(_exclude_platforms_found FALSE)
|
||||
set(_exclude_runtime_found FALSE)
|
||||
set(_exclude_compiler_found FALSE)
|
||||
set(_flag "")
|
||||
|
||||
foreach(arg ${ARGN})
|
||||
if(NOT _target_found)
|
||||
set(_target_found TRUE)
|
||||
@@ -257,28 +203,21 @@ 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")
|
||||
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)
|
||||
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})
|
||||
else()
|
||||
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()
|
||||
list(APPEND ${_arguments} ${arg}) # always before exclude lists
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
@@ -329,7 +268,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 _depends ${_dir} ${_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})
|
||||
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)
|
||||
@@ -337,7 +276,9 @@ 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(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
|
||||
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)
|
||||
insert_into_map("_exclude" "${target}" TRUE)
|
||||
else()
|
||||
set_source_files_properties(${_sources} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
||||
@@ -368,7 +309,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 _depends ${_cmd})
|
||||
parse_custombuild_command(_target _buildcmd _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type _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)
|
||||
@@ -376,14 +317,33 @@ 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(_exclude_runtime STREQUAL ${HIP_RUNTIME} AND ${HIP_COMPILER} IN_LIST _exclude_compiler)
|
||||
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)
|
||||
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(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}")
|
||||
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()
|
||||
add_dependencies(${_parent} ${target})
|
||||
foreach(_dependency ${_depends})
|
||||
string(REGEX REPLACE "/" "." _dependency ${_label}/${_dependency})
|
||||
@@ -401,13 +361,14 @@ 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 ${_cmd})
|
||||
parse_test_command(_target _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type ${_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})
|
||||
@@ -423,13 +384,14 @@ 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 ${_cmd})
|
||||
parse_test_named_command(_target _testname _arguments _exclude_platforms _exclude_runtime _exclude_compiler _exclude_lib_type ${_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
|
||||
* 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_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
|
||||
* BUILD_CMD: %t %hc %S/%s -o %T/%t -ldl EXCLUDE_HIP_LIB_TYPE static
|
||||
* TEST: %t
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
* TEST: %t EXCLUDE_HIP_PLATFORM nvcc
|
||||
* 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
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
|
||||
@@ -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
|
||||
* TEST: %t 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
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
|
||||
@@ -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
|
||||
* 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
|
||||
* TEST: hipMalloc_nv EXCLUDE_HIP_PLATFORM hcc rocclr
|
||||
* TEST: hipMalloc_hcc EXCLUDE_HIP_PLATFORM nvcc rocclr
|
||||
* TEST: hipMalloc_hcc EXCLUDE_HIP_PLATFORM nvcc rocclr EXCLUDE_HIP_LIB_TYPE static
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
//
|
||||
|
||||
/* HIT_START
|
||||
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc
|
||||
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
|
||||
* TEST: %t
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/* HIT_START
|
||||
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc
|
||||
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
|
||||
* TEST: %t
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/* HIT_START
|
||||
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc
|
||||
* BUILD: %t %s ../../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc EXCLUDE_HIP_LIB_TYPE static
|
||||
* TEST: %t
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele