This is an archive of the discontinued LLVM Phabricator instance.

[LV][RISCV] Don't interleave scalable vector loops
ClosedPublic

Authored by luke on Feb 21 2023, 7:06 AM.

Details

Summary

It's less clear with scalable vectors than fixed length vectors that
interleaving exposes more ILP, as scalable vectors can be thought of a
sort of hardware form of interleaving, especially with larger LMULs.
This also addresses the unexpected additional unrolling that occurs when
using larger LMULs in the loop vectorizer.

Diff Detail

Event Timeline

luke created this revision.Feb 21 2023, 7:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2023, 7:06 AM
luke requested review of this revision.Feb 21 2023, 7:06 AM
craig.topper accepted this revision.Feb 21 2023, 10:46 AM

LGTM

I'm not sure we should leave this on for fixed vectors either once we go to LMUL=2.

This revision is now accepted and ready to land.Feb 21 2023, 10:46 AM
luke updated this revision to Diff 499313.Feb 21 2023, 3:35 PM

Fix scalable-reductions.ll test

This revision was landed with ongoing or failed builds.Feb 22 2023, 2:15 AM
This revision was automatically updated to reflect the committed changes.

I'm not sure we should leave this on for fixed vectors either once we go to LMUL=2.

I think I agree with this point. In a follow on patch, we should probably revisit this part of the heuristic as well.

A more general framing here is that interleave and LMUL both increase register pressure and tail effects, and that as we increase one we probably need to decrease the other by a roughly equal ratio.