summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiyang Wu <xgreenlandforwyy@gmail.com>2024-05-03 23:23:09 +0800
committerSam James <sam@gentoo.org>2024-06-26 10:19:01 +0100
commitba648de05ea5c85e51abfa8fff4ddf85abf2d43b (patch)
tree8a2670e8dcd1fc5e5086ef79622034652c37db98 /dev-util/hip
parentdev-util/hip: Fix compilation of hipMathFunctions (diff)
downloadgentoo-ba648de05ea5c85e51abfa8fff4ddf85abf2d43b.tar.gz
gentoo-ba648de05ea5c85e51abfa8fff4ddf85abf2d43b.tar.bz2
gentoo-ba648de05ea5c85e51abfa8fff4ddf85abf2d43b.zip
dev-util/hip: add 6.1.1
Retains FindHIP.cmake since some package like roctracer and rocprofiler use it Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-util/hip')
-rw-r--r--dev-util/hip/Manifest3
-rw-r--r--dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check.patch236
-rw-r--r--dev-util/hip/files/hip-6.1.0-install.patch21
-rw-r--r--dev-util/hip/files/hip-test-6.1.0-disable-hipKerArgOptimization.patch24
-rw-r--r--dev-util/hip/hip-6.1.1.ebuild147
-rw-r--r--dev-util/hip/metadata.xml2
6 files changed, 432 insertions, 1 deletions
diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest
index bdccb9c69e6d..be7784a54663 100644
--- a/dev-util/hip/Manifest
+++ b/dev-util/hip/Manifest
@@ -1,7 +1,9 @@
DIST hip-5.1.3-update-header.patch.gz 3406 BLAKE2B 805539c3396a9cdcc4b807afd96eacd2de0e494a9ec927a1526cb8ce26b1c6e0a4d06415cd0210cba1398b5ff70f995fa67ad22b659578c075eb24c2a2cc9228 SHA512 eef4d70f9470a61d1d8cb140728cc4f2e792a4e64e0900a7410a74f3a6421410e7546e4e62bbbf35ae231b566bf162fb85de1f1ad1d8cfb2f282d2ed9a34b53a
DIST hip-5.7.1.tar.gz 553774 BLAKE2B f88c235f688d3a662ec6cb4ad7fe3f82c0015015997871609cc30ab5b2f7fcb9709a08683d77194e45a6dbbe1d24c6355b128d2ecf655f1dea3468711c64e0a3 SHA512 68fa8753725b53c999d102d254c6b1dba53af4e00d6a48db93d10213cc02eec30b4a39c66e773d4f625dd9636cf8b0c5faa05b69fac27cf5a6b19dd3ddd2b905
DIST hip-6.0.2.tar.gz 243457 BLAKE2B 72bc03b8e4098a8d454dd17293dc6942534707f57f08db7ebf1f7653549cb13ec2971c1b329b6cea3df3c2c48bbdb4fbbb014cbeb27a39c07a4489797801ab1b SHA512 8e040220eb95b219819312e021f678ad4e1addc45f87d484fc40bdec1b5532976aad4b4aa9ec2cab45374f4802453d4d7fdbc7bcd4d9adc17cb820be406e3c43
+DIST hip-6.1.1.tar.gz 247192 BLAKE2B c40bb483fb61b3037693f456e546046598df7e0dd81a1f1c8d222ab0d9c0752092ce85c8533bd355f883dda5ce1f32f7ff2b2a58cebac50d53e0e7f4d85ca3ae SHA512 3e6162938294a74af51bc2161ada38dc4ba19614e182238f320f2052a9025be6ea413e40f00cb80f4e86696793d6c4431e2417ea798a2330886a3f3e66aedf0d
DIST hip-test-6.0.2.tar.gz 959429 BLAKE2B f2167b00fc69a0ba6a03080e82cb1ff02120c3910b1eca6d623b9d3e3bc27b067c3f266ca0e633d83b60275bdfa42c3ad936e6481e4e5727c912ec702c246055 SHA512 7696298864d39729831edae2bc2ec55f2c8b3bc7578861b022f77a6d4e55a141bcb0bd83e3912c54b5c4cd745654019c75eb542ef6d260a1946a55d1abe42243
+DIST hip-test-6.1.1.tar.gz 1080605 BLAKE2B 7eddf648be31365479baa0cd4fd1c060a682a6b44d923cac1c4840c0768782db2fef4e5d97318ef0423be1e5c85b1a0cc6b9d324db789dad28be17f64ab38cae SHA512 0dd679c5b94a59e192bea5789f4448b53ac23c8a03b24a347758b1d70ff692483fd4aaea0b19345eb6ffb82a4492ed21958398b53ae6244a244a660dfa33412f
DIST rocclr-5.1.3.tar.gz 618606 BLAKE2B 02b7732ddd03c0883bee49c56466cd21c649159f801bfb2537eea6e640c65613eb57b37d942f465a9deb83d65735f51212dde5e4f77ba8239d1a6b7037e1800c SHA512 89fd2eca39ed84a1cf525b2c606089ef39f64c1f997c4880e10722da6de4864110752640e1508db1aeb9d15c48ba4e6fe5dbe7a9e56718853ece42548028b2ca
DIST rocclr-5.3.3.tar.gz 625944 BLAKE2B 0cdbc1415a355e1d56628834846aaa8587c9827eeea59f4312b788e868265dcb42197181fd5ef411416da2e11662c7f665f578aa750ab88c3a5405bcc58ee449 SHA512 3f85532cffc09c2ca8e7cd1770263d1c1a38633ed2bc5cfe62072e12a6f8f669db400519950718be31f6b77693d372e2ef905f06c7f02e126aa9ff7d2da97924
DIST rocclr-5.4.3.tar.gz 640557 BLAKE2B 9ab91bab7ffb06c9c0d1c2ae79533fccc597071dda289ac375e32eb2965c638a7029951d2a49d46eeead9d7d242fe3a0cedb3e444d877af1bbf0e2d801c91e11 SHA512 c1d1a2ca08c2d762a221c04d394469aa7aff46086151333b145e0db9a7c7eb3dbbf8b9693e50d816aa9a13c16b4ebacf5ff3d5d8ff3393a8a764728ef5172d3a
@@ -9,6 +11,7 @@ DIST rocclr-5.5.1.tar.gz 634330 BLAKE2B e6383a6b6b09f274a944d66effd345e38a191ec7
DIST rocm-5.7.0.tar.gz 845881 BLAKE2B 08255edc1407e5ef85895336b11496319695318fce265565728ad75175b5e1dfab98f696fee2d27e60c48e862f721fad4c53118cc70b807353fff5f97ed72ac2 SHA512 72420e16c7cfe9687e030331838666dabaa43d686bdad1d109431e44db99070a2cf6dd64b59e3275019abedd6612f6008c798a79275e7225b6b122fb9f644660
DIST rocm-clr-5.7.1.tar.gz 2008647 BLAKE2B 3db0760d6f83504e60caf88a2dd5e0bc02c7db9d6f263ad0eb2cfc79aa0f88a3699c412844a0158a796d9d02e79660287e791edad787d814eefffea4fd2298b4 SHA512 d79323481d82fc02c12a32cdcc0d14437d512af023e7737db0387b7eecb27fe6e4ae7c71d6adce57932a04bb24c880440d9dc10aeb5af11a4f2ca64d44330965
DIST rocm-clr-6.0.2.tar.gz 1983571 BLAKE2B 968bcff00bcf045ad872548bfdafbbd8e4088f4e903dfa1266cbb4627d1af87cbbc9b2bdc6f6842c60d8ea6060e86eb6eb597f7673b82a63992cfcb3fc84bf59 SHA512 f7acc8dabaa11ccb3e2ff2547929276476bdbbf66051ce2e93795921cab7211ff8a70d9da3431d54ea9d45c9d31ff39e9036f363230f782dd1b0e1e3473e0512
+DIST rocm-clr-6.1.1.tar.gz 2031034 BLAKE2B b0485bb015d31986f4988d1db0c029c826856e50b5bb1b58fac2097c14b3966668f1b8d41ec198889e27ac860497a8b3c081ec31d52390d5c9ff5db092bf7cce SHA512 86925e8b9a9e77b06a57daefbc7279887b4ef7c6a79c3717bc2f2d3bf29926281c60063fd17e21c65d7def520d9f579bf88f69051d053a38750ba968f69ca3fc
DIST rocm-hip-5.1.3.tar.gz 967696 BLAKE2B 15cb52b5934b84acf515fe9c83b7c8982e00a23e20af933bdd2c4bc5b56fd42b08c8a08e840c85d2e0a8386d5a0e9c110504f68499989de1aaad00e9a5efcf43 SHA512 6b6fd6c12d73788df1711b12326b97fc7a184f319e0db114947b7967b75f2ee131f81e42e43a4981456b507221a6013133731120409f90214e13304299ccbc24
DIST rocm-hip-5.3.3.tar.gz 1151858 BLAKE2B 5f460b2078c850b3eb4414fcec4a6f951a3b282aa9828f77ba5d5adfdc0ee8d2e62c856e112a154c340daaf7dad49f4871412edd7b38f7fae2e6b17840ee144b SHA512 e747cc10e78cd09009cac762f0e060be13f3447af7ec2a4a2889cbdc09cd76ecb1b5b58c89f09a3b45a8296c2c71e1c55baf113e58a5a12434af3de7168b8d87
DIST rocm-hip-5.4.3.tar.gz 1195173 BLAKE2B 7452ee7a874bc4703b0d3aaaf9fa2a51e223d5650c65c34982a9981dbe14e8ec70c93d7e70c5ad36a8d02c3d2214fa6a393e20502a01418fb3320d8cfe363feb SHA512 1f4100e114576dcbad83aae453e21ab85cf25bd8a6ada380bb11cfc30e5f92ba903055b7257a099321a84b65adb444dd52b8258e82567f4bc882e65d89369b43
diff --git a/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check.patch b/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check.patch
new file mode 100644
index 000000000000..40ccf6fdc089
--- /dev/null
+++ b/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check.patch
@@ -0,0 +1,236 @@
+Combined with matching changes within rocr-runtime ebuild, this patch allows
+to load compatible kernels whenever possible.
+For example if AMDGPU_TARGETS is set to gfx1030 and some application
+was started on gfx1036, it loads gfx1030 kernel.
+
+Author: Cordell Bloor <cgmb@slerp.xyz>
+https://salsa.debian.org/rocm-team/rocm-hipamd/-/blob/master/debian/patches/0025-improve-rocclr-isa-compatibility-check.patch
+https://salsa.debian.org/rocm-team/rocm-hipamd/-/blob/master/debian/patches/0026-extend-hip-isa-compatibility-check.patch
+--- a/hipamd/src/hip_code_object.cpp
++++ b/hipamd/src/hip_code_object.cpp
+@@ -390,47 +390,123 @@ static bool getTripleTargetID(std::string bundled_co_entry_id, const void* code_
+ return true;
+ }
+
+-static bool isCodeObjectCompatibleWithDevice(std::string co_triple_target_id,
+- std::string agent_triple_target_id) {
++struct GfxPattern {
++ std::string root;
++ std::string suffixes;
++};
++
++static bool matches(const GfxPattern& p, const std::string& s) {
++ if (p.root.size() + 1 != s.size()) {
++ return false;
++ }
++ if (0 != std::memcmp(p.root.data(), s.data(), p.root.size())) {
++ return false;
++ }
++ return p.suffixes.find(s[p.root.size()]) != std::string::npos;
++}
++
++static bool isGfx900EquivalentProcessor(const std::string& processor) {
++ return matches(GfxPattern{"gfx90", "029c"}, processor);
++}
++
++static bool isGfx900SupersetProcessor(const std::string& processor) {
++ return matches(GfxPattern{"gfx90", "0269c"}, processor);
++}
++
++static bool isGfx1030EquivalentProcessor(const std::string& processor) {
++ return matches(GfxPattern{"gfx103", "0123456"}, processor);
++}
++
++static bool isGfx1010EquivalentProcessor(const std::string& processor) {
++ return matches(GfxPattern{"gfx101", "0"}, processor);
++}
++
++static bool isGfx1010SupersetProcessor(const std::string& processor) {
++ return matches(GfxPattern{"gfx101", "0123"}, processor);
++}
++
++enum CompatibilityScore {
++ CS_EXACT_MATCH = 1 << 4,
++ CS_PROCESSOR_MATCH = 1 << 3,
++ CS_PROCESSOR_COMPATIBLE = 1 << 2,
++ CS_XNACK_SPECIALIZED = 1 << 1,
++ CS_SRAM_ECC_SPECIALIZED = 1 << 0,
++ CS_INCOMPATIBLE = 0,
++};
++
++static int getProcessorCompatibilityScore(const std::string& co_processor,
++ const std::string& agent_processor) {
++ if (co_processor == agent_processor)
++ return CS_PROCESSOR_MATCH;
++
++ if (isGfx900SupersetProcessor(agent_processor))
++ return isGfx900EquivalentProcessor(co_processor) ? CS_PROCESSOR_COMPATIBLE : CS_INCOMPATIBLE;
++
++ if (isGfx1010SupersetProcessor(agent_processor))
++ return isGfx1010EquivalentProcessor(co_processor) ? CS_PROCESSOR_COMPATIBLE : CS_INCOMPATIBLE;
++
++ if (isGfx1030EquivalentProcessor(agent_processor))
++ return isGfx1030EquivalentProcessor(co_processor) ? CS_PROCESSOR_COMPATIBLE : CS_INCOMPATIBLE;
++
++ return CS_INCOMPATIBLE;
++}
++
++static int getCompatiblityScore(std::string co_triple_target_id,
++ std::string agent_triple_target_id) {
+ // Primitive Check
+- if (co_triple_target_id == agent_triple_target_id) return true;
++ if (co_triple_target_id == agent_triple_target_id) return CS_EXACT_MATCH;
+
+ // Parse code object triple target id
+ if (!consume(co_triple_target_id, std::string(kAmdgcnTargetTriple) + '-')) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
+
+ std::string co_processor;
+ char co_sram_ecc, co_xnack;
+ if (!getTargetIDValue(co_triple_target_id, co_processor, co_sram_ecc, co_xnack)) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
+
+- if (!co_triple_target_id.empty()) return false;
++ if (!co_triple_target_id.empty()) return CS_INCOMPATIBLE;
+
+ // Parse agent isa triple target id
+ if (!consume(agent_triple_target_id, std::string(kAmdgcnTargetTriple) + '-')) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
+
+ std::string agent_isa_processor;
+ char isa_sram_ecc, isa_xnack;
+ if (!getTargetIDValue(agent_triple_target_id, agent_isa_processor, isa_sram_ecc, isa_xnack)) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
+
+- if (!agent_triple_target_id.empty()) return false;
++ if (!agent_triple_target_id.empty()) return CS_INCOMPATIBLE;
+
+ // Check for compatibility
+- if (agent_isa_processor != co_processor) return false;
+- if (co_sram_ecc != ' ') {
+- if (co_sram_ecc != isa_sram_ecc) return false;
++ int processor_score = getProcessorCompatibilityScore(co_processor, agent_isa_processor);
++ if (processor_score == CS_INCOMPATIBLE) {
++ return CS_INCOMPATIBLE;
+ }
+- if (co_xnack != ' ') {
+- if (co_xnack != isa_xnack) return false;
++
++ int xnack_bonus;
++ if (co_xnack == ' ') {
++ xnack_bonus = 0;
++ } else if (co_xnack == isa_xnack) {
++ xnack_bonus = CS_XNACK_SPECIALIZED;
++ } else {
++ return CS_INCOMPATIBLE;
+ }
+
+- return true;
++ int sram_ecc_bonus;
++ if (co_sram_ecc == ' ') {
++ sram_ecc_bonus = 0;
++ } else if (co_sram_ecc == isa_sram_ecc) {
++ sram_ecc_bonus = CS_SRAM_ECC_SPECIALIZED;
++ } else {
++ return CS_INCOMPATIBLE;
++ }
++
++ return processor_score + xnack_bonus + sram_ecc_bonus;
+ }
+
+ // This will be moved to COMGR eventually
+@@ -483,6 +559,7 @@ hipError_t CodeObject::extractCodeObjectFromFatBinary(
+ for (size_t i = 0; i < agent_triple_target_ids.size(); i++) {
+ code_objs.push_back(std::make_pair(nullptr, 0));
+ }
++ std::vector<int> compatibility_score(agent_triple_target_ids.size());
+
+ const auto obheader = reinterpret_cast<const __ClangOffloadBundleHeader*>(data);
+ const auto* desc = &obheader->desc[0];
+@@ -495,17 +572,19 @@ hipError_t CodeObject::extractCodeObjectFromFatBinary(
+ reinterpret_cast<const void*>(reinterpret_cast<uintptr_t>(obheader) + desc->offset);
+ const size_t image_size = desc->size;
+
+- if (num_code_objs == 0) break;
+ std::string bundleEntryId{desc->bundleEntryId, desc->bundleEntryIdSize};
+
+ std::string co_triple_target_id;
+ if (!getTripleTargetID(bundleEntryId, image, co_triple_target_id)) continue;
+
+ for (size_t dev = 0; dev < agent_triple_target_ids.size(); ++dev) {
+- if (code_objs[dev].first) continue;
+- if (isCodeObjectCompatibleWithDevice(co_triple_target_id, agent_triple_target_ids[dev])) {
++ if (compatibility_score[dev] >= CS_PROCESSOR_MATCH) continue;
++ int score = getCompatiblityScore(co_triple_target_id, agent_triple_target_ids[dev]);
++ if (score > compatibility_score[dev]) {
++ compatibility_score[dev] = score;
++ if (!code_objs[dev].first)
++ --num_code_objs;
+ code_objs[dev] = std::make_pair(image, image_size);
+- --num_code_objs;
+ }
+ }
+ }
+--- a/rocclr/device/device.cpp
++++ b/rocclr/device/device.cpp
+@@ -232,10 +232,49 @@ std::string Isa::isaName() const {
+ return std::string(hsaIsaNamePrefix) + targetId();
+ }
+
++template <class T, std::size_t N>
++static bool Contains(const std::array<T, N>& arr, const T& value) {
++ return std::find(std::begin(arr), std::end(arr), value) != std::end(arr);
++}
++
++static bool IsVersionCompatible(const Isa &codeObjectIsa,
++ const Isa &agentIsa) {
++ if (codeObjectIsa.versionMajor() == agentIsa.versionMajor() &&
++ codeObjectIsa.versionMinor() == agentIsa.versionMinor()) {
++
++ if (codeObjectIsa.versionStepping() == agentIsa.versionStepping()) {
++ return true; // exact match
++ }
++
++ // The code object and the agent may sometimes be compatible if
++ // they differ only by stepping version.
++ if (codeObjectIsa.versionMajor() == 9 &&
++ codeObjectIsa.versionMinor() == 0) {
++ const std::array<uint32_t, 4> gfx900_equivalent = { 0, 2, 9, 12 };
++ const std::array<uint32_t, 5> gfx900_superset = { 0, 2, 6, 9, 12 };
++ if (Contains(gfx900_equivalent, codeObjectIsa.versionStepping()) &&
++ Contains(gfx900_superset, agentIsa.versionStepping())) {
++ return true; // gfx900 compatible object and agent
++ }
++ } else if (codeObjectIsa.versionMajor() == 10) {
++ if (codeObjectIsa.versionMinor() == 1) {
++ const std::array<uint32_t, 1> gfx1010_equivalent = { 0 };
++ const std::array<uint32_t, 4> gfx1010_superset = { 0, 1, 2, 3 };
++ if (Contains(gfx1010_equivalent, codeObjectIsa.versionStepping()) &&
++ Contains(gfx1010_superset, agentIsa.versionStepping())) {
++ return true; // gfx1010 compatible object and agent
++ }
++ } else if (codeObjectIsa.versionMinor() == 3) {
++ return true; // gfx1030 compatible object and agent
++ }
++ }
++ }
++
++ return false;
++}
++
+ bool Isa::isCompatible(const Isa &codeObjectIsa, const Isa &agentIsa) {
+- if (codeObjectIsa.versionMajor() != agentIsa.versionMajor() ||
+- codeObjectIsa.versionMinor() != agentIsa.versionMinor() ||
+- codeObjectIsa.versionStepping() != agentIsa.versionStepping())
++ if (!IsVersionCompatible(codeObjectIsa, agentIsa))
+ return false;
+
+ assert(codeObjectIsa.isSrameccSupported() == agentIsa.isSrameccSupported() &&
diff --git a/dev-util/hip/files/hip-6.1.0-install.patch b/dev-util/hip/files/hip-6.1.0-install.patch
new file mode 100644
index 000000000000..44038a25ca08
--- /dev/null
+++ b/dev-util/hip/files/hip-6.1.0-install.patch
@@ -0,0 +1,21 @@
+Index: clr-rocm-6.1.0/hipamd/CMakeLists.txt
+===================================================================
+--- clr-rocm-6.1.0.orig/hipamd/CMakeLists.txt
++++ clr-rocm-6.1.0/hipamd/CMakeLists.txt
+@@ -401,16 +401,7 @@ if (NOT ${HIPCC_BIN_DIR} STREQUAL "")
+ set(hipcc_bin ${hipcc_bin}.exe)
+ set(hipconfig_bin ${hipconfig_bin}.exe)
+ endif()
+- if(EXISTS ${hipcc_bin} AND EXISTS ${hipconfig_bin})
+- install(PROGRAMS ${hipcc_bin} DESTINATION bin)
+- install(PROGRAMS ${hipconfig_bin} DESTINATION bin)
+- endif()
+ endif()
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc DESTINATION bin)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig DESTINATION bin)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc.pl DESTINATION bin)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.pl DESTINATION bin)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipvars.pm DESTINATION bin)
+ if(WIN32)
+ install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)
+ install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)
diff --git a/dev-util/hip/files/hip-test-6.1.0-disable-hipKerArgOptimization.patch b/dev-util/hip/files/hip-test-6.1.0-disable-hipKerArgOptimization.patch
new file mode 100644
index 000000000000..cb65ebae62be
--- /dev/null
+++ b/dev-util/hip/files/hip-test-6.1.0-disable-hipKerArgOptimization.patch
@@ -0,0 +1,24 @@
+Those tests requires >=clang-18 to support -amdgpu-kernarg-preload-count
+index afdf8c4..28b0198 100644
+--- a/unit/module/CMakeLists.txt
++++ b/unit/module/CMakeLists.txt
+@@ -41,9 +41,6 @@ add_custom_target(copyKernel.s
+ -I${CMAKE_CURRENT_SOURCE_DIR}/../../include --rocm-path=${ROCM_PATH})
+
+ if(UNIX)
+-set(TEST_SRC
+- ${TEST_SRC}
+- hipKerArgOptimization.cc)
+
+ add_custom_target(copiousArgKernel.code
+ COMMAND ${CMAKE_CXX_COMPILER} --genco ${OFFLOAD_ARCH_STR}
+@@ -106,8 +103,4 @@ hip_add_exe_to_target(NAME ModuleTest
+ TEST_TARGET_NAME build_tests COMMON_SHARED_SRC ${COMMON_SHARED_SRC})
+
+ add_dependencies(build_tests copyKernel.code copyKernel.s)
+-if(UNIX)
+-add_dependencies(build_tests copiousArgKernel.code copiousArgKernel0.code copiousArgKernel1.code copiousArgKernel2.code
+-copiousArgKernel3.code copiousArgKernel16.code copiousArgKernel17.code)
+ endif()
+-endif()
+\ No newline at end of file
diff --git a/dev-util/hip/hip-6.1.1.ebuild b/dev-util/hip/hip-6.1.1.ebuild
new file mode 100644
index 000000000000..494d9e0306d9
--- /dev/null
+++ b/dev-util/hip/hip-6.1.1.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DOCS_BUILDER="doxygen"
+DOCS_DEPEND="media-gfx/graphviz"
+ROCM_SKIP_GLOBALS=1
+
+inherit cmake docs flag-o-matic llvm rocm
+
+LLVM_MAX_SLOT=18
+
+TEST_PV=${PV}
+
+DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability"
+HOMEPAGE="https://github.com/ROCm/clr"
+SRC_URI="https://github.com/ROCm/clr/archive/refs/tags/rocm-${PV}.tar.gz -> rocm-clr-${PV}.tar.gz
+ https://github.com/ROCm/HIP/archive/refs/tags/rocm-${PV}.tar.gz -> hip-${PV}.tar.gz
+ https://github.com/ROCm/hip-tests/archive/refs/tags/rocm-${TEST_PV}.tar.gz -> hip-test-${TEST_PV}.tar.gz"
+S="${WORKDIR}/clr-rocm-${PV}/"
+TEST_S="${WORKDIR}/hip-tests-rocm-${TEST_PV}/catch"
+
+KEYWORDS="~amd64"
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+
+RESTRICT="!test? ( test )"
+IUSE="debug test"
+
+DEPEND="
+ >=dev-util/rocminfo-5
+ sys-devel/clang:${LLVM_MAX_SLOT}
+ dev-libs/rocm-comgr:${SLOT}
+ >=dev-libs/rocr-runtime-5.6
+ x11-base/xorg-proto
+ virtual/opengl
+"
+BDEPEND="test? ( dev-util/hipcc )"
+RDEPEND="${DEPEND}
+ dev-util/hipcc
+ dev-perl/URI-Encode
+ sys-devel/clang-runtime:=
+ >=dev-libs/roct-thunk-interface-5"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch"
+ "${FILESDIR}/${PN}-6.1.0-install.patch"
+ "${FILESDIR}/${PN}-6.1.0-extend-isa-compatibility-check.patch"
+)
+
+hip_test_wrapper() {
+ local CMAKE_USE_DIR="${TEST_S}"
+ local BUILD_DIR="${TEST_S}_build"
+ cd "${TEST_S}" || die
+ $@
+}
+
+src_prepare() {
+ # hipamd is itself built by cmake, and should never provide a
+ # FindHIP.cmake module. But the reality is some package relies on it.
+ # Set HIP and HIP Clang paths directly, don't search using heuristics
+ sed -e "s:# Search for HIP installation:set(HIP_ROOT_DIR \"${EPREFIX}/usr\"):" \
+ -e "s:#Set HIP_CLANG_PATH:set(HIP_CLANG_PATH \"$(get_llvm_prefix -d ${LLVM_MAX_SLOT})/bin\"):" \
+ -i "${WORKDIR}"/HIP-rocm-${PV}/cmake/FindHIP.cmake || die
+
+ cmake_src_prepare
+
+ local PATCHES=(
+ "${FILESDIR}"/hip-test-6.0.2-hipcc-system-install.patch
+ "${FILESDIR}"/hip-test-5.7.1-remove-incompatible-flag.patch
+ "${FILESDIR}"/hip-test-6.1.0-disable-hipKerArgOptimization.patch
+ )
+ hip_test_wrapper cmake_src_prepare
+}
+
+src_configure() {
+ # -Werror=strict-aliasing
+ # https://bugs.gentoo.org/858383
+ # https://github.com/ROCm/clr/issues/64
+ #
+ # Do not trust it for LTO either
+ append-flags -fno-strict-aliasing
+ filter-lto
+
+ use debug && CMAKE_BUILD_TYPE="Debug"
+
+ # Fix ld.lld linker error: https://github.com/ROCm/HIP/issues/3382
+ # See also: https://github.com/gentoo/gentoo/pull/29097
+ append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+
+ local mycmakeargs=(
+ -DCMAKE_PREFIX_PATH="$(get_llvm_prefix "${LLVM_MAX_SLOT}")"
+ -DCMAKE_BUILD_TYPE=${buildtype}
+ -DCMAKE_SKIP_RPATH=ON
+ -DHIP_PLATFORM=amd
+ -DHIP_COMMON_DIR="${WORKDIR}/HIP-rocm-${PV}"
+ -DROCM_PATH="${EPREFIX}/usr"
+ -DUSE_PROF_API=0
+ -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF
+ -DCLR_BUILD_HIP=ON
+ -DHIPCC_BIN_DIR="${EPREFIX}/usr/bin"
+ -DOpenGL_GL_PREFERENCE="GLVND"
+ )
+
+ cmake_src_configure
+
+ if use test; then
+ local mycmakeargs=(
+ -DROCM_PATH="${BUILD_DIR}"/hipamd
+ -DHIP_PLATFORM=amd
+ -DCMAKE_MODULE_PATH="${TEST_S}/external/Catch2/cmake/Catch2"
+ )
+ HIP_PATH="${EPREFIX}/usr" hip_test_wrapper cmake_src_configure
+ fi
+}
+
+src_compile() {
+ cmake_src_compile
+
+ if use test; then
+ HIP_PATH="${BUILD_DIR}"/hipamd \
+ hip_test_wrapper cmake_src_compile build_tests
+ fi
+}
+
+src_test() {
+ check_amdgpu
+ export LD_LIBRARY_PATH="${BUILD_DIR}/hipamd/lib"
+
+ # TODO: research how to test Vulkan-related features.
+ local CMAKE_SKIP_TESTS=(
+ Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Positive_Read_Write
+ Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Negative_Parameters
+ Unit_hipImportExternalMemory_Vulkan_Negative_Parameters
+ Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore
+ Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores
+ Unit_hipWaitExternalSemaphoresAsync_Vulkan_Negative_Parameters
+ Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore
+ Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores
+ Unit_hipSignalExternalSemaphoresAsync_Vulkan_Negative_Parameters
+ Unit_hipImportExternalSemaphore_Vulkan_Negative_Parameters
+ Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters
+ )
+
+ MAKEOPTS="-j1" hip_test_wrapper cmake_src_test
+}
diff --git a/dev-util/hip/metadata.xml b/dev-util/hip/metadata.xml
index 610dcac57121..0d035a139560 100644
--- a/dev-util/hip/metadata.xml
+++ b/dev-util/hip/metadata.xml
@@ -22,6 +22,6 @@
<name>Sv. Lockal</name>
</maintainer>
<upstream>
- <remote-id type="github">ROCm-Developer-Tools/HIP</remote-id>
+ <remote-id type="github">ROCm/HIP</remote-id>
</upstream>
</pkgmetadata>