llvm-project/llvm/test/Transforms/SLPVectorizer/AArch64
Philip Reames 0539a26d91 [SLP] Schedule only sub-graph of vectorizable instructions
SLP currently schedules all instructions within a scheduling window which stretches from the first instruction potentially vectorized to the last. This window can include a very large number of unrelated instructions which are not being considered for vectorization. This change switches the code to only schedule the sub-graph consisting of the instructions being vectorized and their transitive users.

This has the effect of greatly reducing the amount of work performed in large basic blocks, and thus greatly improves compile time on degenerate examples. To understand the effects, I added some statistics (not planned for upstream contribution). Here's an illustration from my motivating example:

Before this patch:

704357 SLP                          - Number of calcDeps actions
 699021 SLP                          - Number of schedule calls
   5598 SLP                          - Number of ReSchedule actions
     59 SLP                          - Number of ReScheduleOnFail actions
  10084 SLP                          - Number of schedule resets
   8523 SLP                          - Number of vector instructions generated

After this patch:

102895 SLP                          - Number of calcDeps actions
 161916 SLP                          - Number of schedule calls
   5637 SLP                          - Number of ReSchedule actions
     55 SLP                          - Number of ReScheduleOnFail actions
  10083 SLP                          - Number of schedule resets
   8403 SLP                          - Number of vector instructions generated

I do want to highlight that there is a small difference in number of generated vector instructions. This example is hitting the bailout due to maximum window size, and the change in scheduling is slightly perturbing when and how we hit it. This can be seen in the RescheduleOnFail counter change. Given that, I think we can safely ignore.

The downside of this change can be seen in the large test diff. We group all vectorizable instructions together at the bottom of the scheduling region. This means that vector instructions can move quite far from their original point in code. While maybe undesirable, I don't see this as being a major problem as this pass is not intended to be a general scheduling pass.

For context, it's worth noting that the pre-scheduling that SLP does while building the vector tree is exactly the sub-graph scheduling implemented by this patch.

Differential Revision: https://reviews.llvm.org/D118538
2022-02-22 10:15:55 -08:00
..
64-bit-vector.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
PR38339.ll
accelerate-vector-functions-inseltpoison.ll
accelerate-vector-functions.ll
commute.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
ext-trunc.ll
gather-cost.ll [instcombine] Canonicalize constant index type to i64 for extractelement/insertelement 2021-12-13 16:56:22 -08:00
gather-load-min-required-vf-2.ll [SLP][NFC]Add tests for SLP vectorizer for crashes, found in new 2021-08-03 12:44:12 -07:00
gather-reduce.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
gather-root.ll
getelementptr.ll [instcombine] Canonicalize constant index type to i64 for extractelement/insertelement 2021-12-13 16:56:22 -08:00
horizontal.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
insertelement-inseltpoison.ll
insertelement.ll
invalid_type.ll
lit.local.cfg
load-store-q.ll
loadi8.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
matmul.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
memory-runtime-checks-in-loops.ll [SLP] Add additional tests which caused crashes with versioning. 2021-10-21 18:17:31 +01:00
memory-runtime-checks.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
minimum-sizes.ll
mismatched-intrinsics.ll
mul.ll
nontemporal.ll
remarks.ll
reorder-fmuladd-crash.ll [SLP][NFC]Add tests for SLP vectorizer for crashes, found in new 2021-08-03 12:44:12 -07:00
scalable-vector.ll [SLPVectorizer] Fix crash in isShuffle with scalable vectors 2021-10-01 10:56:44 +01:00
sdiv-pow2.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
slp-and-reduction.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
slp-or-reduction.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
slp-xor-reduction.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
spillcost-di.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
spillcost-order.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
transpose-inseltpoison.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
transpose.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
trunc-insertion.ll
tsc-s352.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00
vectorizable-selects-min-max.ll
vectorizable-selects-uniform-cmps.ll [SLP]Improve splats vectorization. 2021-07-30 10:17:45 -07:00
vectorize-free-extracts-inserts.ll [SLP]Improve multinode analysis. 2021-12-14 06:01:52 -08:00
widen.ll [SLP] Schedule only sub-graph of vectorizable instructions 2022-02-22 10:15:55 -08:00