Skip to content

OSSA: migrate & organize simplify-cfg tests #38456

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

Merged
merged 13 commits into from
Jul 18, 2021

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jul 17, 2021

Migrate all the simplify-cfg tests to OSSA and organize them by functionality for staging and debugging sanity (there were a massive number of disorganized tests for this pass).

This PR also adds some basic support for handling trivial block arguments just so that most tests will pass.

This is work in progress. We still need to enable some of the tests and add more tests for OSSA functionality before completely turning on the pass.

I'm merging incrementally now so anyone can make progress. This has been sitting on a branch for 4 months.

This introduces two temporary testing flags. -enable-ossa-simplifycfg and -enable-ossa-jumpthread-simplifycfg. They allow running simplify-cfg test cases without affecting regular compilation. The flags will be removed as soon as we have enough test coverage to confidently enable these parts of simplify-cfg that are still guarded by the flag.

The following test files still need to be enabled
simplify_bb_args.sil
simplify_cfg_args_ossa_disabled.sil
simplify_cfg_checkcast.sil
simplify_cfg_ossa_disabled.sil

@atrick
Copy link
Contributor Author

atrick commented Jul 17, 2021

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jul 17, 2021

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e9856fd88d7f3f96249f66f90144a0079a1242c5

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e9856fd88d7f3f96249f66f90144a0079a1242c5

@swift-ci
Copy link
Contributor

Performance (x86_64): -O

Regression OLD NEW DELTA RATIO
DictionaryOfAnyHashableStrings_insert 2884 5586 +93.7% 0.52x
ArrayAppendOptionals 1330 2500 +88.0% 0.53x (?)
Set.isDisjoint.Box25 357 508 +42.3% 0.70x (?)
Set.isDisjoint.Int50 268 340 +26.9% 0.79x (?)
DictionaryKeysContainsNative 21 26 +23.8% 0.81x (?)
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeStubFromArrayOfNSString2 2850 2660 -6.7% 1.07x (?)

Code size: -O

Performance (x86_64): -Osize

Regression OLD NEW DELTA RATIO
FlattenListFlatMap 4089 6976 +70.6% 0.59x (?)
NSError 184 206 +12.0% 0.89x (?)
 
Improvement OLD NEW DELTA RATIO
NSStringConversion.Rebridge.Long 181 168 -7.2% 1.08x (?)

Code size: -Osize

Performance (x86_64): -Onone

Improvement OLD NEW DELTA RATIO
StringBuilderWithLongSubstring 4020 3500 -12.9% 1.15x (?)
String.data.LargeUnicode 174 161 -7.5% 1.08x (?)

Code size: -swiftlibs

How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the
regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false
alarms. Unexpected regressions which are marked with '(?)' are probably noise.
If you see regressions which you cannot explain you can try to run the
benchmarks again. If regressions still show up, please consult with the
performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

@atrick atrick force-pushed the ossa-jumpthread-test branch from e9856fd to e7fcd68 Compare July 18, 2021 02:37
@atrick
Copy link
Contributor Author

atrick commented Jul 18, 2021

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jul 18, 2021

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance (x86_64): -O

Regression OLD NEW DELTA RATIO
DictionaryOfAnyHashableStrings_insert 2954 5628 +90.5% 0.52x
Set.isDisjoint.Int25 268 346 +29.1% 0.77x (?)
Set.isDisjoint.Int50 268 338 +26.1% 0.79x (?)
DictionaryKeysContainsNative 21 26 +23.8% 0.81x (?)
ObjectiveCBridgeStubFromNSDateRef 4200 5120 +21.9% 0.82x (?)
DictionaryKeysContainsCocoa 27 31 +14.8% 0.87x (?)
StringRemoveDupes 268 293 +9.3% 0.91x (?)
 
Improvement OLD NEW DELTA RATIO
FlattenListLoop 2553 1630 -36.2% 1.57x (?)
FlattenListFlatMap 6731 4372 -35.0% 1.54x (?)

