[clang] [llvm] [mlir] [AMDGPU] Verify AMDGPU required workgroup size matches flat workgroup size (PR #200989)
Shilei Tian via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 11 07:57:30 PDT 2026
================
@@ -0,0 +1,89 @@
+; RUN: split-file %s %t
+
+; RUN: not llvm-as %t/missing-flat.ll --disable-output 2>&1 | FileCheck %s --check-prefix=MISSING
+; RUN: not llvm-as %t/broad-flat.ll --disable-output 2>&1 | FileCheck %s --check-prefix=BROAD
+; RUN: not llvm-as %t/wrong-flat.ll --disable-output 2>&1 | FileCheck %s --check-prefix=WRONG
+; RUN: not llvm-as %t/malformed-flat.ll --disable-output 2>&1 | FileCheck %s --check-prefix=MALFORMED-FLAT
+; RUN: not llvm-as %t/malformed-reqd.ll --disable-output 2>&1 | FileCheck %s --check-prefix=MALFORMED-REQD
+; RUN: not llvm-as %t/non-integer-reqd.ll --disable-output 2>&1 | FileCheck %s --check-prefix=NON-INTEGER-REQD
+; RUN: llvm-as %t/valid.ll --disable-output 2>&1 | count 0
+; RUN: llvm-as %t/spir.ll --disable-output 2>&1 | count 0
+
+; MISSING: reqd_work_group_size requires amdgpu-flat-work-group-size
+; BROAD: amdgpu-flat-work-group-size must equal the product of reqd_work_group_size operands
+; WRONG: amdgpu-flat-work-group-size must equal the product of reqd_work_group_size operands
+; MALFORMED-FLAT: amdgpu-flat-work-group-size must be a pair of unsigned integers
+; MALFORMED-REQD: reqd_work_group_size must have exactly three operands
+; NON-INTEGER-REQD: reqd_work_group_size operands must be integer constants
+
+;--- missing-flat.ll
+target triple = "amdgcn-amd-amdhsa"
----------------
shiltian wrote:
There are two checks here. If we compile for AMDGPU, and if there is `reqd_work_group_size`, then `amdgpu-flat-work-group-size` is required to exist. That is what `missing-flat.ll` is for. If we are not compiling for AMDGPU, `amdgpu-flat-work-group-size` doesn't need to exist and we will not check it. We will still check `reqd_work_group_size`, which is what `malformed-reqd.ll` does.
https://github.com/llvm/llvm-project/pull/200989
More information about the cfe-commits
mailing list