[PATCH] D158841: [AMDGPU] si-wqm: Skip only LiveMask COPY

Diana Picus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 06:07:36 PDT 2023


rovka created this revision.
Herald added subscribers: foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl, arsenm.
Herald added a project: All.
rovka requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

si-wqm sometimes needs to save the LiveMask in the entry block. Later
on, while looking for a place to enter WQM/WWM, it unconditionally
skips over the first COPY instruction in the entry block. This is
incorrect for functions where the LiveMask doesn't need to be saved, and
therefore the first COPY is more likely a COPY from a function argument
and might need to be in some non-exact mode.

This patch fixes the issue by also checking that the source of the COPY
is the EXEC register.

This produces different code in 2 of the existing tests:

- In wave32.ll, we end up with an extra register copy. This is because

the first COPY in the block is now part of the WWM block, so
si-pre-allocate-wwm-regs will allocate a new register for its
destination (when it was outside of the WWM region, the register
allocator could just re-use the same register). We might be able to
improve this in si-pre-allocate-wwm-regs but I haven't looked into it.

- The same thing happens in dual-source-blend-export.ll, but for that

one it's harder to see because of the scheduling changes. I've uploaded
the before/after si-wqm output for it here:
https://reviews.llvm.org/differential/diff/553445/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158841

Files:
  llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
  llvm/test/CodeGen/AMDGPU/dual-source-blend-export.ll
  llvm/test/CodeGen/AMDGPU/llvm.amdgcn.set.inactive.chain.arg.ll
  llvm/test/CodeGen/AMDGPU/wave32.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158841.553447.patch
Type: text/x-patch
Size: 14814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230825/a9d6dd1a/attachment.bin>


More information about the llvm-commits mailing list