summaryrefslogtreecommitdiff
path: root/dev-util/hip/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-06-27 07:59:40 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-06-27 07:59:40 +0100
commitd2ed973482fdd800013658e83a61709b29e0a80f (patch)
tree57ea7666a57b5a05a4c8866e4915e90b4a6e7c94 /dev-util/hip/files
parent9f6a82a85d400d6ae7de04c43cee88dbc6bc4da0 (diff)
gentoo auto-resync : 27:06:2024 - 07:59:39
Diffstat (limited to 'dev-util/hip/files')
-rw-r--r--dev-util/hip/files/hip-5.1.3-0001-SWDEV-316128-HIP-surface-API-support.patch (renamed from dev-util/hip/files/0001-SWDEV-316128-HIP-surface-API-support.patch)0
-rw-r--r--dev-util/hip/files/hip-5.3.3-0001-SWDEV-352878-LLVM-pkg-search-directly-using-find_dep.patch (renamed from dev-util/hip/files/0001-SWDEV-352878-LLVM-pkg-search-directly-using-find_dep.patch)0
-rw-r--r--dev-util/hip/files/hip-5.3.3-0002-SWDEV-344620-hipcc-fails-to-parse-version-of-clang-i.patch (renamed from dev-util/hip/files/0001-SWDEV-344620-hipcc-fails-to-parse-version-of-clang-i.patch)0
-rw-r--r--dev-util/hip/files/hip-5.3.3-0003-SWDEV-355608-Remove-clang-include-path-2996.patch (renamed from dev-util/hip/files/0002-SWDEV-355608-Remove-clang-include-path-2996.patch)0
-rw-r--r--dev-util/hip/files/hip-5.3.3-0004-SWDEV-352878-Removed-relative-path-based-CLANG-inclu.patch (renamed from dev-util/hip/files/0003-SWDEV-352878-Removed-relative-path-based-CLANG-inclu.patch)0
-rw-r--r--dev-util/hip/files/hip-5.7.1-extend-isa-compatibility-check.patch6
-rw-r--r--dev-util/hip/files/hip-6.0.2-install.patch23
-rw-r--r--dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check-v2.patch35
-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.patch20
-rw-r--r--dev-util/hip/files/hip-6.1.1-fix-musl.patch24
-rw-r--r--dev-util/hip/files/hip-test-5.7.1-remove-incompatible-flag.patch28
-rw-r--r--dev-util/hip/files/hip-test-6.0.2-hipcc-system-install.patch43
-rw-r--r--dev-util/hip/files/hip-test-6.1.0-disable-hipKerArgOptimization.patch24
-rw-r--r--dev-util/hip/files/hip-test-6.1.1-fix-musl.patch159
15 files changed, 595 insertions, 3 deletions
diff --git a/dev-util/hip/files/0001-SWDEV-316128-HIP-surface-API-support.patch b/dev-util/hip/files/hip-5.1.3-0001-SWDEV-316128-HIP-surface-API-support.patch
index 14af91f9055b..14af91f9055b 100644
--- a/dev-util/hip/files/0001-SWDEV-316128-HIP-surface-API-support.patch
+++ b/dev-util/hip/files/hip-5.1.3-0001-SWDEV-316128-HIP-surface-API-support.patch
diff --git a/dev-util/hip/files/0001-SWDEV-352878-LLVM-pkg-search-directly-using-find_dep.patch b/dev-util/hip/files/hip-5.3.3-0001-SWDEV-352878-LLVM-pkg-search-directly-using-find_dep.patch
index 9dbfe8a55395..9dbfe8a55395 100644
--- a/dev-util/hip/files/0001-SWDEV-352878-LLVM-pkg-search-directly-using-find_dep.patch
+++ b/dev-util/hip/files/hip-5.3.3-0001-SWDEV-352878-LLVM-pkg-search-directly-using-find_dep.patch
diff --git a/dev-util/hip/files/0001-SWDEV-344620-hipcc-fails-to-parse-version-of-clang-i.patch b/dev-util/hip/files/hip-5.3.3-0002-SWDEV-344620-hipcc-fails-to-parse-version-of-clang-i.patch
index b9a1329e5931..b9a1329e5931 100644
--- a/dev-util/hip/files/0001-SWDEV-344620-hipcc-fails-to-parse-version-of-clang-i.patch
+++ b/dev-util/hip/files/hip-5.3.3-0002-SWDEV-344620-hipcc-fails-to-parse-version-of-clang-i.patch
diff --git a/dev-util/hip/files/0002-SWDEV-355608-Remove-clang-include-path-2996.patch b/dev-util/hip/files/hip-5.3.3-0003-SWDEV-355608-Remove-clang-include-path-2996.patch
index 6d64ad8c9fd8..6d64ad8c9fd8 100644
--- a/dev-util/hip/files/0002-SWDEV-355608-Remove-clang-include-path-2996.patch
+++ b/dev-util/hip/files/hip-5.3.3-0003-SWDEV-355608-Remove-clang-include-path-2996.patch
diff --git a/dev-util/hip/files/0003-SWDEV-352878-Removed-relative-path-based-CLANG-inclu.patch b/dev-util/hip/files/hip-5.3.3-0004-SWDEV-352878-Removed-relative-path-based-CLANG-inclu.patch
index f92cce4cf8d8..f92cce4cf8d8 100644
--- a/dev-util/hip/files/0003-SWDEV-352878-Removed-relative-path-based-CLANG-inclu.patch
+++ b/dev-util/hip/files/hip-5.3.3-0004-SWDEV-352878-Removed-relative-path-based-CLANG-inclu.patch
diff --git a/dev-util/hip/files/hip-5.7.1-extend-isa-compatibility-check.patch b/dev-util/hip/files/hip-5.7.1-extend-isa-compatibility-check.patch
index 7853de693cde..25bdfba07fd2 100644
--- a/dev-util/hip/files/hip-5.7.1-extend-isa-compatibility-check.patch
+++ b/dev-util/hip/files/hip-5.7.1-extend-isa-compatibility-check.patch
@@ -42,7 +42,7 @@ https://salsa.debian.org/rocm-team/rocm-hipamd/-/blob/master/debian/patches/0026
+}
+
+static bool isGfx1010EquivalentProcessor(const std::string& processor) {
-+ return matches(GfxPattern{"gfx101", "02"}, processor);
++ return matches(GfxPattern{"gfx101", "0"}, processor);
+}
+
+static bool isGfx1010SupersetProcessor(const std::string& processor) {
@@ -181,7 +181,7 @@ https://salsa.debian.org/rocm-team/rocm-hipamd/-/blob/master/debian/patches/0026
}
--- a/rocclr/device/device.cpp
+++ b/rocclr/device/device.cpp
-@@ -232,10 +232,49 @@ std::string Isa::isaName() const {
+@@ -234,10 +234,49 @@ std::string Isa::isaName() const {
return std::string(hsaIsaNamePrefix) + targetId();
}
@@ -211,7 +211,7 @@ https://salsa.debian.org/rocm-team/rocm-hipamd/-/blob/master/debian/patches/0026
+ }
+ } else if (codeObjectIsa.versionMajor() == 10) {
+ if (codeObjectIsa.versionMinor() == 1) {
-+ const std::array<uint32_t, 2> gfx1010_equivalent = { 0, 2 };
++ 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())) {
diff --git a/dev-util/hip/files/hip-6.0.2-install.patch b/dev-util/hip/files/hip-6.0.2-install.patch
new file mode 100644
index 000000000000..e2fc3a8852cb
--- /dev/null
+++ b/dev-util/hip/files/hip-6.0.2-install.patch
@@ -0,0 +1,23 @@
+diff --git a/hipamd/CMakeLists.txt b/hipamd/CMakeLists.txt
+index 7ad30019d..e79ea0714 100755
+--- a/hipamd/CMakeLists.txt
++++ b/hipamd/CMakeLists.txt
+@@ -398,18 +398,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)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)
+ endif()
+
+ #############################
diff --git a/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check-v2.patch b/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check-v2.patch
new file mode 100644
index 000000000000..d6e95c994c8f
--- /dev/null
+++ b/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check-v2.patch
@@ -0,0 +1,35 @@
+From e188c092a987c45caf2ea4651686ea631ca47c3d Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Tue, 25 Jun 2024 15:22:33 +0200
+Subject: [PATCH] prepare usage of old patch
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+---
+ hipamd/src/hip_code_object.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/hipamd/src/hip_code_object.cpp b/hipamd/src/hip_code_object.cpp
+index 6b3a6d0..fef89df 100644
+--- a/hipamd/src/hip_code_object.cpp
++++ b/hipamd/src/hip_code_object.cpp
+@@ -410,7 +410,7 @@ static bool isCodeObjectCompatibleWithDevice(std::string co_triple_target_id,
+ if (co_triple_target_id == agent_triple_target_id) return true;
+
+ // Parse code object triple target id
+- if (!consume(co_triple_target_id, std::string(kAmdgcnTargetTriple) + '-')) {
++ if (!consume(co_triple_target_id, std::string(AMDGCN_TARGET_TRIPLE) + '-')) {
+ return false;
+ }
+
+@@ -423,7 +423,7 @@ static bool isCodeObjectCompatibleWithDevice(std::string co_triple_target_id,
+ if (!co_triple_target_id.empty()) return false;
+
+ // Parse agent isa triple target id
+- if (!consume(agent_triple_target_id, std::string(kAmdgcnTargetTriple) + '-')) {
++ if (!consume(agent_triple_target_id, std::string(AMDGCN_TARGET_TRIPLE) + '-')) {
+ return false;
+ }
+
+--
+2.45.2
+
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..416663f6ea48
--- /dev/null
+++ b/dev-util/hip/files/hip-6.1.0-install.patch
@@ -0,0 +1,20 @@
+These files already installed by hipcc, which is a runtime dep
+--- a/hipamd/CMakeLists.txt
++++ b/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) \ No newline at end of file
diff --git a/dev-util/hip/files/hip-6.1.1-fix-musl.patch b/dev-util/hip/files/hip-6.1.1-fix-musl.patch
new file mode 100644
index 000000000000..424cd0dde119
--- /dev/null
+++ b/dev-util/hip/files/hip-6.1.1-fix-musl.patch
@@ -0,0 +1,24 @@
+Fix "basename" and "__cpu_mask" definitions for musl
+
+Upstream PR: https://github.com/ROCm/clr/pull/83
+--- a/rocclr/os/os.hpp
++++ b/rocclr/os/os.hpp
+@@ -29,6 +29,7 @@
+
+ #if defined(__linux__)
+ #include <sched.h>
++#include <libgen.h>
+ #endif
+
+ #ifdef _WIN32
+@@ -377,6 +378,10 @@ ALWAYSINLINE address Os::currentStackPtr() {
+
+ #if defined(__linux__)
+
++#ifndef __GLIBC__
++typedef unsigned long int __cpu_mask;
++#endif
++
+ inline void Os::ThreadAffinityMask::init() { CPU_ZERO(&mask_); }
+
+ inline void Os::ThreadAffinityMask::set(uint cpu) { CPU_SET(cpu, &mask_); }
diff --git a/dev-util/hip/files/hip-test-5.7.1-remove-incompatible-flag.patch b/dev-util/hip/files/hip-test-5.7.1-remove-incompatible-flag.patch
new file mode 100644
index 000000000000..02aa12f1fe42
--- /dev/null
+++ b/dev-util/hip/files/hip-test-5.7.1-remove-incompatible-flag.patch
@@ -0,0 +1,28 @@
+https://github.com/ROCm/hip-tests/pull/443
+
+From cb0140843a162f69c454e91cd994524423b39b8c Mon Sep 17 00:00:00 2001
+From: Yiyang Wu <xgreenlandforwyy@gmail.com>
+Date: Sun, 10 Dec 2023 21:57:14 +0800
+Subject: [PATCH] -fallow-half-arguments-and-returns is not recognized by clang
+
+Reference: https://reviews.llvm.org/D145345
+Issue: https://github.com/ROCm/HIP/issues/3178
+Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
+---
+ catch/unit/deviceLib/CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/catch/unit/deviceLib/CMakeLists.txt b/catch/unit/deviceLib/CMakeLists.txt
+index 0645def..3662cbd 100644
+--- catch/unit/deviceLib/CMakeLists.txt
++++ catch/unit/deviceLib/CMakeLists.txt
+@@ -171,7 +171,6 @@ if(${ARCH_CHECK} GREATER_EQUAL 0)
+ set_source_files_properties(unsafeAtomicAdd_NonCoherent_withunsafeflag.cc PROPERTIES COMPILE_OPTIONS "-munsafe-fp-atomics")
+ set_source_files_properties(unsafeAtomicAdd_Coherent_withnounsafeflag.cc PROPERTIES COMPILE_OPTIONS "-mno-unsafe-fp-atomics")
+ set_source_files_properties(unsafeAtomicAdd_NonCoherent_withnounsafeflag.cc PROPERTIES COMPILE_OPTIONS "-mno-unsafe-fp-atomics")
+- set_source_files_properties(hipMathFunctions.cc PROPERTIES COMPILE_FLAGS "-Xclang -fallow-half-arguments-and-returns")
+ file(GLOB AtomicAdd_files *AtomicAdd_*_*.cc)
+ set_property(SOURCE ${AtomicAdd_files} PROPERTY COMPILE_FLAGS --save-temps)
+ file(GLOB unsafeAtomicAdd_files *unsafeAtomicAdd_*_*.cc)
+--
+2.42.0
diff --git a/dev-util/hip/files/hip-test-6.0.2-hipcc-system-install.patch b/dev-util/hip/files/hip-test-6.0.2-hipcc-system-install.patch
new file mode 100644
index 000000000000..bf143939d13e
--- /dev/null
+++ b/dev-util/hip/files/hip-test-6.0.2-hipcc-system-install.patch
@@ -0,0 +1,43 @@
+In Gentoo rocm_agent_enumerator is installed by rocminfo and is in PATH.
+
+Index: catch/CMakeLists.txt
+===================================================================
+--- catch.orig/CMakeLists.txt
++++ catch/CMakeLists.txt
+@@ -55,9 +55,9 @@ endif()
+ message(STATUS "HIP_PATH: ${HIP_PATH}")
+ message(STATUS "ROCM_PATH: ${ROCM_PATH}")
+
+-set(CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc${EXT}")
+-set(CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc${EXT}")
+-set(HIPCONFIG_EXECUTABLE "${HIP_PATH}/bin/hipconfig${EXT}")
++set(CMAKE_CXX_COMPILER "hipcc${EXT}")
++set(CMAKE_C_COMPILER "hipcc${EXT}")
++set(HIPCONFIG_EXECUTABLE "hipconfig${EXT}")
+ execute_process(COMMAND ${HIPCONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE HIP_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+@@ -183,9 +183,8 @@ message(STATUS "CMAKE HIP ARCHITECTURES:
+ # OFFLOAD_ARCH_STR
+ # rocm_agent_enumerator
+ if(NOT DEFINED OFFLOAD_ARCH_STR
+- AND EXISTS "${ROCM_PATH}/bin/rocm_agent_enumerator"
+ AND HIP_PLATFORM STREQUAL "amd" AND UNIX)
+- execute_process(COMMAND "${ROCM_PATH}/bin/rocm_agent_enumerator"
++ execute_process(COMMAND "rocm_agent_enumerator"
+ OUTPUT_VARIABLE HIP_GPU_ARCH
+ RESULT_VARIABLE ROCM_AGENT_ENUM_RESULT
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+Index: catch/hipTestMain/hip_test_context.cc
+===================================================================
+--- catch.orig/hipTestMain/hip_test_context.cc
++++ catch/hipTestMain/hip_test_context.cc
+@@ -37,7 +37,7 @@ std::string TestContext::substringFound(
+
+ std::string TestContext::getCurrentArch() {
+ #if HT_LINUX
+- const char* cmd = "/opt/rocm/bin/rocm_agent_enumerator | sort -u | xargs | sed -e 's/ /;/g'";
++ const char* cmd = "rocm_agent_enumerator | sort -u | xargs | sed -e 's/ /;/g'";
+ std::array<char, 1024> buffer;
+ std::string result;
+ std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);
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/files/hip-test-6.1.1-fix-musl.patch b/dev-util/hip/files/hip-test-6.1.1-fix-musl.patch
new file mode 100644
index 000000000000..c3f3e45efe4d
--- /dev/null
+++ b/dev-util/hip/files/hip-test-6.1.1-fix-musl.patch
@@ -0,0 +1,159 @@
+Fix musl errors:
+* reinterpret_cast from 'std::nullptr_t' to 'void **' is not allowed
+* error.h is GNU extension
+
+Upstream PR: https://github.com/ROCm/hip-tests/pull/463
+--- a/unit/rtc/headers/printf_common.h
++++ b/unit/rtc/headers/printf_common.h
+@@ -30,7 +30,6 @@ THE SOFTWARE.
+ #if defined(_WIN32)
+ #include <io.h>
+ #else
+-#include <error.h>
+ #include <unistd.h>
+ #endif
+
+@@ -110,7 +109,7 @@ struct CaptureStream {
+ saved_fd = dup(orig_fd);
+
+ if ((temp_fd = mkstemp(tempname)) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -118,11 +117,11 @@ struct CaptureStream {
+ void Begin() {
+ fflush(nullptr);
+ if (dup2(temp_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(temp_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -130,11 +129,11 @@ struct CaptureStream {
+ void End() {
+ fflush(nullptr);
+ if (dup2(saved_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(saved_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -148,7 +147,7 @@ struct CaptureStream {
+
+ ~CaptureStream() {
+ if (remove(tempname) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+--- a/unit/memory/hipMemRangeGetAttributes_old.cc
++++ b/unit/memory/hipMemRangeGetAttributes_old.cc
+@@ -268,7 +268,7 @@ TEST_CASE("Unit_hipMemRangeGetAttributes_NegativeTst") {
+ // Passing NULL as first parameter
+ SECTION("Passing NULL as first parameter") {
+ if (!CheckError(hipMemRangeGetAttributes(
+- reinterpret_cast<void**>(NULL),
++ static_cast<void**>(NULL),
+ reinterpret_cast<size_t*>(dataSizes),
+ AttrArr, 4, Hmm, MEM_SIZE),
+ __LINE__)) {
+--- a/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor_old.cc
++++ b/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor_old.cc
+@@ -40,7 +40,7 @@ TEST_CASE("Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Negative") {
+ ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(NULL, f1, blockSize, 0);
+ REQUIRE(ret != hipSuccess);
+
+- ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, NULL, blockSize, 0);
++ ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, static_cast<void*>(NULL), blockSize, 0);
+ REQUIRE(ret != hipSuccess);
+
+ ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, f1, 0, 0);
+--- a/unit/occupancy/hipOccupancyMaxPotentialBlockSize_old.cc
++++ b/unit/occupancy/hipOccupancyMaxPotentialBlockSize_old.cc
+@@ -37,7 +37,7 @@ TEST_CASE("Unit_hipOccupancyMaxPotentialBlockSize_Negative") {
+
+ #ifndef __HIP_PLATFORM_NVIDIA__
+ // nvcc doesnt support kernelfunc(NULL) for api
+- ret = hipOccupancyMaxPotentialBlockSize(&gridSize, &blockSize, NULL, 0, 0);
++ ret = hipOccupancyMaxPotentialBlockSize(&gridSize, &blockSize, static_cast<void*>(NULL), 0, 0);
+ REQUIRE(ret != hipSuccess);
+ #endif
+ }
+--- a/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor.cc
++++ b/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor.cc
+@@ -48,7 +48,7 @@ TEST_CASE("Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Negative_Parameters
+ blockSize);
+
+ SECTION("Kernel function is NULL") {
+- HIP_CHECK_ERROR(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, NULL, blockSize, 0),
++ HIP_CHECK_ERROR(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, static_cast<void*>(NULL), blockSize, 0),
+ hipErrorInvalidDeviceFunction);
+ }
+ }
+--- a/unit/kernel/printf_common.h
++++ b/unit/kernel/printf_common.h
+@@ -24,7 +24,6 @@ THE SOFTWARE.
+ #define _STRESSTEST_PRINTF_COMMON_H_
+
+ #include <errno.h>
+-#include <error.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+@@ -47,17 +46,17 @@ struct CaptureStream {
+ saved_fd = dup(orig_fd);
+
+ if ((temp_fd = mkstemp(tempname)) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+
+ fflush(nullptr);
+ if (dup2(temp_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(temp_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }
+@@ -67,11 +66,11 @@ struct CaptureStream {
+ return;
+ fflush(nullptr);
+ if (dup2(saved_fd, orig_fd) == -1) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ if (close(saved_fd) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ saved_fd = -1;
+@@ -90,7 +89,7 @@ struct CaptureStream {
+ ~CaptureStream() {
+ restoreStream();
+ if (remove(tempname) != 0) {
+- error(0, errno, "Error");
++ fprintf(stderr, "Error: %s\n", strerror(errno));
+ assert(false);
+ }
+ }