[llvm] [AMDGPU] Warn if 'amdgpu-waves-per-eu' target occupancy was not met (PR #74055)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 01:46:43 PST 2023


================
@@ -939,6 +939,17 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
   ProgInfo.Occupancy = STM.computeOccupancy(MF.getFunction(), ProgInfo.LDSSize,
                                             ProgInfo.NumSGPRsForWavesPerEU,
                                             ProgInfo.NumVGPRsForWavesPerEU);
+  const auto [MinWEU, MaxWEU] =
+      AMDGPU::getIntegerPairAttribute(F, "amdgpu-waves-per-eu", {0, 0}, true);
+  if (ProgInfo.Occupancy < MinWEU) {
----------------
Pierre-vh wrote:

It triggers 10 times in the test suite

```
[build] Failed Tests (10):
[build]   LLVM :: CodeGen/AMDGPU/attr-amdgpu-waves-per-eu.ll
[build]   LLVM :: CodeGen/AMDGPU/copy-vgpr-clobber-spill-vgpr.mir
[build]   LLVM :: CodeGen/AMDGPU/inline-asm-reserved-regs.ll
[build]   LLVM :: CodeGen/AMDGPU/mfma-cd-select.ll
[build]   LLVM :: CodeGen/AMDGPU/min-waves-per-eu-not-respected.ll
[build]   LLVM :: CodeGen/AMDGPU/occupancy-levels.ll
[build]   LLVM :: CodeGen/AMDGPU/scc-clobbered-sgpr-to-vmem-spill.ll
[build]   LLVM :: CodeGen/AMDGPU/sgpr-spill-incorrect-fi-bookkeeping-bug.ll
[build]   LLVM :: CodeGen/AMDGPU/sgpr-spill-no-vgprs.ll
[build]   LLVM :: CodeGen/AMDGPU/spill-scavenge-offset.ll
[build] 
```

The wrapped query does a bit of extra work other than getting the attribute. It'll return a default if the attribute isn't present, but here we just want to trigger the warning if the attribute is there so I think it's better to get it manually

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


More information about the llvm-commits mailing list