This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Cost model for general case of dual vector permute
ClosedPublic

Authored by reames on Mar 28 2023, 9:52 AM.

Details

Summary

The cost model was not accounting for the fact that we can generate a dual vrgather + an index expression sequence instead of scalarizing.

A couple cases to call out:

  1. I did not model the difference between vrgather and vrgatherei16. The result is the constant pool cost can be slightly understated on RV32. I don't think we care, but if someone disagrees, this would be easy to add.
  2. Our current codegen for i8 vectors longer than 256 (which is the limit of what this costs) has some room for improvement.
  3. As indicated by the *regression* in reported cost for <2 x iN> vectors, our current vector lowering is missing support for a sub-case where scalarize-and-insert is actually faster than the generic fallback path.

Diff Detail

Event Timeline

reames created this revision.Mar 28 2023, 9:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2023, 9:52 AM
reames requested review of this revision.Mar 28 2023, 9:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2023, 9:52 AM
luke accepted this revision.Mar 29 2023, 1:48 AM

LGTM. Not sure why clang-format is failing in the pre-merge checks

This revision is now accepted and ready to land.Mar 29 2023, 1:48 AM
This revision was landed with ongoing or failed builds.Mar 29 2023, 7:37 AM
This revision was automatically updated to reflect the committed changes.