File 0005-rocblas-add-rocblas_internal_get_generic_arch_name.patch of Package rocblas

From 8926fb0fca00d1ff859682b3df91243cff650425 Mon Sep 17 00:00:00 2001
From: Tom Rix <Tom.Rix@amd.com>
Date: Mon, 9 Mar 2026 18:15:43 -0700
Subject: [PATCH 5/6] [rocblas] add rocblas_internal_get_generic_arch_name

A function similar to rocblas_internal_get_arch_name,
returns the generic name for the arch.

Signed-off-by: Tom Rix <Tom.Rix@amd.com>
---
 .../rocblas/library/src/include/utility.hpp   |  3 ++
 .../rocblas/library/src/rocblas_auxiliary.cpp | 47 +++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/projects/rocblas/library/src/include/utility.hpp b/projects/rocblas/library/src/include/utility.hpp
index bb4212f78630..966958c9aca4 100644
--- a/projects/rocblas/library/src/include/utility.hpp
+++ b/projects/rocblas/library/src/include/utility.hpp
@@ -800,6 +800,9 @@ bool rocblas_internal_tensile_supports_ldc_ne_ldd(rocblas_handle handle);
 // We assume true if the value is between 942 to 1000
 ROCBLAS_INTERNAL_EXPORT bool rocblas_internal_tensile_supports_xdl_math_op(rocblas_math_mode mode);
 
+// for internal use
+ROCBLAS_INTERNAL_EXPORT std::string rocblas_internal_get_generic_arch_name();
+
 // for internal use during testing, fetch arch name
 ROCBLAS_INTERNAL_EXPORT std::string rocblas_internal_get_arch_name();
 
diff --git a/projects/rocblas/library/src/rocblas_auxiliary.cpp b/projects/rocblas/library/src/rocblas_auxiliary.cpp
index 57c24a9f519d..3f7c375eefc4 100644
--- a/projects/rocblas/library/src/rocblas_auxiliary.cpp
+++ b/projects/rocblas/library/src/rocblas_auxiliary.cpp
@@ -917,6 +917,53 @@ bool rocblas_internal_tensile_supports_xdl_math_op(rocblas_math_mode mode)
     return (deviceString.find("gfx942") != std::string::npos);
 }
 
+std::string rocblas_internal_get_generic_arch_name()
+{
+  std::string arch_name = rocblas_internal_get_arch_name();
+  // Map specific architecture names to generic names
+  static const std::map<std::string, std::string> arch_map = {
+    {"gfx900", "gfx9-generic"},
+    {"gfx902", "gfx9-generic"},
+    {"gfx904", "gfx9-generic"},
+    {"gfx906", "gfx9-generic"},
+    {"gfx908", "gfx9-generic"},
+    {"gfx909", "gfx9-generic"},
+    {"gfx90a", "gfx9-generic"},
+    {"gfx940", "gfx9-4-generic"},
+    {"gfx941", "gfx9-4-generic"},
+    {"gfx942", "gfx9-4-generic"},
+    {"gfx1010", "gfx10-1-generic"},
+    {"gfx1011", "gfx10-1-generic"},
+    {"gfx1012", "gfx10-1-generic"},
+    {"gfx1013", "gfx10-1-generic"},
+    {"gfx1030", "gfx10-3-generic"},
+    {"gfx1031", "gfx10-3-generic"},
+    {"gfx1032", "gfx10-3-generic"},
+    {"gfx1033", "gfx10-3-generic"},
+    {"gfx1034", "gfx10-3-generic"},
+    {"gfx1035", "gfx10-3-generic"},
+    {"gfx1036", "gfx10-3-generic"},
+    {"gfx1100", "gfx11-generic"},
+    {"gfx1101", "gfx11-generic"},
+    {"gfx1102", "gfx11-generic"},
+    {"gfx1103", "gfx11-generic"},
+    {"gfx1150", "gfx11-generic"},
+    {"gfx1151", "gfx11-generic"},
+    {"gfx1152", "gfx11-generic"},
+    {"gfx1153", "gfx11-generic"},
+    {"gfx1200", "gfx12-generic"},
+    {"gfx1201", "gfx12-generic"},
+    {"gfx1250", "gfx12-generic"},
+    {"gfx1251", "gfx12-generic"}
+  };
+
+  auto it = arch_map.find(arch_name);
+  if(it != arch_map.end())
+    return it->second;
+
+  // Return original name if no mapping found
+  return arch_name;
+}
 // exported. Get architecture name
 std::string rocblas_internal_get_arch_name()
 {
-- 
2.53.0

openSUSE Build Service is sponsored by