diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-12-14 20:44:04 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-12-14 20:44:04 +0000 |
commit | 46227d4bea72a4d588141f40667699df3aeef2b0 (patch) | |
tree | fe9f107ad101a24dfb24866d1ae2a933f9f8bbe8 /dev-util/hip | |
parent | 349911d45bc38140a6a32c0971e0ab5cdc4de9ac (diff) |
gentoo auto-resync : 14:12:2023 - 20:44:04
Diffstat (limited to 'dev-util/hip')
-rw-r--r-- | dev-util/hip/Manifest | 5 | ||||
-rw-r--r-- | dev-util/hip/files/hip-5.7.1-extend-isa-compatibility-check.patch | 236 | ||||
-rw-r--r-- | dev-util/hip/files/hip-test-5.7.0-rocm_agent_enumerator-location.patch | 15 | ||||
-rw-r--r-- | dev-util/hip/hip-5.7.1-r1.ebuild | 81 |
4 files changed, 327 insertions, 10 deletions
diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest index ad86af86a5b8..18aae237232d 100644 --- a/dev-util/hip/Manifest +++ b/dev-util/hip/Manifest @@ -27,8 +27,10 @@ AUX hip-5.5.1-disable-Werror.patch 748 BLAKE2B 965af2240c72e22706c5b1ecb414954ba AUX hip-5.7.0-install.patch 576 BLAKE2B b3c5437a81bcc901327ba4ee9419ad77ea94aab3f6df49c1ce581fd5dad9321d7ffe4d81e1991476978690811d748ee8600dbdf9d70151cfdfb348130e18efdc SHA512 28301e939b3dc49c47d5db16d11b580dbedd47796a2765afab2b535fcd005d4a909f54865f044f0bacb0470ca2e29e529d1511c8bf4d037987bc046704e8e9eb AUX hip-5.7.1-disable-stack-protector.patch 771 BLAKE2B 46ea4b48ae32c7e120418fec467fedc7c496fec2c0589c04e4b62a0afe9b7e6b6e9aae8a4502d5772eefc07c5f71d39b37e4a47d1796d7688b1804814a0274da SHA512 30b82c3b8e7403e8098d1d564c94a85cd29fbf0d6fb4d4af26874bbc5ed03477933fb61064d57c2e2c724182b4816598752b38b1bb9f9384685be72a774d81af AUX hip-5.7.1-exec-stack.patch 1136 BLAKE2B b45560c1cd3410ba9340d5dea7fc2ab7167126a3dbcee6fdaa5ccdab6140db8a6ce9c9f588451f77a1cd27154551a4cb00743d7b2ac3dcb6c36e87f2bc182fe1 SHA512 66a6a9518975a9702f365ae6e9b09835ff93cde49209714b4cbb19c375052859ac26f3d4d2b61052280eee93e237f930a4b7b2d837245a7d477e30893ca6a0b4 +AUX hip-5.7.1-extend-isa-compatibility-check.patch 9043 BLAKE2B 8effc992b0d3478939fed4b003b4cbc1ef09ca1f59792f46d4c5c9253ac1a4d9a32357294b15c50e9c0dc867ebf284fe1823f3c7d829097c69d6633ff2027adc SHA512 ccab928a25089e6f9260dcdda665258fb71b6aefaae444ea25274475b3d668785b5bf4396ca4fbefb1471c06115b139b13f0af4d9b1f76e66821d585e7c8b781 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-test-5.7.0-rocm_agent_enumerator-location.patch 651 BLAKE2B 237ae5e71c9a6c565680c4fb07ece160f6bc635d25c77a20f3da54b92fcead95c0f6871f53a58a1e9b26b1d5fef3372ebc547638ba2fba43621c2867d276e75a SHA512 79d3cb277c41a84e6db70b28ad465067403f27d1f54adcbcd3e3501fc08c29f2aafc60fa2e6e78794eed95987352aa7ae844fbd55abc1abe0be8ff1879ed7d8f AUX hipvars-5.1.3.pm 629 BLAKE2B 6149f230aa0756603ac0b455d802db9c698be8e4a22367e98915db974ea16176f85f9b5a22e2572183641734cedbbe2ba2c826aa0223ea3e12c5550983db0480 SHA512 26ba459b13df1ad6dc50411ac6589dd3d17eff727fee0e938275912e36459c7a43b35233a7f78bbed282a992e969d8b8f95007964c810a5954b0abeccc67082d AUX hipvars-5.3.3.pm 581 BLAKE2B edf0c1df5f7f5c57189c76fbcedec8155072a9f8e2c580d637dcfb557a844e7cc276b754d0fd8f5a9f59d2c5bbcfda6c9ac9951ad16d8a12bb48e74f062987ab SHA512 9fd72b000f59ec25a74ef5965f4affc5e866025424211b4d81fbea979ffba9f08319dde0063c8c835507a1b9db990f8f25eea3a8e2e6d88faceaf34d5dd722cb AUX hipvars.pm 598 BLAKE2B 1645b12179195b95757d207248c85b7c8d9eda0347caee5cb48bdc66e85fda517f607bcb69cdfc63657a0db04ad8e96494a0a80268df7c17d6bb0e689325c2e8 SHA512 6c4e71455341673a329b4b0163fefd7f2f4b7d62da3496643d0de096755899c99b3b5a80fffbdf29896c234cb4f617b368217f4eecfd005849b294ff434b79c6 @@ -40,6 +42,7 @@ DIST rocclr-5.1.3.tar.gz 618606 BLAKE2B 02b7732ddd03c0883bee49c56466cd21c649159f DIST rocclr-5.3.3.tar.gz 625944 BLAKE2B 0cdbc1415a355e1d56628834846aaa8587c9827eeea59f4312b788e868265dcb42197181fd5ef411416da2e11662c7f665f578aa750ab88c3a5405bcc58ee449 SHA512 3f85532cffc09c2ca8e7cd1770263d1c1a38633ed2bc5cfe62072e12a6f8f669db400519950718be31f6b77693d372e2ef905f06c7f02e126aa9ff7d2da97924 DIST rocclr-5.4.3.tar.gz 640557 BLAKE2B 9ab91bab7ffb06c9c0d1c2ae79533fccc597071dda289ac375e32eb2965c638a7029951d2a49d46eeead9d7d242fe3a0cedb3e444d877af1bbf0e2d801c91e11 SHA512 c1d1a2ca08c2d762a221c04d394469aa7aff46086151333b145e0db9a7c7eb3dbbf8b9693e50d816aa9a13c16b4ebacf5ff3d5d8ff3393a8a764728ef5172d3a DIST rocclr-5.5.1.tar.gz 634330 BLAKE2B e6383a6b6b09f274a944d66effd345e38a191ec73ee5c5240f8ec8bb62a4df97b80835ce57f8f78c3834602b9da425b49289b5c7cd7e4c7071147ff409c6a6c9 SHA512 4c12011d22a4f14d9e93250b2a38716eb973139afa1adbbbd51c0e0ed13c0b7c1f45a37c71ef937c5fdabf09e928d7913ca3332fc61b7a2c10d21421306a228f +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-hip-5.1.3.tar.gz 967696 BLAKE2B 15cb52b5934b84acf515fe9c83b7c8982e00a23e20af933bdd2c4bc5b56fd42b08c8a08e840c85d2e0a8386d5a0e9c110504f68499989de1aaad00e9a5efcf43 SHA512 6b6fd6c12d73788df1711b12326b97fc7a184f319e0db114947b7967b75f2ee131f81e42e43a4981456b507221a6013133731120409f90214e13304299ccbc24 DIST rocm-hip-5.3.3.tar.gz 1151858 BLAKE2B 5f460b2078c850b3eb4414fcec4a6f951a3b282aa9828f77ba5d5adfdc0ee8d2e62c856e112a154c340daaf7dad49f4871412edd7b38f7fae2e6b17840ee144b SHA512 e747cc10e78cd09009cac762f0e060be13f3447af7ec2a4a2889cbdc09cd76ecb1b5b58c89f09a3b45a8296c2c71e1c55baf113e58a5a12434af3de7168b8d87 @@ -58,5 +61,5 @@ EBUILD hip-5.1.3-r4.ebuild 6638 BLAKE2B 4ccc536736e737f0066ab4f200a5ea76a9f16ede EBUILD hip-5.3.3-r3.ebuild 5346 BLAKE2B 4f5c0570e8a4ff65ac0b11bc555e2f81f7c6e56cc3ff86de894536b3b0597c049216a9d4184e25471999c4cf73b8f774daf1bb46d613c830bcc0d8c445f85b74 SHA512 9a54281155f14f467286d132ec405b90703b94760b8f4e268aed77b4a47d8a195febef3200068d0e5905cf7078fb92e2252b6ab7a3b86e40d330449315c0cf4d EBUILD hip-5.4.3.ebuild 5239 BLAKE2B 74d5423c5f7c01f15c5583b2c53420b1780fa7fdb11581fef2f0570be11a2047a43881a13b41b333905faaafab7dee15e1fb4af96703829cdab7d547e2cb5796 SHA512 7b2f5abfbc2ded1751b3d32349eb81715468125e9a9cc64522b725ed9a92f0dbf6e575fd1b84ab5234532badbf3a6b0c4d3a5b375384665ab413b22c54a5ee3e EBUILD hip-5.5.1.ebuild 5244 BLAKE2B aa1f937c5f2651ad3e79898ffc427696253c619583cd1450f1a3e7b9a7448e0d750f5df72a87458dfe6107f2f8846bc2b9b064d54b0b849fc3812a4f268c4af1 SHA512 94cad30f1f0e3e376a5902c83a151d3fe2a7b72b45747672e96b9d13dedadc7184c8f714789ff3e436133ffb8a7d58e8194471c843c694d3d39c348fd7d5a3ab -EBUILD hip-5.7.1-r1.ebuild 2299 BLAKE2B 6f6419e5f7c38dbb0a11f897bb84ce198c9e31ce5e6076f98a2fb32eaab73e60c14a3ef610ae961d033c22b507db78347bb8c3cedc5026d4c26a50fa7c6dcba6 SHA512 fce62dad1b19269ee9efa89d1c1552f89987c3587a0eaf332dedc2bc03726da59710c8e0372bf527573ea2d3ab752347c64072b73fcd727d4ad9cf58631e3fc8 +EBUILD hip-5.7.1-r1.ebuild 4404 BLAKE2B 2ef6d7970468cf4414f96e04ca593ce1cb8eb2f2e33935da7d749822830e7d522a0fdd8c1ef3b19dab44be32652f71dc91ed02b6c7bd5c9639fc8baeadbd4140 SHA512 ea8b90b0d6dd65b493d19b0fedd6be09ec9c5404b44d168777731abec99de4dbcb3e7b8fa007a60acddde36a3a972cac9d107b4a88811142a882671affeee3ba MISC metadata.xml 729 BLAKE2B 92e36c42f6d8335e5a8e3a86b591ff9e6306e0d187644620fab7f8f7ddd00156ee91ff49184ffbe379e509f2096c51c421575a69de7abea3c0b372fdcec52ccb SHA512 84fc8234a5fdf54bf43228c2144d809a461862fb45fea24bf366ee5937df3882c3332429938792981e37dbb4cda6e5d7e05ac5deaded34d8bcce1eb53df8d0fd 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 new file mode 100644 index 000000000000..7853de693cde --- /dev/null +++ b/dev-util/hip/files/hip-5.7.1-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", "02"}, 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(AMDGCN_TARGET_TRIPLE) + '-')) { +- 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(AMDGCN_TARGET_TRIPLE) + '-')) { +- 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, 2> gfx1010_equivalent = { 0, 2 }; ++ 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-test-5.7.0-rocm_agent_enumerator-location.patch b/dev-util/hip/files/hip-test-5.7.0-rocm_agent_enumerator-location.patch new file mode 100644 index 000000000000..1d967212ac9a --- /dev/null +++ b/dev-util/hip/files/hip-test-5.7.0-rocm_agent_enumerator-location.patch @@ -0,0 +1,15 @@ +In Gentoo rocm_agent_enumerator is installed by rocminfo and is in PATH. + +--- catch/CMakeLists.txt~ 2023-11-18 13:56:08.000000000 +0800 ++++ catch/CMakeLists.txt 2023-11-18 13:59:28.136170638 +0800 +@@ -182,9 +182,8 @@ + # rocm_agent_enumerator + if(NOT DEFINED OFFLOAD_ARCH_STR + AND NOT DEFINED ENV{HCC_AMDGPU_TARGET} +- 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) + # Trim out gfx000 diff --git a/dev-util/hip/hip-5.7.1-r1.ebuild b/dev-util/hip/hip-5.7.1-r1.ebuild index c9094afe5ba6..7b1a593f23e5 100644 --- a/dev-util/hip/hip-5.7.1-r1.ebuild +++ b/dev-util/hip/hip-5.7.1-r1.ebuild @@ -5,27 +5,33 @@ EAPI=8 DOCS_BUILDER="doxygen" DOCS_DEPEND="media-gfx/graphviz" +ROCM_SKIP_GLOBALS=1 -inherit cmake docs llvm +inherit cmake docs llvm rocm LLVM_MAX_SLOT=17 +TEST_PV=5.7.0 # No hip-test-5.7.1 release + DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability" HOMEPAGE="https://github.com/ROCm-Developer-Tools/hipamd" SRC_URI="https://github.com/ROCm-Developer-Tools/clr/archive/refs/tags/rocm-${PV}.tar.gz -> rocm-clr-${PV}.tar.gz - https://github.com/ROCm-Developer-Tools/HIP/archive/refs/tags/rocm-${PV}.tar.gz -> hip-${PV}.tar.gz" + https://github.com/ROCm-Developer-Tools/HIP/archive/refs/tags/rocm-${PV}.tar.gz -> hip-${PV}.tar.gz + test? ( https://github.com/ROCm-Developer-Tools/hip-tests/archive/refs/tags/rocm-${TEST_PV}.tar.gz )" KEYWORDS="~amd64" LICENSE="MIT" SLOT="0/$(ver_cut 1-2)" -IUSE="debug" +RESTRICT="!test? ( test )" +IUSE="debug test" DEPEND=" dev-util/hipcc >=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 " @@ -40,22 +46,44 @@ PATCHES=( "${FILESDIR}/${PN}-5.7.1-exec-stack.patch" "${FILESDIR}/${PN}-5.7.1-disable-stack-protector.patch" "${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch" + "${FILESDIR}/${PN}-5.7.1-extend-isa-compatibility-check.patch" ) S="${WORKDIR}/clr-rocm-${PV}/" +hip_test_wrapper() { + local S="${WORKDIR}/hip-tests-rocm-${TEST_PV}/catch" + local CMAKE_USE_DIR="${S}" + local BUILD_DIR="${S}_build" + cd "${S}" || die + $@ +} + +src_prepare() { + # hipamd is itself built by cmake, and should never provide a + # FindHIP.cmake module. + rm -r "${WORKDIR}"/HIP-rocm-${PV}/cmake/FindHIP* || die + + # https://github.com/ROCm-Developer-Tools/HIP/commit/405d029422ba8bb6be5a233d5eebedd2ad2e8bd3 + # https://github.com/ROCm-Developer-Tools/clr/commit/ab6d34ae773f4d151e04170c0f4e46c1135ddf3e + # Migrated to hip-test, but somehow the change is not applied to the tarball. + rm -rf "${WORKDIR}"/HIP-rocm-${PV}/tests || die + sed -e '/tests.*cmake/d' -i hipamd/CMakeLists.txt || die + + cmake_src_prepare + + if use test; then + PATCHES=${FILESDIR}/hip-test-5.7.0-rocm_agent_enumerator-location.patch \ + hip_test_wrapper cmake_src_prepare + fi +} + src_configure() { use debug && CMAKE_BUILD_TYPE="Debug" - # TODO: Currently a GENTOO configuration is build, - # this is also used in the cmake configuration files - # which will be installed to find HIP; - # Other ROCm packages expect a "RELEASE" configuration, - # see "hipBLAS" local mycmakeargs=( -DCMAKE_PREFIX_PATH="$(get_llvm_prefix "${LLVM_MAX_SLOT}")" -DCMAKE_BUILD_TYPE=${buildtype} - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" -DCMAKE_SKIP_RPATH=ON -DBUILD_HIPIFY_CLANG=OFF -DHIP_PLATFORM=amd @@ -69,10 +97,45 @@ src_configure() { ) cmake_src_configure + + if use test; then + local mycmakeargs=( + -DROCM_PATH="${BUILD_DIR}"/hipamd + -DHIP_PLATFORM=amd + ) + 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 } src_install() { |