diff options
Diffstat (limited to 'dev-util')
6 files changed, 0 insertions, 483 deletions
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 <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 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 <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/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch b/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch deleted file mode 100644 index 5d0b2ed284bd..000000000000 --- a/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch +++ /dev/null @@ -1,50 +0,0 @@ -/sys/module/amdgpu instead of lsmod for builtin amdgpu kernel module - -https://github.com/RadeonOpenCompute/rocminfo/pull/43 -https://github.com/RadeonOpenCompute/rocminfo/issues/42 -From ea4f017ed035928b1970e2589b02ec9b348c863e Mon Sep 17 00:00:00 2001 -From: YiyangWu <xgreenlandforwyy@gmail.com> -Date: Wed, 18 Aug 2021 21:05:20 +0800 -Subject: [PATCH] Check /sys/module/amdgpu for ROCk instead of lsmod - -Closes: #42 - -Signed-off-by: YiyangWu <xgreenlandforwyy@gmail.com> ---- - rocminfo.cc | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/rocminfo.cc b/rocminfo.cc -index 871f406..58c847d 100755 ---- a/rocminfo.cc -+++ b/rocminfo.cc -@@ -995,6 +995,8 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { - err = AcquireAgentInfo(agent, &agent_i); - RET_IF_HSA_ERR(err); - -+ std::string ind(kIndentSize, ' '); -+ - printLabel("*******", true); - std::string agent_ind("Agent "); - agent_ind += std::to_string(*agent_number).c_str(); -@@ -1031,16 +1033,16 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { - - int CheckInitialState(void) { - // Check kernel module for ROCk is loaded -- FILE *fd = popen("lsmod | grep amdgpu", "r"); -- char buf[16]; -- if (fread (buf, 1, sizeof (buf), fd) == 0) { -+ int module_dir; -+ module_dir = open("/sys/module/amdgpu", O_DIRECTORY); -+ if (module_dir < 0) { - printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", - COL_RED, COL_RESET); - return -1; - } else { - printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); -+ close(module_dir); - } -- pclose(fd); - - // Check if user belongs to the group for /dev/kfd (e.g. "video" or - // "render") diff --git a/dev-util/rocminfo/files/rocminfo-5.5.1-detect-builtin-amdgpu.patch b/dev-util/rocminfo/files/rocminfo-5.5.1-detect-builtin-amdgpu.patch deleted file mode 100644 index dd1aefe4df4f..000000000000 --- a/dev-util/rocminfo/files/rocminfo-5.5.1-detect-builtin-amdgpu.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 3a4d533a1e2a179ad873c480dc4a42ea23681263 Mon Sep 17 00:00:00 2001 -From: Mike Li <Tianxinmike.Li@amd.com> -Date: Wed, 17 Aug 2022 11:44:09 -0400 -Subject: [PATCH 1/2] Check permission and handle PermissionError exception - -Signed-off-by: Mike Li <Tianxinmike.Li@amd.com> -Change-Id: If7cb8464d0b761e4be45c85eb7147ceed609da61 ---- - rocm_agent_enumerator | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator -index 6264a5f..ceb9e11 100755 ---- a/rocm_agent_enumerator -+++ b/rocm_agent_enumerator -@@ -195,10 +195,15 @@ def readFromKFD(): - node_path = os.path.join(topology_dir, node) - if os.path.isdir(node_path): - prop_path = node_path + '/properties' -- if os.path.isfile(prop_path): -+ if os.path.isfile(prop_path) and os.access(prop_path, os.R_OK): - target_search_term = re.compile("gfx_target_version.+") - with open(prop_path) as f: -- line = f.readline() -+ try: -+ line = f.readline() -+ except PermissionError: -+ # We may have a subsystem (e.g. scheduler) limiting device visibility which -+ # could cause a permission error. -+ line = '' - while line != '' : - search_result = target_search_term.search(line) - if search_result is not None: - -From 94b4b3f0a66eb70912177ca7076b4267f8b5449b Mon Sep 17 00:00:00 2001 -From: Johannes Dieterich <johannes.dieterich@amd.com> -Date: Mon, 21 Nov 2022 18:09:55 +0000 -Subject: [PATCH 2/2] Fix rocminfo when run within docker environments - -Currently, rocminfo will fail when executed inside a docker container -due to being unable to lsmod inside docker. This has impacts on -rocprofiler use. - -Fix this behavior by querying initstate of the amdgpu module from -/sys/module/amdgpu instead. If initstate is marked "live" everything if -fine - error out with either "not loaded" (initstate file does not -exist) or "not live" (initstate file does not contain "live" string). - -Change-Id: I6f2e9655942fd4cf840fd3f56b7d69e893fa84d7 ---- - rocminfo.cc | 30 ++++++++++++++++++++++++------ - 1 file changed, 24 insertions(+), 6 deletions(-) - -diff --git a/rocminfo.cc b/rocminfo.cc -index 0842d57..8ed9111 100755 ---- a/rocminfo.cc -+++ b/rocminfo.cc -@@ -51,6 +51,7 @@ - #include <unistd.h> - #include <pwd.h> - -+#include <fstream> - #include <vector> - #include <string> - #include <sstream> -@@ -1039,16 +1040,33 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { - - int CheckInitialState(void) { - // Check kernel module for ROCk is loaded -- FILE *fd = popen("lsmod | grep amdgpu", "r"); -- char buf[16]; -- if (fread (buf, 1, sizeof (buf), fd) == 0) { -+ -+ std::ifstream amdgpu_initstate("/sys/module/amdgpu/initstate"); -+ if (amdgpu_initstate){ -+ std::stringstream buffer; -+ buffer << amdgpu_initstate.rdbuf(); -+ amdgpu_initstate.close(); -+ -+ std::string line; -+ bool is_live = false; -+ while (std::getline(buffer, line)){ -+ if (line.find( "live" ) != std::string::npos){ -+ is_live = true; -+ break; -+ } -+ } -+ if (is_live){ -+ printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); -+ } else { -+ printf("%sROCk module is NOT live, possibly no GPU devices%s\n", -+ COL_RED, COL_RESET); -+ return -1; -+ } -+ } else { - printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", - COL_RED, COL_RESET); - return -1; -- } else { -- printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); - } -- pclose(fd); - - // Check if user belongs to the group for /dev/kfd (e.g. "video" or - // "render") diff --git a/dev-util/rocminfo/files/rocminfo-6.0.0-python-3-12-support.patch b/dev-util/rocminfo/files/rocminfo-6.0.0-python-3-12-support.patch deleted file mode 100644 index 2b14e42e4705..000000000000 --- a/dev-util/rocminfo/files/rocminfo-6.0.0-python-3-12-support.patch +++ /dev/null @@ -1,34 +0,0 @@ -Fix "SyntaxWarning: invalid escape sequence" SyntaxWarning in python 3.12+ -Bug: https://github.com/ROCm/rocminfo/issues/69 ---- a/rocm_agent_enumerator -+++ b/rocm_agent_enumerator -@@ -92,7 +92,7 @@ def getGCNISA(line, match_from_beginning = False): - return result.group(0) - return None - --@staticVars(search_name=re.compile("gfx[0-9a-fA-F]+(:[-+:\w]+)?")) -+@staticVars(search_name=re.compile(r"gfx[0-9a-fA-F]+(:[-+:\w]+)?")) - def getGCNArchName(line): - result = getGCNArchName.search_name.search(line) - -@@ -149,9 +149,9 @@ def readFromROCMINFO(search_arch_name = False): - - # search AMDGCN gfx ISA - if search_arch_name is True: -- line_search_term = re.compile("\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)") -+ line_search_term = re.compile(r"\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)") - else: -- line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)") -+ line_search_term = re.compile(r"\A\s+Name:\s+(gfx\d+)") - for line in rocminfo_output: - if line_search_term.match(line) is not None: - if search_arch_name is True: -@@ -172,7 +172,7 @@ def readFromLSPCI(): - except: - lspci_output = [] - -- target_search_term = re.compile("1002:\w+") -+ target_search_term = re.compile(r"1002:\w+") - for line in lspci_output: - search_result = target_search_term.search(line) - if search_result is not None: |
