summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2020-12-24 01:06:47 +0800
committerBenda Xu <heroxbd@gentoo.org>2020-12-27 09:55:26 +0800
commit36781efd38eb25f8e0d4643af2c44029f61f702c (patch)
tree0403a7697f05e761a9e279c04db15e8fbcd97fb8 /dev-util/hip/files
parentsys-devel/llvm-roc: add support for Prefix. (diff)
downloadgentoo-36781efd38eb25f8e0d4643af2c44029f61f702c.tar.gz
gentoo-36781efd38eb25f8e0d4643af2c44029f61f702c.tar.bz2
gentoo-36781efd38eb25f8e0d4643af2c44029f61f702c.zip
dev-util/hip: C++ Heterogeneous-Compute Interface for Portability.
This ebuild is adopted from that of https://github.com/justxi/rocm. 1. change hip location from /usr/lib/hip/<ver> to /usr/lib/hip. We do not have plans to support multiple hip versions at once. 2. turn the hipify function off as it does not work. We will re-enable it as a USE flag when possible. 3. properly prefixify the source code making use of hprefixify(). 4. migrate from cmake-utils to cmake eclass. Closes: https://github.com/gentoo/gentoo/pull/18787 Suggested-by: Wilfried Holzke <gentoo@holzke.net> Suggested-by: Yiyang Wu <xgreenlandforwyy@gmail.com> Package-Manager: Portage-3.0.12, Repoman-3.0.1 Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'dev-util/hip/files')
-rw-r--r--dev-util/hip/files/hip-3.5.1-config-cmake-in.patch28
-rw-r--r--dev-util/hip/files/hip-3.5.1-detect_offload-arch_for_clang-roc.patch21
-rw-r--r--dev-util/hip/files/hip-3.5.1-hip_vector_types.patch10
-rw-r--r--dev-util/hip/files/hip-3.9.0-DisableTest.patch87
-rw-r--r--dev-util/hip/files/hip-3.9.0-add-include-directories.patch13
-rw-r--r--dev-util/hip/files/hip-3.9.0-lpl_ca-add-include.patch10
6 files changed, 169 insertions, 0 deletions
diff --git a/dev-util/hip/files/hip-3.5.1-config-cmake-in.patch b/dev-util/hip/files/hip-3.5.1-config-cmake-in.patch
new file mode 100644
index 000000000000..f3b5ac9c19ef
--- /dev/null
+++ b/dev-util/hip/files/hip-3.5.1-config-cmake-in.patch
@@ -0,0 +1,28 @@
+--- a/hip-config.cmake.in 2020-06-21 21:17:35.576297760 +0200
++++ b/hip-config.cmake.in 2020-06-21 21:17:59.861296628 +0200
+@@ -123,8 +123,10 @@
+ )
+ set_target_properties(hip::device PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "__HIP_ROCclr__=1"
+- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
+- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
++ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
++ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
++# INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
++# INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
+ )
+ else()
+ set_target_properties(hip::hip_hcc_static PROPERTIES
+@@ -156,9 +158,9 @@
+ INTERFACE_LINK_LIBRARIES --hip-device-lib-path=${AMD_DEVICE_LIBS_PREFIX}/lib --hip-link
+ )
+
+- set_property(TARGET hip::device APPEND PROPERTY
+- INTERFACE_INCLUDE_DIRECTORIES "${HIP_CLANG_INCLUDE_PATH}/.."
+- )
++# set_property(TARGET hip::device APPEND PROPERTY
++# INTERFACE_INCLUDE_DIRECTORIES "${HIP_CLANG_INCLUDE_PATH}/.."
++# )
+
+ set_property(TARGET hip::device APPEND PROPERTY
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_CLANG_INCLUDE_PATH}/.."
diff --git a/dev-util/hip/files/hip-3.5.1-detect_offload-arch_for_clang-roc.patch b/dev-util/hip/files/hip-3.5.1-detect_offload-arch_for_clang-roc.patch
new file mode 100644
index 000000000000..7997e2929666
--- /dev/null
+++ b/dev-util/hip/files/hip-3.5.1-detect_offload-arch_for_clang-roc.patch
@@ -0,0 +1,21 @@
+diff -uprN HIP-rocm-3.5.1/bin/hipcc patched/bin/hipcc
+--- HIP-rocm-3.5.1/bin/hipcc 2020-07-21 14:29:11.625878447 +0800
++++ patched/bin/hipcc 2020-07-21 14:34:11.454395203 +0800
+@@ -675,7 +675,7 @@ foreach $arg (@ARGV)
+ $prevArg = $arg;
+ }
+
+-if($HIP_PLATFORM eq "hcc"){
++if($HIP_PLATFORM eq "hcc" || $HIP_PLATFORM eq "rocclr"){
+ # No AMDGPU target specified at commandline. So look for HCC_AMDGPU_TARGET
+ if($default_amdgpu_target eq 1) {
+ if (defined $ENV{HCC_AMDGPU_TARGET}) {
+@@ -694,6 +694,8 @@ if($HIP_PLATFORM eq "hcc"){
+
+ if($HIP_COMPILER eq "hcc") {
+ $GPU_ARCH_OPT = " --amdgpu-target=";
++ } elsif($HIP_COMPILER eq "clang") {
++ $GPU_ARCH_OPT = " --offload-arch=";
+ } else {
+ $GPU_ARCH_OPT = " --cuda-gpu-arch=";
+ }
diff --git a/dev-util/hip/files/hip-3.5.1-hip_vector_types.patch b/dev-util/hip/files/hip-3.5.1-hip_vector_types.patch
new file mode 100644
index 000000000000..382ed52f6923
--- /dev/null
+++ b/dev-util/hip/files/hip-3.5.1-hip_vector_types.patch
@@ -0,0 +1,10 @@
+--- a/include/hip/hcc_detail/hip_vector_types.h
++++ b/include/hip/hcc_detail/hip_vector_types.h
+@@ -42,6 +42,7 @@
+ #endif
+
+ #if defined(__cplusplus)
++ #include <new>
+ #include <array>
+ #include <iosfwd>
+ #include <type_traits>
diff --git a/dev-util/hip/files/hip-3.9.0-DisableTest.patch b/dev-util/hip/files/hip-3.9.0-DisableTest.patch
new file mode 100644
index 000000000000..3fc787a7354e
--- /dev/null
+++ b/dev-util/hip/files/hip-3.9.0-DisableTest.patch
@@ -0,0 +1,87 @@
+--- a/CMakeLists.txt 2020-11-15 11:26:09.747793881 +0100
++++ b/CMakeLists.txt 2020-11-15 11:28:45.289793287 +0100
+@@ -676,45 +676,45 @@
+ # Target: test
+ set(HIP_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ set(HIP_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+-if(HIP_PLATFORM STREQUAL "nvcc")
+- execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
+-endif()
+-execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/cmake" "${HIP_ROOT_DIR}/cmake" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
+-if(${RUN_HIT} EQUAL 0)
+- execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/bin" "${HIP_ROOT_DIR}/bin" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
+-endif()
+-if(${RUN_HIT} EQUAL 0)
+- set(CMAKE_MODULE_PATH "${HIP_ROOT_DIR}/cmake" ${CMAKE_MODULE_PATH})
+- include(${HIP_SRC_PATH}/tests/hit/HIT.cmake)
+-
+- # Add tests
+- include_directories(${HIP_SRC_PATH}/tests/src)
+- hit_add_directory_recursive(${HIP_CTEST_CONFIG_DEFAULT} ${HIP_SRC_PATH}/tests/src "directed_tests")
+-
+- # Add unit tests
+- include_directories(${HIP_SRC_PATH}/tests/unit)
+- hit_add_directory_recursive(${HIP_CTEST_CONFIG_DEFAULT} ${HIP_SRC_PATH}/tests/unit "unit_tests")
+-
+- # Add performance tests
+- include_directories(${HIP_SRC_PATH}/tests/performance)
+- hit_add_directory_recursive(${HIP_CTEST_CONFIG_PERFORMANCE} ${HIP_SRC_PATH}/tests/performance "performance_tests")
+-
+- # Add top-level tests to build_tests
+- add_custom_target(build_tests DEPENDS directed_tests unit_tests)
+-
+- # Add top-level tests to build performance_tests.
+- # To build performance tests, just run "make build_perf"
+- add_custom_target(build_perf DEPENDS performance_tests)
+-
+- # Add custom target: perf.
+- # To run performance tests, just run "make perf"
+- add_custom_target(perf COMMAND "${CMAKE_CTEST_COMMAND}" -C "${HIP_CTEST_CONFIG_PERFORMANCE}" -R "performance_tests/" --verbose)
+-
+- # Add custom target: check
+- add_custom_target(check COMMAND "${CMAKE_COMMAND}" --build . --target test DEPENDS build_tests)
+-else()
+- message(STATUS "Testing targets will not be available. To enable them please ensure that the HIP installation directory is writeable. Use -DCMAKE_INSTALL_PREFIX to specify a suitable location")
+-endif()
++#if(HIP_PLATFORM STREQUAL "nvcc")
++# execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
++#endif()
++#execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/cmake" "${HIP_ROOT_DIR}/cmake" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
++#if(${RUN_HIT} EQUAL 0)
++# execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/bin" "${HIP_ROOT_DIR}/bin" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
++#endif()
++#if(${RUN_HIT} EQUAL 0)
++# set(CMAKE_MODULE_PATH "${HIP_ROOT_DIR}/cmake" ${CMAKE_MODULE_PATH})
++# include(${HIP_SRC_PATH}/tests/hit/HIT.cmake)
++#
++# # Add tests
++# include_directories(${HIP_SRC_PATH}/tests/src)
++# hit_add_directory_recursive(${HIP_CTEST_CONFIG_DEFAULT} ${HIP_SRC_PATH}/tests/src "directed_tests")
++#
++# # Add unit tests
++# include_directories(${HIP_SRC_PATH}/tests/unit)
++# hit_add_directory_recursive(${HIP_CTEST_CONFIG_DEFAULT} ${HIP_SRC_PATH}/tests/unit "unit_tests")
++#
++# # Add performance tests
++# include_directories(${HIP_SRC_PATH}/tests/performance)
++# hit_add_directory_recursive(${HIP_CTEST_CONFIG_PERFORMANCE} ${HIP_SRC_PATH}/tests/performance "performance_tests")
++#
++# # Add top-level tests to build_tests
++# add_custom_target(build_tests DEPENDS directed_tests unit_tests)
++#
++# # Add top-level tests to build performance_tests.
++# # To build performance tests, just run "make build_perf"
++# add_custom_target(build_perf DEPENDS performance_tests)
++#
++# # Add custom target: perf.
++# # To run performance tests, just run "make perf"
++# add_custom_target(perf COMMAND "${CMAKE_CTEST_COMMAND}" -C "${HIP_CTEST_CONFIG_PERFORMANCE}" -R "performance_tests/" --verbose)
++#
++# # Add custom target: check
++# add_custom_target(check COMMAND "${CMAKE_COMMAND}" --build . --target test DEPENDS build_tests)
++#else()
++# message(STATUS "Testing targets will not be available. To enable them please ensure that the HIP installation directory is writeable. Use -DCMAKE_INSTALL_PREFIX to specify a suitable location")
++#endif()
+
+ #############################
+ # Code analysis
diff --git a/dev-util/hip/files/hip-3.9.0-add-include-directories.patch b/dev-util/hip/files/hip-3.9.0-add-include-directories.patch
new file mode 100644
index 000000000000..42bd9736ee2c
--- /dev/null
+++ b/dev-util/hip/files/hip-3.9.0-add-include-directories.patch
@@ -0,0 +1,13 @@
+--- a/rocclr/CMakeLists.txt 2020-08-23 11:45:13.148817894 +0200
++++ b/rocclr/CMakeLists.txt 2020-08-23 11:50:12.409816752 +0200
+@@ -139,6 +139,10 @@
+ target_compile_definitions(hip64
+ PRIVATE
+ $<TARGET_PROPERTY:amdrocclr_static,INTERFACE_COMPILE_DEFINITIONS>)
++
++ include_directories(/usr/include/rocclr)
++ include_directories(/usr/include/rocclr/elf)
++ include_directories(/usr/include/rocclr/compiler/lib/include/)
+ endif()
+
+ # Enable profiling API
diff --git a/dev-util/hip/files/hip-3.9.0-lpl_ca-add-include.patch b/dev-util/hip/files/hip-3.9.0-lpl_ca-add-include.patch
new file mode 100644
index 000000000000..bebe6f0f4ecc
--- /dev/null
+++ b/dev-util/hip/files/hip-3.9.0-lpl_ca-add-include.patch
@@ -0,0 +1,10 @@
+--- a/lpl_ca/CMakeLists.txt 2020-11-15 11:47:55.091788901 +0100
++++ b/lpl_ca/CMakeLists.txt 2020-11-15 11:49:14.881788597 +0100
+@@ -17,6 +17,7 @@
+ ${PROJECT_SOURCE_DIR}/src
+ PRIVATE
+ $<TARGET_PROPERTY:amdrocclr_static,INTERFACE_INCLUDE_DIRECTORIES>)
++target_include_directories(lpl SYSTEM PUBLIC /usr/include/rocclr/elf)
+
+ target_compile_options(lpl PUBLIC -Wall)
+ target_link_libraries(lpl PUBLIC pthread)