This is an archive of the discontinued LLVM Phabricator instance.

Enabled DFAJumpThreading by Default
Needs RevisionPublic

Authored by Yangguang on Dec 23 2022, 1:44 PM.

Details

Summary

I measured the compile time impact for the DFAJumpThreading pass and did functional test on SPEC2017.
As the result shown below, there is almost no impact in compile time. And the SPEC2017 benchmark suit
can be successfully compiled with several DFAJumpThreading transforms being applied to some of the
benchmarks. So I suggest that we enable DFAJumpThreading by Default.

Compile time test:

DFA falseDFA trueChange (off-on)/off
MultiSourc...Benchmarks/7zip/7zip-benchmark82.0282.73-0.87%
MultiSourc...nchmarks/tramp3d-v4/tramp3d-v439.1439.140.00%
MultiSourc.../DOE-ProxyApps-C++/CLAMR/CLAMR37.2537.44-0.51%
MultiSource/Benchmarks/Bullet/bullet36.8836.730.41%
MultiSourc.../Applications/JM/lencod/lencod25.8925.840.19%
MultiSourc...e/Applications/ClamAV/clamscan20.5720.420.73%
MultiSource/Applications/SPASS/SPASS18.1718.22-0.28%
MultiSource/Applications/kimwitu++/kc18.0218.000.11%
MultiSourc...e/Applications/sqlite3/sqlite316.6516.78-0.78%
MultiSourc...enchmarks/mafft/pairlocalalign14.5914.540.34%
MultiSourc...sumer-typeset/consumer-typeset13.5813.68-0.74%
MultiSourc...-ProxyApps-C++/PENNANT/PENNANT11.7011.84-1.20%
MultiSourc.../Applications/JM/ldecod/ldecod10.5910.520.66%
SingleSour...nchmarks/Adobe-C++/loop_unroll9.499.57-0.84%
MicroBench...CALS/SubsetCRawLoops/lcalsCRaw9.209.170.33%

Number of DFAJumpThreading transforms in compile time test:

"test-suite :: MultiSource/Applications/lua/lua.test" : "dfa-jump-threading.NumTransforms": 1.0, 
"test-suite :: MultiSource/Applications/SPASS/SPASS.test" : "dfa-jump-threading.NumTransforms": 2.0, 
"test-suite :: MultiSource/Benchmarks/7zip/7zip-benchmark.test" : "dfa-jump-threading.NumTransforms": 24.0, 
"test-suite :: MultiSource/Applications/sqlite3/sqlite3.test" : "dfa-jump-threading.NumTransforms": 4.0, 
"test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C++/CLAMR/CLAMR.test" : "dfa-jump-threading.NumTransforms": 2.0,
"test-suite :: MultiSource/Applications/obsequi/Obsequi.test" : "dfa-jump-threading.NumTransforms": 1.0, 
"test-suite :: MultiSource/Benchmarks/Ptrdist/bc/bc.test" : "dfa-jump-threading.NumTransforms": 1.0, 
"test-suite :: MultiSource/Applications/ClamAV/clamscan.test" : "dfa-jump-threading.NumTransforms": 7.0, 
"test-suite :: MultiSource/Applications/kimwitu++/kc.test" : "dfa-jump-threading.NumTransforms": 2.0, 
"test-suite :: MultiSource/Benchmarks/MiBench/consumer-typeset/consumer-typeset.test" : "dfa-jump-threading.NumTransforms": 4.0, 
"test-suite :: MultiSource/Benchmarks/McCat/01-qbsort/qbsort.test" : "dfa-jump-threading.NumTransforms": 1.0, 
"test-suite :: MultiSource/Benchmarks/MallocBench/gs/gs.test" : "dfa-jump-threading.NumTransforms": 1.0, 
"test-suite :: MultiSource/Benchmarks/MiBench/consumer-jpeg/consuuner-j peg. test" : "dfa-jump-threading.NumTransforms": 1.0, 
"test-suite :: MultiSource/Benchmarks/mediabench/jpeg/jpeg-6a/cjpeg.test" : "dfa-jump-threading.NumTransforms": 1.0,

SPEC2017 function test result:

BenchmarkCompilation# DFAJumpThreading Transforms
554Success0
549Success0
544Success0
538Success2
527Success1
526Success2
521Success1
519Success0
511Success2
510Success4
508Success0
507Success2
503Success0
557Success4
548Success0
541Success0
531Success0
525Success0
523Success7
520Success6
505Success0
502Success3
500Success10

