This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Do not vectorize non-profitable alternate nodes.
ClosedPublic

Authored by ABataev on May 13 2022, 10:47 AM.

Details

Summary

If alternate node has only 2 instructions and the tree is already big
enough, better to skip the vectorization of such nodes, they are not
very profitable (the resulting code cotains 3 instructions instead of
original 2 scalars). SLP can try to vectorize the buildvector sequence
in the next attempt, if it is profitable.

Metric: SLP.NumVectorInstructions

Program SLP.NumVectorInstructions

                                                                          results                   results0 diff
test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C/miniAMR/miniAMR.test    72.00                     73.00   1.4%

test-suite :: MultiSource/Benchmarks/Prolangs-C/TimberWolfMC/timberwolfmc.test 1186.00 1198.00 1.0%

test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/miniFE.test   241.00                    242.00   0.4%
             test-suite :: MultiSource/Applications/JM/lencod/lencod.test  2131.00                   2139.00   0.4%

test-suite :: External/SPEC/CINT2017rate/523.xalancbmk_r/523.xalancbmk_r.test 6377.00 6384.00 0.1%
test-suite :: External/SPEC/CINT2017speed/623.xalancbmk_s/623.xalancbmk_s.test 6377.00 6384.00 0.1%

  test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test 12650.00                  12658.00   0.1%
test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 26169.00                  26147.00  -0.1%
    test-suite :: MultiSource/Benchmarks/Trimaran/enc-3des/enc-3des.test    99.00                     86.00 -13.1%

Gains:
526.blender_r - more vectorized trees.
enc-3des - same.

Others:
510.parest_r - no changes.
miniFE - same
623.xalancbmk_s - some (non-profitable) parts of the trees are not

vectorized.

523.xalancbmk_r - same
lencod - same
timberwolfmc - same
miniAMR - same

Diff Detail

Event Timeline

ABataev created this revision.May 13 2022, 10:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 10:47 AM
ABataev requested review of this revision.May 13 2022, 10:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 10:47 AM
This revision is now accepted and ready to land.May 13 2022, 11:12 AM
vdmitrie accepted this revision.May 13 2022, 11:42 AM
This revision was landed with ongoing or failed builds.May 13 2022, 2:48 PM
This revision was automatically updated to reflect the committed changes.
fhahn added a subscriber: fhahn.May 17 2022, 12:19 AM

Just a heads up, we are seeing ~6-7% regressions on some benchmarks with this change. I'll try to narrow down a reproducer.