Skip to content

SIL: Don't drop generic signatures where all parameters are concrete #23291

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

Conversation

slavapestov
Copy link
Contributor

No description provided.

@slavapestov
Copy link
Contributor Author

@jrose-apple I realized this changes optimizer behavior; if the benchmark results are affected we'll have to tweak this a little bit.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please benchmark

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Regression
LessSubstringSubstring 39 44 +12.8% 0.89x
EqualStringSubstring 39 43 +10.3% 0.91x
EqualSubstringString 39 43 +10.3% 0.91x
LessSubstringSubstringGenericComparable 39 43 +10.3% 0.91x
EqualSubstringSubstring 39 42 +7.7% 0.93x (?)
EqualSubstringSubstringGenericEquatable 39 42 +7.7% 0.93x
ObjectiveCBridgeStubFromNSDateRef 4060 4370 +7.6% 0.93x (?)
Improvement
DictionaryBridgeToObjC_Access 1014 905 -10.7% 1.12x (?)
FlattenListLoop 4336 3976 -8.3% 1.09x
Array2D 7520 6912 -8.1% 1.09x (?)
MapReduce 397 368 -7.3% 1.08x (?)
FlattenListFlatMap 6540 6074 -7.1% 1.08x (?)
MapReduceAnyCollection 397 369 -7.1% 1.08x

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
LessSubstringSubstringGenericComparable 39 44 +12.8% 0.89x
EqualSubstringSubstring 39 43 +10.3% 0.91x
EqualStringSubstring 39 43 +10.3% 0.91x (?)
LessSubstringSubstring 40 44 +10.0% 0.91x
EqualSubstringSubstringGenericEquatable 40 44 +10.0% 0.91x
EqualSubstringString 40 44 +10.0% 0.91x
Improvement
FlattenListLoop 4433 4069 -8.2% 1.09x (?)
Array2D 7520 6912 -8.1% 1.09x (?)
MapReduce 433 404 -6.7% 1.07x

Performance: -Onone

TEST OLD NEW DELTA RATIO
Regression
ArrayOfPOD 776 855 +10.2% 0.91x (?)
EqualStringSubstring 46 50 +8.7% 0.92x (?)
Improvement
DictionaryGroup 8663 7832 -9.6% 1.11x (?)
DropWhileAnySeqCRangeIter 54913 49966 -9.0% 1.10x (?)
DropWhileAnySeqCntRange 55173 50292 -8.8% 1.10x (?)
StrComplexWalk 7280 6640 -8.8% 1.10x
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

@slavapestov slavapestov force-pushed the all-generic-params-are-concrete-fix branch from 6185498 to d7a0425 Compare March 14, 2019 20:53
@slavapestov
Copy link
Contributor Author

Ok, this should now fix the optimizer crash. If it doesn't do it, I'll have to do a spot fix and postpone this for now since it's already more painful than I imagined.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

2 similar comments
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please benchmark

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Regression
LessSubstringSubstring 39 44 +12.8% 0.89x
EqualStringSubstring 39 43 +10.3% 0.91x (?)
EqualSubstringString 39 43 +10.3% 0.91x
LessSubstringSubstringGenericComparable 39 43 +10.3% 0.91x
FlattenListLoop 3976 4336 +9.1% 0.92x
Array2D 6912 7520 +8.8% 0.92x
DictionaryOfAnyHashableStrings_lookup 3912 4224 +8.0% 0.93x (?)
MapReduce 368 397 +7.9% 0.93x
EqualSubstringSubstring 39 42 +7.7% 0.93x
EqualSubstringSubstringGenericEquatable 39 42 +7.7% 0.93x (?)
FlattenListFlatMap 6083 6549 +7.7% 0.93x (?)
SubstringEqualString 405 436 +7.7% 0.93x (?)
MapReduceAnyCollection 369 397 +7.6% 0.93x (?)

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
LessSubstringSubstringGenericComparable 39 44 +12.8% 0.89x
EqualSubstringSubstring 39 43 +10.3% 0.91x (?)
EqualStringSubstring 39 43 +10.3% 0.91x (?)
LessSubstringSubstring 40 44 +10.0% 0.91x
EqualSubstringSubstringGenericEquatable 40 44 +10.0% 0.91x
EqualSubstringString 40 44 +10.0% 0.91x
FlattenListLoop 4070 4431 +8.9% 0.92x (?)
Array2D 6912 7520 +8.8% 0.92x (?)
SubstringEqualString 404 438 +8.4% 0.92x (?)
Set.isDisjoint.Box.Empty 190 205 +7.9% 0.93x

Performance: -Onone

TEST OLD NEW DELTA RATIO
Regression
ArrayOfPOD 776 857 +10.4% 0.91x (?)
Improvement
StrComplexWalk 7280 6560 -9.9% 1.11x
WordCountUniqueASCII 13040 11980 -8.1% 1.09x (?)
WordCountUniqueUTF16 13390 12340 -7.8% 1.09x (?)
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

@jrose-apple
Copy link
Contributor

Is it just that we're considering these less profitable to inline or something?

@slavapestov
Copy link
Contributor Author

@jrose-apple We don't inline generic functions at all actually

@gottesmm
Copy link
Contributor

@slavapestov this is not true. I think we do it in the standard library. This is a piece of work that we did not have enough manpower to finish when @swiftix left. I think the problem was that we did not find a good heuristic yet that didn't create too much code-size increase. But for the stdlib it wasn't so bad and we saw nice perf increase.

@atrick
Copy link
Contributor

atrick commented Mar 21, 2019

@slavapestov are you picking this for 5.1? If so, I don't need to pick my fix.

@shahmishal
Copy link
Member

Please update the base branch to main by Oct 5th otherwise the pull request will be closed automatically.

  • How to change the base branch: (Link)
  • More detail about the branch update: (Link)

@shahmishal shahmishal closed this Oct 5, 2020
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.

6 participants