[flang-commits] [clang] [flang] [lld] [lldb] [llvm] AMDGPU: Introduce amdgpu triple arch (PR #206480)

Scott Linder via flang-commits flang-commits at lists.llvm.org
Tue Jul 7 08:51:40 PDT 2026


================
@@ -34,9 +34,159 @@ StringRef llvm::AMDGPU::getArchFamilyNameAMDGCN(GPUKind AK) {
   return ArchName.empty() ? "" : ArchName.drop_back(2);
 }
 
+Triple::SubArchType llvm::AMDGPU::getSubArch(GPUKind AK) {
+  switch (AK) {
+#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES)                  \
+  case ENUM:                                                                   \
+    return SUBARCH;
+#include "llvm/TargetParser/AMDGPUTargetParser.def"
+  default:
+    return Triple::SubArchType::NoSubArch;
+  }
+}
+
+AMDGPU::GPUKind
+llvm::AMDGPU::getGPUKindFromSubArch(Triple::SubArchType SubArch) {
+  switch (SubArch) {
+#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES)                  \
+  case SUBARCH:                                                                \
+    return ENUM;
+#include "llvm/TargetParser/AMDGPUTargetParser.def"
+  default:
+    return GK_NONE;
+  }
+}
+
+static const Triple::SubArchType
----------------
slinder1 wrote:

This seems like a bit of a nightmare to maintain, although I guess we will only be adding on to the end.

I think a `switch` would at least be more immediately digestible

https://github.com/llvm/llvm-project/pull/206480


More information about the flang-commits mailing list