[llvm] [AMDGPU][NFC] Add CuModeOnly feature (PR #201134)

Mariusz Sikora via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 07:43:06 PDT 2026


https://github.com/mariusz-sikora-at-amd created https://github.com/llvm/llvm-project/pull/201134

Introduce a dedicated subtarget feature for targets that only support CU mode. Use it instead of isGFX1250.

GFX13 can support both CU and WGP modes while still exposing GFX1250 instructions, so checking isGFX1250 is not specific enough for CU-mode-only behavior.

>From b4ca8e625725d80c34f657886b0d8de3bc9d2005 Mon Sep 17 00:00:00 2001
From: Mariusz Sikora <mariusz.sikora at amd.com>
Date: Tue, 2 Jun 2026 10:20:27 -0400
Subject: [PATCH] [AMDGPU][NFC] Add CuModeOnly feature

Introduce a dedicated subtarget feature for targets that only support CU mode.
Use it instead of isGFX1250.

GFX13 can support both CU and WGP modes while still exposing GFX1250
instructions, so checking isGFX1250 is not specific enough for CU-mode-only
behavior.
---
 llvm/lib/Target/AMDGPU/AMDGPU.td                | 9 ++++++++-
 llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 73321dabf4af2..a3f4d82c8d7dd 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -236,6 +236,13 @@ def FeatureCuMode : SubtargetFeature<"cumode",
   "Enable CU wavefront execution mode"
 >;
 
+defm CuModeOnly : AMDGPUSubtargetFeature<"cumode-only",
+  "Target supports only CU mode",
+  /*GenPredicate=*/1,
+  /*GenAssemblerPredicate=*/1,
+  [FeatureCuMode]
+>;
+
 def FeaturePreciseMemory
     : SubtargetFeature<"precise-memory", "EnablePreciseMemory",
                        "true", "Enable precise memory mode">;
@@ -2094,7 +2101,7 @@ def FeatureISAVersion12_50_Common : FeatureSet<
    FeatureGFX1250Insts,
    FeatureBackOffBarrier,
    FeatureRequiresAlignedVGPRs,
-   FeatureCuMode,
+   FeatureCuModeOnly,
    Feature1024AddressableVGPRs,
    Feature64BitLiterals,
    FeatureLDSBankCount32,
diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
index 33df51e8a7e07..7cbb20fac0683 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
@@ -1246,7 +1246,7 @@ unsigned getEUsPerCU(const MCSubtargetInfo &STI) {
   // workgroup must share".
 
   // GFX12.5 only supports CU mode, which contains four SIMDs.
-  if (isGFX1250(STI)) {
+  if (STI.getFeatureBits().test(FeatureCuModeOnly)) {
     assert(STI.getFeatureBits().test(FeatureCuMode));
     return 4;
   }



More information about the llvm-commits mailing list