This is an archive of the discontinued LLVM Phabricator instance.

[NFC][LoopVectorize] Explicitly disable tail-folding on some SVE tests
ClosedPublic

Authored by david-arm on Jul 5 2022, 3:12 AM.

Details

Summary

This patch is in preparation for enabling vectorisation with tail-folding
by default for SVE targets. Once we do that many existing tests will
break that depend upon having normal unpredicated vector loops. For
all such tests I have added the flag:

-prefer-predicate-over-epilogue=scalar-epilogue

Diff Detail

Event Timeline

david-arm created this revision.Jul 5 2022, 3:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 3:12 AM
david-arm requested review of this revision.Jul 5 2022, 3:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 3:12 AM

Having worked through these tests I feel like there are some we can clean up and reduce the length of the RUN lines. I thought about doing that in this patch, but then it's probably too much going on at once. I may create a follow-up patch that unifies the run lines a bit more.

Matt added a subscriber: Matt.Jul 5 2022, 10:54 AM
sdesmalen added inline comments.Jul 18 2022, 2:48 AM
llvm/test/Transforms/LoopVectorize/AArch64/scalable-alloca.ll
1 ↗(On Diff #442247)

This test is more of a negative test for scalable vectors, so even if tail-folding would be the new default for SVE, then this test would be unchanged? I'd expect something similar to be true for the sve-epilog-vect-* tests, which don't get tail-folded because it's testing a vectorized epilogue loop. You'd only need to modify the tests that would actually change if predication is enabled by default for SVE, which I would expect to be the same set as in D129986?

david-arm updated this revision to Diff 445513.Jul 18 2022, 8:09 AM
  • Rebased patch.
  • Changed tests to focus only those that would fail if tail-folding is enabled by default for SVE.

Hi @sdesmalen, I've updated the patch to only include those tests that would fail when tail-folding is enabled by default for SVE. The tests changed in D129986 now represent a subset of these. The reasons for the mismatch between D129137 and D129986 are as follows:

  1. scalable-strict-fadd.ll. There is already a RUN line for tail-folding, which was added by https://reviews.llvm.org/D129550.
  2. sve-epilog-vect-* - these fail when TF is enabled because we no longer create epilogues. However, it doesn't really make much sense to add new tail-folding RUN lines for these because then we won't perform epilogue vectorisation.
  3. scalarize-store-with-predication.ll. This tests a case where VF=1,IC=2. When we enable tail-folding for these tests, forcing VF=1 and IC=2, we then crash. At the moment this is an artificial case because it wouldn't normally happen in practice since when tail-folding is enabled we don't bother interleaving. However, we should probably fix this at some point. :)
sdesmalen accepted this revision.Jul 19 2022, 1:32 AM

Thanks for elaborating on the tests @david-arm!

This revision is now accepted and ready to land.Jul 19 2022, 1:32 AM
sdesmalen requested changes to this revision.Jul 19 2022, 2:56 AM
  1. sve-epilog-vect-* - these fail when TF is enabled because we no longer create epilogues. However, it doesn't really make much sense to add new tail-folding RUN lines for these because then we won't perform epilogue vectorisation.

I think that this is actually hiding a bug. If you don't specify tail-folding in the RUN line, whatever default the target may set shouldn't be able to override the explicit request to do 'epilogue vectorization'. Conversely, explicitly requesting a certain vectorization style should override any vectorization styles that were set by default. If *both* tail folding and epilogue vectorization are requested through flags or hints, then that's a bug in the test itself.

Can you see if you can remove the -prefer-predicate-over-epilogue=scalar-epilogue from the sve-epilog-vect-* tests?

This revision now requires changes to proceed.Jul 19 2022, 2:56 AM
david-arm updated this revision to Diff 446101.Jul 20 2022, 3:26 AM
  • Removed most of the changes to RUN lines in sve-epilog-vect* tests where we're forcing the use of epilogue vectorisation.
david-arm updated this revision to Diff 446387.Jul 21 2022, 1:37 AM
  • I discovered a couple more tests that fail when tail-folding is enabled:
  • clang/test/CodeGen/aarch64-sve-vector-bits-codegen.c, which I missed in the previous patch, and
  • llvm/test/Transforms/LoopVectorize/AArch64/sve-runtime-check-size-based-threshold.ll, which seems to be a new test I picked up after a rebase.
This revision is now accepted and ready to land.Jul 21 2022, 6:06 AM
This revision was landed with ongoing or failed builds.Jul 21 2022, 7:23 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 7:23 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript