[PATCH] D150266: [AMDGPU] Improve PHI-breaking heuristics in CGP

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 06:01:07 PDT 2023


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

D147786 <https://reviews.llvm.org/D147786> made the transform more conservative by adding heuristics,
which was a good idea. However, the transform got a bit
too conservative at times.

This caused a surprise in some rocRAND benchmarks because D143731 <https://reviews.llvm.org/D143731> greatly helped a few of them.
For instance, a few xorwow-uniform tests saw a +30% boost in performance after that pass, which was lost when D147786 <https://reviews.llvm.org/D147786> landed.

This patch is an attempt at reaching a middleground that makes
the pass a bit more permissive. It continues in the same spirit as
D147786 <https://reviews.llvm.org/D147786> but does the following changes:

- PHI users of a PHI node are now recursively checked. When loops are encountered, we consider the PHIs non-breakable. (Considering them breakable had very negative effect in one app I tested)
- `shufflevector` is now considered interesting, given that it satisfies a few trivial checks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150266

Files:
  llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
  llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-break-large-phis-heuristics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150266.520964.patch
Type: text/x-patch
Size: 31261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230510/880ebc59/attachment.bin>


More information about the llvm-commits mailing list