This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add cost model for fixed broadcast shuffle
ClosedPublic

Authored by arcbbb on Nov 2 2022, 11:19 AM.

Details

Summary

This patch adds basic broadcast shuffle costs in order to enable SLP vectorization.
And adds getLMULCost to consider reciprocal throughput for different LMUL.

Diff Detail

Event Timeline

arcbbb created this revision.Nov 2 2022, 11:19 AM
arcbbb requested review of this revision.Nov 2 2022, 11:19 AM
arcbbb updated this revision to Diff 472709.Nov 2 2022, 11:22 AM

Updates: Use 1 for fractional LMUL.

craig.topper added inline comments.Nov 2 2022, 11:54 AM
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
308

You can drop the else, because the if returned.

311

tha -> than

arcbbb updated this revision to Diff 472847.Nov 2 2022, 10:52 PM
arcbbb marked 2 inline comments as done.

Updates:

Address Craig's comments.
reames accepted this revision.Nov 21 2022, 11:54 AM

LGTM

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
293

I think we have some room to improve this codegen, but that's orthogonal to your actual patch.

Ideas:

  • vrgather allows a immediate broadcast index.
  • We know we're broadcasting the low bit, can copy the value to scalar register and mask. Once we have that, need to form either a zero or all ones mask or the right length.
This revision is now accepted and ready to land.Nov 21 2022, 11:54 AM
This revision was automatically updated to reflect the committed changes.