[llvm-branch-commits] [clang] [llvm] AMDGPU: Use module flags to control xnack and sramecc (PR #204595)

Shilei Tian via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 18 20:26:43 PDT 2026


================
@@ -1178,6 +1180,26 @@ getTargetIDSettingFromFeatureString(StringRef FeatureString) {
   llvm_unreachable("Malformed feature string");
 }
 
+std::optional<std::pair<StringRef, StringRef>>
+AMDGPUTargetID::parseTargetIDDirective(StringRef TargetIDDirective) {
+  // Extract the CPU+features from the target ID directive
+  // Format: "amdgcn-amd-amdhsa--gfx1010:xnack-:sramecc+"
+  // Split on '-' and take the last element
+  SmallVector<StringRef, 8> Parts;
+  TargetIDDirective.split(Parts, '-');
+
+  if (Parts.empty())
+    return std::nullopt;
+
+  // The CPU+features is the last element after splitting on '-'
+  StringRef CPUAndFeatures = Parts.back();
----------------
shiltian wrote:

Does this look right? For `amdgcn-amd-amdhsa--gfx1010:xnack-:sramecc+`, the last part is `:sramecc+`, no?

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


More information about the llvm-branch-commits mailing list