From 8cd13f320685f492875b9910704784ec4560ccc4 Mon Sep 17 00:00:00 2001 From: Phaneendr-kumar Lanka Date: Wed, 20 Dec 2017 14:10:47 +0530 Subject: [PATCH 1/5] [nvccTests] Enable hipPeerToPeer_simple on nvcc [ROCm/hip commit: 88374a8a63889ffd2a990fc2acc9a0a7bdd45785] --- projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp b/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp index 32cab371b8..74fefa8fdb 100644 --- a/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp +++ b/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp @@ -23,10 +23,10 @@ THE SOFTWARE. // Also serves as a template for other tests. /* HIT_START - * BUILD: %t %s ../test_common.cpp - * RUN: %t EXCLUDE_HIP_PLATFORM all - * RUN: %t --memcpyWithPeer EXCLUDE_HIP_PLATFORM all - * RUN: %t --mirrorPeers EXCLUDE_HIP_PLATFORM all + * BUILD: %t %s ../test_common.cpp + * RUN: %t EXCLUDE_HIP_PLATFORM hipcc + * RUN: %t --memcpyWithPeer EXCLUDE_HIP_PLATFORM hipcc + * RUN: %t --mirrorPeers EXCLUDE_HIP_PLATFORM hipcc * HIT_END */ From e2b7d5b9fd29d4cb460fe8aab24c22bc73a7c298 Mon Sep 17 00:00:00 2001 From: Phaneendr-kumar Lanka Date: Wed, 10 Jan 2018 10:36:25 +0530 Subject: [PATCH 2/5] [nvccTests] Enable hipGetDeviceAttribute on nvcc [ROCm/hip commit: 5642a95dfa89b67795f5cc38cb998b98d866cb47] --- .../hip/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/hip/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp b/projects/hip/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp index 2919939694..0b965a3ae3 100644 --- a/projects/hip/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp +++ b/projects/hip/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. /* HIT_START * BUILD: %t %s ../../test_common.cpp - * RUN: %t EXCLUDE_HIP_PLATFORM nvcc + * RUN: %t * HIT_END */ From 00aeb8514f5385f5415297b618cddc4120c94161 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 12 Feb 2018 10:21:27 +0530 Subject: [PATCH 3/5] [build] Add clangformat target to cmake - Added a new target "clangformat" which formats the code using the clang-format tool found in HCC package. - Renamed target "static_check" to "cppcheck". - Use find_program() macro to make the build system more robust. Change-Id: Ifefbf36f23ff7ef27a870120d5b9170d0cc8aa52 [ROCm/hip commit: 1e559d19c39b33bfaab5a0c4f28535d25b238253] --- projects/hip/.clang-format | 20 ++++++++++++++++++++ projects/hip/CMakeLists.txt | 26 ++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 projects/hip/.clang-format diff --git a/projects/hip/.clang-format b/projects/hip/.clang-format new file mode 100644 index 0000000000..1793af2ba2 --- /dev/null +++ b/projects/hip/.clang-format @@ -0,0 +1,20 @@ +--- +Language: Cpp +BasedOnStyle: Google +AlignEscapedNewlinesLeft: false +ColumnLimit: 100 +DerivePointerAlignment: false +IndentWrappedFunctionNames: false +MaxEmptyLinesToKeep: 2 +SortIncludes: false +IndentWidth: 4 +--- +Language: ObjC +BasedOnStyle: Google +AlignEscapedNewlinesLeft: false +ColumnLimit: 100 +DerivePointerAlignment: false +IndentWrappedFunctionNames: false +MaxEmptyLinesToKeep: 2 +SortIncludes: false +IndentWidth: 4 diff --git a/projects/hip/CMakeLists.txt b/projects/hip/CMakeLists.txt index baf3b49df1..1573ddee5c 100644 --- a/projects/hip/CMakeLists.txt +++ b/projects/hip/CMakeLists.txt @@ -220,8 +220,11 @@ endif() file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo}) # Build doxygen documentation -add_custom_target(doc COMMAND HIP_PATH=${CMAKE_CURRENT_SOURCE_DIR} doxygen ${CMAKE_CURRENT_SOURCE_DIR}/docs/doxygen-input/doxy.cfg - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs) +find_program(DOXYGEN_EXE doxygen) +if(DOXYGEN_EXE) + add_custom_target(doc COMMAND HIP_PATH=${CMAKE_CURRENT_SOURCE_DIR} ${DOXYGEN_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/docs/doxygen-input/doxy.cfg + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs) +endif() ############################# # Install steps @@ -364,8 +367,23 @@ endif() ############################# # Code analysis ############################# -# Target: static_check -add_custom_target(static_check COMMAND cppcheck --force --quiet --enable=warning,performance,portability,information,missingInclude src include -I /opt/rocm/include/hcc -I /opt/rocm/include --suppress=*:/opt/rocm/include/hcc/hc.hpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +# Target: cppcheck +find_program(CPPCHECK_EXE cppcheck) +if(CPPCHECK_EXE) + add_custom_target(cppcheck COMMAND ${CPPCHECK_EXE} --force --quiet --enable=warning,performance,portability,information,missingInclude src include -I /opt/rocm/include/hcc -I /opt/rocm/include --suppress=*:/opt/rocm/include/hcc/hc.hpp + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() + +############################# +# Code formatting +############################# +# Target: clangformat +find_program(CLANGFORMAT_EXE clang-format PATHS ${HCC_HOME}/bin) +if(CLANGFORMAT_EXE) + file(GLOB_RECURSE FORMAT_SOURCE_FILE_LIST *.cpp *.hpp *.h) + add_custom_target(clangformat COMMAND ${CLANGFORMAT_EXE} -style=file -i ${FORMAT_SOURCE_FILE_LIST} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() ############################# # Testing steps From cb9b6d3613c66935cbecf9dbfdc4dc6426f70c80 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Wed, 14 Feb 2018 09:13:50 +0530 Subject: [PATCH 4/5] [dtests] Fix HIT block in hipPeerToPeer_simple.cpp [ROCm/hip commit: 2ff55124fa64c19e42c1cce3755dd762e787fdd2] --- projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp b/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp index 74fefa8fdb..9181ebdb59 100644 --- a/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp +++ b/projects/hip/tests/src/p2p/hipPeerToPeer_simple.cpp @@ -23,10 +23,10 @@ THE SOFTWARE. // Also serves as a template for other tests. /* HIT_START - * BUILD: %t %s ../test_common.cpp - * RUN: %t EXCLUDE_HIP_PLATFORM hipcc - * RUN: %t --memcpyWithPeer EXCLUDE_HIP_PLATFORM hipcc - * RUN: %t --mirrorPeers EXCLUDE_HIP_PLATFORM hipcc + * BUILD: %t %s ../test_common.cpp + * RUN: %t EXCLUDE_HIP_PLATFORM hcc + * RUN: %t --memcpyWithPeer EXCLUDE_HIP_PLATFORM hcc + * RUN: %t --mirrorPeers EXCLUDE_HIP_PLATFORM hcc * HIT_END */ From afc71e3bada78343a6e12f16f9ad587a269d573f Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Sun, 18 Feb 2018 14:19:21 -0500 Subject: [PATCH 5/5] make HIP to load the GPU objects and to setup the function symbol map on startup [ROCm/hip commit: ebc92e597553360fe6389be64de99370713bef10] --- projects/hip/src/program_state.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/hip/src/program_state.cpp b/projects/hip/src/program_state.cpp index 35785dcad5..aef92d463c 100644 --- a/projects/hip/src/program_state.cpp +++ b/projects/hip/src/program_state.cpp @@ -490,4 +490,16 @@ namespace hip_impl return executable; } + + // To force HIP to load the kernels and to setup the function + // symbol map on program startup + class startup_kernel_loader { + private: + startup_kernel_loader() { functions(); } + startup_kernel_loader(const startup_kernel_loader&) = delete; + startup_kernel_loader& operator= (const startup_kernel_loader&) = delete; + static startup_kernel_loader skl; + }; + startup_kernel_loader startup_kernel_loader::skl; + } // Namespace hip_impl.