-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Add tests for broadcast vectorization #49317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0236d36
to
a051879
Compare
What optimization is the new LoopUnswitch lacking? Given that it doesn't optimize on LLVM 16 as well, we might be stuck for a very long while. Can we help it from somewhere else? |
I'd suspect that we're generating select instructions for the broadcasting operations, and loop unswitch doesn't have support for unswitching select instructions because it won't reduce code size measurably. Most likely we'll need to patch in optional support for unswitch-on-select upstream. |
And the old one did support doing that? Or is it caused by something else in the pipeline? |
I at least see select instruction handling in line 824 of old LoopUnswitch and a NumSelects statistic, whereas SimpleLoopUnswitch.cpp only has NumBranches and NumSwitches. |
So my plan for now is to import the LoopUnswitch pass either into our own source tree or by reverting the relevant commits. The former is probably nicer to folks who want to build against custom LLVMs. |
Quite unexpectedly, this new test fails on A64FX:
Edit: for the record, also loopinfo test fails: #49325 |
Does A64FX have scalable vectors? Iirc the syntax for that changes to n x vscale x type. |
@giordano could you try the latest on A64FX to see if it fixes the issue? If not, could you send the output of |
Yes, that worked, thanks! Maybe there's something similar to be done for #49325? |
This tests that basic broadcasting operations (outer/inner products) do end up vectorizing after the LLVM pipeline.
@gbaraldi This will probably block LLVM 15 due to https://discourse.llvm.org/t/newpm-loop-unswitch-regression-from-legacy-pm-to-new-pm/69823 and https://reviews.llvm.org/D124376