diff --git a/bin/hipcc b/bin/hipcc index 552c44dda7..32494dd345 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -22,6 +22,7 @@ # Need perl > 5.10 to use logic-defined or use 5.006; use v5.10.1; +use strict; use warnings; use File::Basename; @@ -34,30 +35,13 @@ my $SCRIPT_DIR=dirname(__FILE__); if ($HIPCC_USE_PERL_SCRIPT) { #Invoke hipcc.pl my $HIPCC_PERL=catfile($SCRIPT_DIR, '/hipcc.pl'); - system("$^X $HIPCC_PERL @ARGV"); + exec($^X, $HIPCC_PERL, @ARGV); } else { - $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys'); - $BIN_NAME="/hipcc.bin"; - if ($isWindows) { - $BIN_NAME="/hipcc.bin.exe"; - } - my $HIPCC_BIN=catfile($SCRIPT_DIR, $BIN_NAME); + #Invoke hipcc.bin + my $HIPCC_BIN=catfile($SCRIPT_DIR, '/hipcc.bin'); if ( -e $HIPCC_BIN ) { - #Invoke hipcc.bin - my $output = qx($HIPCC_BIN @ARGV); - print ("$output\n"); + exec($HIPCC_BIN, @ARGV); } else { print "hipcc.bin not present; Install HIPCC binaries before proceeding"; - exit(-1); } } -if ($? == -1) { - exit($?); -} -elsif ($? & 127) { - exit($?); -} -else { - $CMD_EXIT_CODE = $? >> 8; -} -exit($CMD_EXIT_CODE); diff --git a/bin/hipcc.bat b/bin/hipcc.bat index 7a3c25ba8d..9aa0e9628f 100644 --- a/bin/hipcc.bat +++ b/bin/hipcc.bat @@ -1,2 +1,2 @@ -set HIPCC="%~dp0/hipcc" +@set HIPCC="%~dp0/hipcc" @perl %HIPCC% %* diff --git a/bin/hipconfig b/bin/hipconfig index 8789a52b45..8ed1ba6f10 100755 --- a/bin/hipconfig +++ b/bin/hipconfig @@ -22,6 +22,7 @@ # Need perl > 5.10 to use logic-defined or use 5.006; use v5.10.1; +use strict; use warnings; use File::Basename; @@ -34,30 +35,13 @@ my $SCRIPT_DIR=dirname(__FILE__); if ($HIPCONFIG_USE_PERL_SCRIPT) { #Invoke hipconfig.pl my $HIPCONFIG_PERL=catfile($SCRIPT_DIR, '/hipconfig.pl'); - system("$^X $HIPCONFIG_PERL @ARGV"); + exec($^X, $HIPCONFIG_PERL, @ARGV); } else { - $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys'); - $BIN_NAME="/hipconfig.bin"; - if ($isWindows) { - $BIN_NAME="/hipconfig.bin.exe"; - } - my $HIPCONFIG_BIN=catfile($SCRIPT_DIR, $BIN_NAME); + #Invoke hipconfig.bin + my $HIPCONFIG_BIN=catfile($SCRIPT_DIR, '/hipconfig.bin'); if ( -e $HIPCONFIG_BIN ) { - #Invoke hipconfig.bin - my $output = qx($HIPCONFIG_BIN @ARGV); - print ("$output\n"); + exec($HIPCONFIG_BIN, @ARGV); } else { print "hipconfig.bin not present; Install HIPCC binaries before proceeding"; - exit(-1); } } -if ($? == -1) { - exit($?); -} -elsif ($? & 127) { - exit($?); -} -else { - $CMD_EXIT_CODE = $? >> 8; -} -exit($CMD_EXIT_CODE); diff --git a/bin/hipconfig.bat b/bin/hipconfig.bat index 47d9500c71..d58c634ef8 100644 --- a/bin/hipconfig.bat +++ b/bin/hipconfig.bat @@ -1,2 +1,2 @@ -set HIPCONFIG="%~dp0/hipconfig" +@set HIPCONFIG="%~dp0/hipconfig" @perl %HIPCONFIG% %* diff --git a/tests/catch/CMakeLists.txt b/tests/catch/CMakeLists.txt index 66df886703..f1f54e545b 100644 --- a/tests/catch/CMakeLists.txt +++ b/tests/catch/CMakeLists.txt @@ -6,6 +6,7 @@ set(CMAKE_CXX_COMPILER_WORKS 1) project(hiptests) + # Check if platform and compiler are set if(HIP_PLATFORM STREQUAL "amd") if(HIP_COMPILER STREQUAL "nvcc") @@ -32,14 +33,28 @@ message(STATUS "HIP Path: ${HIP_PATH}") if(UNIX) set(CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc") set(CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc") + set(HIPCONFIG_EXECUTABLE "${HIP_PATH}/bin/hipconfig") + execute_process(COMMAND perl ${HIPCONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE HIP_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) else() # using cmake_path as it handles path correctly. # Set both compilers else windows cmake complains of mismatch cmake_path(SET CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc.bat") cmake_path(SET CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc.bat") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --rocm-path=${ROCM_PATH}") + set(HIPCONFIG_EXECUTABLE "${HIP_PATH}/bin/hipconfig.bat") + execute_process(COMMAND ${HIPCONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE HIP_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) endif() +string(REPLACE "." ";" VERSION_LIST ${HIP_VERSION}) +list(GET VERSION_LIST 0 HIP_VERSION_MAJOR) +list(GET VERSION_LIST 1 HIP_VERSION_MINOR) +list(GET VERSION_LIST 2 HIP_VERSION_PATCH_GITHASH) +string(REPLACE "-" ";" VERSION_LIST ${HIP_VERSION_PATCH_GITHASH}) +list(GET VERSION_LIST 0 HIP_VERSION_PATCH) if(NOT DEFINED CATCH2_PATH) if(DEFINED ENV{CATCH2_PATH}) @@ -83,6 +98,17 @@ file(COPY ./hipTestMain/config DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/hipTestMa file(COPY ./external/Catch2/cmake/Catch2/CatchAddTests.cmake DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/script) set(ADD_SCRIPT_PATH ${CMAKE_CURRENT_BINARY_DIR}/script/CatchAddTests.cmake) +if (WIN32) + configure_file(catchProp_in_rc.in ${CMAKE_CURRENT_BINARY_DIR}/catchProp.rc @ONLY) + cmake_path(SET LLVM_RC_PATH "${HIP_PATH}/../lc/bin/llvm-rc.exe") + cmake_path(SET LLVM_RC_PATH NORMALIZE "${LLVM_RC_PATH}") + + # generates the .res files to be used by executables to populate the properties + # expects LC folder with clang, llvm-rc to be present one level up of HIP + execute_process(COMMAND ${LLVM_RC_PATH} ${CMAKE_CURRENT_BINARY_DIR}/catchProp.rc + OUTPUT_VARIABLE RC_OUTPUT) + set(PROP_RC ${CMAKE_CURRENT_BINARY_DIR}) +endif() if(HIP_PLATFORM MATCHES "amd" AND HIP_COMPILER MATCHES "clang") add_compile_options(-Wall -Wextra -pedantic -Werror -Wno-deprecated) diff --git a/tests/catch/catchProp_in_rc.in b/tests/catch/catchProp_in_rc.in new file mode 100644 index 0000000000..74d2028180 --- /dev/null +++ b/tests/catch/catchProp_in_rc.in @@ -0,0 +1,40 @@ +#include + +#define HIP_VERSION "@HIP_VERSION@" +#define HIP_VERSION_MAJOR @HIP_VERSION_MAJOR@ +#define HIP_VERSION_MINOR @HIP_VERSION_MINOR@ +#define HIP_VERSION_PATCH @HIP_VERSION_PATCH@ + +VS_VERSION_INFO VERSIONINFO +FILEVERSION HIP_VERSION_MAJOR, HIP_VERSION_MINOR , HIP_VERSION_PATCH +PRODUCTVERSION 10,1 +FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP +FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Advanced Micro Devices Inc.\0" + VALUE "FileDescription", "HIP unit tests" + VALUE "FileVersion", "amdhip64.dll" HIP_VERSION + VALUE "LegalCopyright", "Copyright (C) 2022 Advanced Micro Devices Inc.\0" + VALUE "ProductName", "HIP unit tests" + VALUE "ProductVersion", HIP_VERSION + VALUE "Comments", "\0" + VALUE "InternalName", "HIP unit tests" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END +/* End of Version info */ diff --git a/tests/catch/external/Catch2/cmake/Catch2/Catch.cmake b/tests/catch/external/Catch2/cmake/Catch2/Catch.cmake index 5f4b06c7b2..5287241143 100644 --- a/tests/catch/external/Catch2/cmake/Catch2/Catch.cmake +++ b/tests/catch/external/Catch2/cmake/Catch2/Catch.cmake @@ -207,7 +207,15 @@ function(hip_add_exe_to_target) catch_discover_tests(${_NAME} PROPERTIES SKIP_REGULAR_EXPRESSION "HIP_SKIP_THIS_TEST") if(UNIX) set(_LINKER_LIBS ${_LINKER_LIBS} stdc++fs) + else() + # res files are built resource files using rc files. + # use llvm-rc exe to build the res files + # Thes are used to populate the properties of the built executables + if(EXISTS "${PROP_RC}/catchProp.res") + set(_LINKER_LIBS ${_LINKER_LIBS} "${PROP_RC}/catchProp.res") + endif() endif() + if(DEFINED _LINKER_LIBS) target_link_libraries(${_NAME} ${_LINKER_LIBS}) endif() diff --git a/tests/catch/hipTestMain/config/config_amd_windows.json b/tests/catch/hipTestMain/config/config_amd_windows.json index d60f72243c..e84d88bf85 100644 --- a/tests/catch/hipTestMain/config/config_amd_windows.json +++ b/tests/catch/hipTestMain/config/config_amd_windows.json @@ -59,7 +59,9 @@ "Unit_hipGraphExecEventRecordNodeSetEvent_Negative", "Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Negative", "Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Functional", - "Unit_hipPtrGetAttribute_Simple" + "Unit_hipPtrGetAttribute_Simple", + "Unit_hipStreamCreateWithPriority_ValidateWithEvents", + "Unit_hipEvent" ] }