From d5ee59790ee8298b8599b0aa0fa21a98b972a44d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Jun 2024 08:00:51 +0100 Subject: gentoo auto-resync : 30:06:2024 - 08:00:50 --- dev-util/hip/Manifest | 3 - dev-util/hip/files/hip-6.0.2-install.patch | 23 -- ...p-6.1.0-extend-isa-compatibility-check-v2.patch | 35 --- .../hip-6.1.0-extend-isa-compatibility-check.patch | 236 --------------------- 4 files changed, 297 deletions(-) delete mode 100644 dev-util/hip/files/hip-6.0.2-install.patch delete mode 100644 dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check-v2.patch delete mode 100644 dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check.patch (limited to 'dev-util/hip') diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest index 9579ca8ea457..4014aa34e3fd 100644 --- a/dev-util/hip/Manifest +++ b/dev-util/hip/Manifest @@ -31,9 +31,6 @@ AUX hip-5.7.1-extend-isa-compatibility-check.patch 9039 BLAKE2B d1c80da9ca584aa4 AUX hip-5.7.1-fix-mmap-oom-check.patch 1317 BLAKE2B d1e9db74bb815cd9194b47688bb125630a8baf8c3df14e454b2f8c59303c136c6c69b7ca89fddabb2533bfa034c984d88ec276851daf2241d9abeda7f5a50f87 SHA512 b6a5d7b861fe4138c72f91b765df822cce00fda94d3b8b85c0a40c3697455b018256f37317adf714280aa387ebe5da14a092ab69e375e8a804f01243837f7b60 AUX hip-5.7.1-fix-unaligned-access.patch 3011 BLAKE2B d8a6a130edcf51c40e88250508ff3db13f134fb3833d1eadfac32dfdee09c7635091b1f32ed640bcba0c5ca2b745c401183ee8adaa392977ecece12a03450f9e SHA512 f9b85117927d18921d939daa73d2d97477bb49eb6ff7e496f9b110b8e70e00734b698517ae4235a03c560bdfc3618367d7eb2970c9d90dc2bcf07e2ab803d994 AUX hip-5.7.1-no_asan_doc.patch 817 BLAKE2B 4bc80470f9cb476289086ae561560bb54fcdd9d1e66ef420dc60f129f29b0de02025be0ed2a7bfd2143b9bc0b456a354abc574dcbff509872a35e2e0c06f7760 SHA512 10a97524acce0c45c8edeccd11b64445f6edeb380e8262e1fc63163c4758efd731af36701dae1c9988264e8ce10971c9b3959ea881e81646994c779a96d10bb9 -AUX hip-6.0.2-install.patch 993 BLAKE2B e54542801197ad33e3feee0896401acec60190e95ec09ede70b357f5af550255dc4f08e75279d21e3932d7be6b7e0c0b5cd86f8ca235f463135d42699855f4d9 SHA512 a3d772d60d3842a91796f32d8bad3289eee8f878bcedb6c064df43f514ed102729f8f7ed62fc1d8b3f73dd969e5368a86b847b0858d296da916ac424ef593059 -AUX hip-6.1.0-extend-isa-compatibility-check-v2.patch 1323 BLAKE2B 1af3ebf4c9c328a89a6b7440acd744955078b1a35c90d7476905417398e05848435776ba954184e37a943d2ff31d10aa3116ce00eed754574bf843a16cd0da1c SHA512 19c93c98ea3bc6fbff309ff02424355e482ea584266adf4322bd46d55a2f6f0196fd02eae843c08080d01a6afc1cf94e1bed3905881a67df9f3c3b0d8b17c464 -AUX hip-6.1.0-extend-isa-compatibility-check.patch 9037 BLAKE2B d9dceb54665816468971e8ee1ae9e749df48f60be0cd9a131259179f4b5cc8e465a27971906f2d990e73ad00f278e9736cba9941686ecb604ca8820e82e2ac94 SHA512 18bd5365774694619d8601dc6ed40517cc77f4dcdd124ef59f486416c4f6c08586adece94bd175ef33109744de84a11e78a34b4e07425a2616cbf68ef1c1bf49 AUX hip-6.1.0-install.patch 937 BLAKE2B a694b8d4fd433ed788e97df09ed26a58305944b63f1f88948b0ff47f9f60f96236bda072917d279d263d02059aaab0e3d2282feb0cee02a7da86e9f016a091f0 SHA512 62a38326021bb1b81a43cf26336528dd1cb30ac90d41c5a3ab9a2d8996090cb8677fc163d156785347f0cb893c84b7166b698b801e1d52449fdb3ee01e75483b AUX hip-6.1.1-fix-musl.patch 566 BLAKE2B ca84d7a1c38b6ae3e7dedbda8cafa0ad5bf31165c3a7b5af8a1a9714d871eeedb64bd6e6c71960e65ee3f7bed2bdf302d07e7c33e225102123d8516018391430 SHA512 e224e84b6eb4b43fd79e5172ad4882d1862d7a50fcb7ed60afc58148a399a96fafaf14477ed31d503f3ecb4c93ba2b58bdcad3c6dce7afab61ee7a8e60d3f65e AUX hip-test-5.7.0-rocm_agent_enumerator-location.patch 651 BLAKE2B 237ae5e71c9a6c565680c4fb07ece160f6bc635d25c77a20f3da54b92fcead95c0f6871f53a58a1e9b26b1d5fef3372ebc547638ba2fba43621c2867d276e75a SHA512 79d3cb277c41a84e6db70b28ad465067403f27d1f54adcbcd3e3501fc08c29f2aafc60fa2e6e78794eed95987352aa7ae844fbd55abc1abe0be8ff1879ed7d8f diff --git a/dev-util/hip/files/hip-6.0.2-install.patch b/dev-util/hip/files/hip-6.0.2-install.patch deleted file mode 100644 index e2fc3a8852cb..000000000000 --- a/dev-util/hip/files/hip-6.0.2-install.patch +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index d6e95c994c8f..000000000000 --- a/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check-v2.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e188c092a987c45caf2ea4651686ea631ca47c3d Mon Sep 17 00:00:00 2001 -From: Paul Zander -Date: Tue, 25 Jun 2024 15:22:33 +0200 -Subject: [PATCH] prepare usage of old patch - -Signed-off-by: Paul Zander ---- - 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 deleted file mode 100644 index 40ccf6fdc089..000000000000 --- a/dev-util/hip/files/hip-6.1.0-extend-isa-compatibility-check.patch +++ /dev/null @@ -1,236 +0,0 @@ -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 -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 compatibility_score(agent_triple_target_ids.size()); - - const auto obheader = reinterpret_cast(data); - const auto* desc = &obheader->desc[0]; -@@ -495,17 +572,19 @@ hipError_t CodeObject::extractCodeObjectFromFatBinary( - reinterpret_cast(reinterpret_cast(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 -+static bool Contains(const std::array& 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 gfx900_equivalent = { 0, 2, 9, 12 }; -+ const std::array 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 gfx1010_equivalent = { 0 }; -+ const std::array 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() && -- cgit v1.2.3