Diff Detail

Event Timeline

Yangguang created this revision.Dec 23 2022, 1:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 23 2022, 1:44 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Yangguang requested review of this revision.Dec 23 2022, 1:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 23 2022, 1:44 PM
xbolva00 accepted this revision.Dec 23 2022, 2:05 PM

Yes, we should have pass like this one in the optimization pipelines to achieve better jump threading optimizations (currently llvm is far behind gcc here).

Compile time data are pretty neutral, so probably just go ahead and try to enable it.

This revision is now accepted and ready to land.Dec 23 2022, 2:05 PM
nikic requested changes to this revision.Dec 23 2022, 3:04 PM

Isn't this missing updates for pipeline tests?

Compile-time: https://llvm-compile-time-tracker.com/compare.php?from=387c1573f89117687f4b964ae3a90ea7c91a4f90&to=2a66b841e34f385331226d2b4f89fffd1840cda1&stat=instructions%3Au

This is much more expensive than when I tested this the last time on August 2nd, 2021: https://llvm-compile-time-tracker.com/compare.php?from=380b8a603c6e8997819726b15a76b8f6c94aa21a&to=abb759c879725b7bc09a466e92c9b9eca7f8f483&stat=instructions:u At that time, the pass was pretty cheap, and as such a reasonable tradeoff. Now this doesn't seem to be the case anymore.

I looked through the history of the pass, and this is the only commit that looked like a significant change, so possibly it is at fault: https://github.com/llvm/llvm-project/commit/8b0d7634743965948234b666c77393d4dd8535d7

This revision now requires changes to proceed.Dec 23 2022, 3:04 PM
xbolva00 requested changes to this revision.Dec 23 2022, 3:45 PM

Right, new CT data from compile time tracker looks bad :/

Update pipeline tests

This is much more expensive than when I tested this the last time on August 2nd, 2021: https://llvm-compile-time-tracker.com/compare.php?from=380b8a603c6e8997819726b15a76b8f6c94aa21a&to=abb759c879725b7bc09a466e92c9b9eca7f8f483&stat=instructions:u At that time, the pass was pretty cheap, and as such a reasonable tradeoff. Now this doesn't seem to be the case anymore.

Taking the geomean of compile time change in the above table shows 0.23% increase in compile time. That is not acceptable?

nikic requested changes to this revision.Dec 29 2022, 1:42 PM

This is much more expensive than when I tested this the last time on August 2nd, 2021: https://llvm-compile-time-tracker.com/compare.php?from=380b8a603c6e8997819726b15a76b8f6c94aa21a&to=abb759c879725b7bc09a466e92c9b9eca7f8f483&stat=instructions:u At that time, the pass was pretty cheap, and as such a reasonable tradeoff. Now this doesn't seem to be the case anymore.

Taking the geomean of compile time change in the above table shows 0.23% increase in compile time. That is not acceptable?

Not sure how you arrived at that number (isn't it 0.44% geomean across optimized builds?), but no, these regressions are not acceptable for what the pass does, especially if we already know that it can be much faster.

Some of the regressions might be due to second-order effects (i.e. the transform triggers, and this affects compile-time of other transforms), but there are some really large regressions without code size changes, which indicate that the pass itself is slow. For example libclamav_regex_regexec.c has a 16% regression, configfile.c has a 12% regression and header.c has a 17% regression, all without changes in code size.

This revision now requires changes to proceed.Dec 29 2022, 1:42 PM

This is much more expensive than when I tested this the last time on August 2nd, 2021: https://llvm-compile-time-tracker.com/compare.php?from=380b8a603c6e8997819726b15a76b8f6c94aa21a&to=abb759c879725b7bc09a466e92c9b9eca7f8f483&stat=instructions:u At that time, the pass was pretty cheap, and as such a reasonable tradeoff. Now this doesn't seem to be the case anymore.

Taking the geomean of compile time change in the above table shows 0.23% increase in compile time. That is not acceptable?

Not sure how you arrived at that number (isn't it 0.44% geomean across optimized builds?), but no, these regressions are not acceptable for what the pass does, especially if we already know that it can be much faster.

Some of the regressions might be due to second-order effects (i.e. the transform triggers, and this affects compile-time of other transforms), but there are some really large regressions without code size changes, which indicate that the pass itself is slow. For example libclamav_regex_regexec.c has a 16% regression, configfile.c has a 12% regression and header.c has a 17% regression, all without changes in code size.

Thanks for the info! We are now working on the fix for the compile time issue.