[llvm] [AMDGPU] Exclude CDNA parts from POPS exiting wave id pattern (PR #210892)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 21 00:16:03 PDT 2026
https://github.com/aobolensk created https://github.com/llvm/llvm-project/pull/210892
POPS hardware is graphics-pipe-only and absent on compute-only CDNA targets (gfx908, gfx90a, gfx940, gfx942, gfx950), which incorrectly matched the isGFX9GFX10 predicate and selected a nonexistent register
>From be72fc9dbfa6a1279429b61769dffa8609981b4c Mon Sep 17 00:00:00 2001
From: Arseniy Obolenskiy <arseniy.obolenskiy at amd.com>
Date: Tue, 21 Jul 2026 09:12:41 +0200
Subject: [PATCH] [AMDGPU] Exclude CDNA parts from POPS exiting wave id pattern
POPS hardware is graphics-pipe-only and absent on compute-only CDNA targets (gfx908, gfx90a, gfx940, gfx942, gfx950), which incorrectly matched the isGFX9GFX10 predicate and selected a nonexistent register
---
llvm/lib/Target/AMDGPU/SOPInstructions.td | 2 +-
.../AMDGPU/llvm.amdgcn.pops.exiting.wave.id.ll | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td
index 8fa54de570e67..f0bfd431922ca 100644
--- a/llvm/lib/Target/AMDGPU/SOPInstructions.td
+++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td
@@ -2042,7 +2042,7 @@ let SubtargetPredicate = isNotGFX9Plus in {
def : GetFPModePat<fpmode_mask_gfx6plus>;
}
-let SubtargetPredicate = isGFX9GFX10 in
+let SubtargetPredicate = isGFX9GFX10, OtherPredicates = [NotHasMAIInsts] in
def : GCNPat<
(int_amdgcn_pops_exiting_wave_id),
(S_MOV_B32_sideeffects (i32 SRC_POPS_EXITING_WAVE_ID))
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.pops.exiting.wave.id.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.pops.exiting.wave.id.ll
index ba343a4eb108e..23989f7deaee1 100644
--- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.pops.exiting.wave.id.ll
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.pops.exiting.wave.id.ll
@@ -3,6 +3,22 @@
; RUN: llc -global-isel=1 -mtriple=amdgpu9.00 < %s | FileCheck %s -check-prefixes=GFX9,GFX9-GISEL
; RUN: llc -global-isel=0 -mtriple=amdgpu10.10 < %s | FileCheck %s -check-prefixes=GFX10,SDAG,GFX10-SDAG
; RUN: llc -global-isel=1 -mtriple=amdgpu10.10 < %s | FileCheck %s -check-prefixes=GFX10,GFX10-GISEL
+; RUN: not --crash llc -global-isel=0 -mtriple=amdgpu9.08 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not llc -global-isel=1 -mtriple=amdgpu9.08 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not --crash llc -global-isel=0 -mtriple=amdgpu9.0a < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not llc -global-isel=1 -mtriple=amdgpu9.0a < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not --crash llc -global-isel=0 -mtriple=amdgpu9.4 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not llc -global-isel=1 -mtriple=amdgpu9.4 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not --crash llc -global-isel=0 -mtriple=amdgpu9.42 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not llc -global-isel=1 -mtriple=amdgpu9.42 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not --crash llc -global-isel=0 -mtriple=amdgpu9.50 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+; RUN: not llc -global-isel=1 -mtriple=amdgpu9.50 < %s 2>&1 | FileCheck %s -check-prefix=NOPOPS
+
+; POPS (Primitive Ordered Pixel Shading) is a graphics-pipe-only HW feature,
+; absent on all compute-only CDNA parts (gfx908, gfx90a, gfx940, gfx942,
+; gfx950). SRC_POPS_EXITING_WAVE_ID is not a valid SGPR source on those
+; targets.
+; NOPOPS: LLVM ERROR: {{[Cc]}}annot select: {{.*}}pops.exiting.wave.id
declare void @foo(i32)
More information about the llvm-commits
mailing list