Code size: -O

Performance (x86_64): -Osize

Regression OLD NEW DELTA RATIO
FlattenListFlatMap 3943 4827 +22.4% 0.82x (?)
 
Improvement OLD NEW DELTA RATIO
NSStringConversion.MutableCopy.Rebridge 1173 1077 -8.2% 1.09x (?)
DictionaryKeysContainsCocoa 28 26 -7.1% 1.08x (?)

Code size: -Osize

Performance (x86_64): -Onone

Regression OLD NEW DELTA RATIO
String.data.LargeUnicode 170 189 +11.2% 0.90x (?)
NSStringConversion.Rebridge.Medium 278 299 +7.6% 0.93x (?)
NSStringConversion.Rebridge.Long 278 299 +7.6% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
StringBuilderLong 1990 1810 -9.0% 1.10x (?)
NSError 738 687 -6.9% 1.07x (?)

Code size: -swiftlibs

How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the
regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false
alarms. Unexpected regressions which are marked with '(?)' are probably noise.
If you see regressions which you cannot explain you can try to run the
benchmarks again. If regressions still show up, please consult with the
performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

And organize the tests by the features/optimizations that they
require!

<file containing non-OSSA tests>
  -> <files containing OSSA tests>

simplify-cfg-debugonly.sil
  -> simplify_cfg_checkcast.sil

simplify-cfg-stress-test.sil
  -> simplify_cfg_stress_ossa.sil

simplify_cfg_address_phi.sil
  -> simplify_cfg_simple_jumpthread.sil
  -> simplify_cfg_dom_jumpthread.sil

simplify_cfg_and_combine.sil
  -> simplify_cfg_and_combine_ossa.sil

simplify_cfg_args.sil
  -> simplify_cfg_args_ossa.sil
  -> simplify_cfg_args_ossa_disabled.sil

simplify_cfg_args_crash.sil
  -> simplify_bb_args.sil

simplify_cfg.sil
  -> simplify_cfg_ossa.sil
  -> simplify_cfg_ossa_disabled.sil
  -> simplify_cfg_tryapply.sil
  -> simplify_cfg_trivial_jumpthread.sil
  -> simplify_cfg_simple_jumpthread.sil
  -> simplify_cfg_checkcast.sil
  -> simplify_cfg_dom_jumpthread.sil

simplify_cfg_jump_thread_crash.sil
  -> simplify_cfg_dom_jumpthread.sil

simplify_cfg_opaque.sil
  -> <self>

simplify_cfg_select_enum.sil
  -> simplify_cfg_dom_jumpthread.sil

simplify_cfg_simple.sil
  -> simplify_cfg_ossa.sil
  -> simplify_cfg_simple_jumpthread.sil

simplify_cfg_unique_values.sil
  -> simplify_cfg_dominators.sil

simplify_switch_enum_objc.sil
  -> simplify_switch_enum_objc.sil
@atrick atrick force-pushed the ossa-jumpthread-test branch from e7fcd68 to 59ad8c9 Compare July 18, 2021 04:40
@atrick
Copy link
Contributor Author

atrick commented Jul 18, 2021

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 59ad8c9

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 59ad8c9

@atrick
Copy link
Contributor Author

atrick commented Jul 18, 2021

@swift-ci smoke test

@atrick
Copy link
Contributor Author

atrick commented Jul 18, 2021

Filed a priority bug to fix the benchmark regression ASAP, but in parallel with other tasks (it's blocking multiple unrelated PRs)
rdar://80746149 (Fix 90% performance regression in benchmark DictionaryOfAnyHashableStrings_insert)

@atrick
Copy link
Contributor Author

atrick commented Jul 18, 2021

@swift-ci smoke test macOS

@atrick
Copy link
Contributor Author

atrick commented Jul 18, 2021

@swift-ci test windows

@atrick atrick merged commit ff1f419 into swiftlang:main Jul 18, 2021
@atrick atrick deleted the ossa-jumpthread-test branch July 18, 2021 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants