Skip to content

SILOptimizer: some compile time fixes #23931

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 2 commits into from
Apr 10, 2019

Conversation

eeckstein
Copy link
Contributor

Disable some expensive optimizations for huge functions in SimplifyCFG and the performance inliner.
Those optimizations are not strictly linear with the number of blocks and cause compile time issues if the function is really huge.

SR-10209
rdar://problem/49522869

Disable constant folding and jump threading for functions with > 10000 blocks.
Those optimizations are not strictly linear with the number of blocks and cause compile time issues if the function is really huge.

SR-10209
rdar://problem/49522869
As the complexity of the analysis is more than linear with the number of blocks, disable it for functions with > 2000 basic blocks.
In this case inlining will be less aggressive.

SR-10209
rdar://problem/49522869
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein
Copy link
Contributor Author

@swift-ci benchmark

@atrick
Copy link
Contributor

atrick commented Apr 10, 2019

For the record, I'm all for disabling the SPA heuristic for large functions (I can't understand how the heuristic works anyway). But optimizations should be written such that they can be applied to any function size and either scale linearly or halt the analysis at a certain point rather than disabling an optimization completely based on an arbitrary function size.

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Regression
DataAppendDataLargeToLarge 32800 45200 +37.8% 0.73x (?)

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
DataAppendDataLargeToLarge 33000 45400 +37.6% 0.73x (?)
ObjectiveCBridgeStubFromNSDateRef 3640 3940 +8.2% 0.92x (?)
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: 8-Core Intel Xeon E5
  Processor Speed: 3 GHz
  Number of Processors: 1
  Total Number of Cores: 8
  L2 Cache (per Core): 256 KB
  L3 Cache: 25 MB
  Memory: 64 GB

@eeckstein eeckstein merged commit 9381dee into swiftlang:master Apr 10, 2019
@eeckstein eeckstein deleted the compile-time-fixes branch April 10, 2019 23:22
@Valpertui
Copy link
Contributor

Maybe we should add some tests to ensure those kind of compile time regression doesn't get released unnoticed anymore ?

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.

4 participants