[PATCH] D131118: [LV] Add generic scalarization support for unpredicated scalable vectors

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 14:54:45 PDT 2022


reames created this revision.
reames added reviewers: fhahn, david-arm.
Herald added subscribers: frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, asb, hiraditya, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: alextsao1999, pcwang-thead, vkmr, MaskRay.
Herald added a project: LLVM.

This change adds generic support for scalarizing scalable vector operations.  Unlike fixed length vectors, we can't simply unroll a scalable vector as we don't know how long it is at compile time.  However, there's nothing that prevents us from emitting the loop directly as we do know the dynamic number of elements.

For testing purposes, I have hocked this up to the uniform memory op path.  This is not an optimal lowering for uniform mem ops, but it nicely demonstrates the value of having a fallback scalarization strategy available when smarter and more optimal things haven't yet been implemented.

>From here, I plan on doing the following:

- Add the support on the predicated path.  This is quite a bit more involved and requires setting up VPBlocks for the CFG.
- Generalize the definition of uniform memory op to allow internal predication.  (This fundamentally requires the fully general predicated scalarization fallback, so it makes a good test to make sure we haven't missed anything.)
- Write generic cost modeling for scalable scalarization, and start enabling other paths that we current unconditionally bail out from.
- Implement a dedicated recipe for the uniform memory op case in the current predication due to tail folding only form.  The loop form will probably be removed via LICM, but we should really stop relying on pass ordering here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131118

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/sve-inv-store.ll
  llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131118.449793.patch
Type: text/x-patch
Size: 18162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220803/b2425612/attachment.bin>


More information about the llvm-commits mailing list