From 355d97fec46eb257f771a8ff9bb544aee7535701 Mon Sep 17 00:00:00 2001 From: "Assiouras, Ioannis" Date: Wed, 28 May 2025 12:17:22 +0100 Subject: [PATCH] SWDEV-515261 - Fixed getMatchingConfigFile for heterogeneous archs (#54) Preserve order and duplicate entries in rocm_agent_enumerator output before filtering visible devices. This ensures alignment with the expected indexing in HIP_VISIBLE_DEVICES. --- catch/hipTestMain/hip_test_context.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/catch/hipTestMain/hip_test_context.cc b/catch/hipTestMain/hip_test_context.cc index 520ce9b09a..c2af3aa603 100644 --- a/catch/hipTestMain/hip_test_context.cc +++ b/catch/hipTestMain/hip_test_context.cc @@ -37,7 +37,8 @@ std::string TestContext::substringFound(std::vector list, std::stri 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 = + "/opt/rocm/bin/rocm_agent_enumerator | awk '$0 != \"gfx000\"' | xargs | sed -e 's/ /;/g'"; std::array buffer; std::string result; std::unique_ptr pipe(popen(cmd, "r"), pclose); @@ -50,12 +51,6 @@ std::string TestContext::getCurrentArch() { result = res; } - result.erase(std::remove(result.begin(), result.end(), '\n'), result.end()); - size_t pos = result.find("gfx000"); - if (pos != std::string::npos) { - result.erase(pos, 7); - } - std::string s_visible_devices = TestContext::getEnvVar("HIP_VISIBLE_DEVICES"); auto parser = [](std::string input, char c) -> std::vector {