Skip to content

Fix problem with protocol resilience #22737

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
Feb 21, 2019

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Feb 20, 2019

Fixes rdar://problem/48226583.

@slavapestov slavapestov changed the title Fix problem with protocol resilience Fix problem with protocol resilience [WIP] Feb 20, 2019
@slavapestov
Copy link
Contributor Author

@compnerd Now that isResilientConformance() is a method on IRGenModule, you should be able to just check the new flag you put into IRGenOptions without changing anything else.

@slavapestov
Copy link
Contributor Author

@swift-ci Please benchmark

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Regression
ProtocolDispatch2 357 414 +16.0% 0.86x
RandomDoubleLCG 914 1056 +15.5% 0.87x
DataCountSmall 22 25 +13.6% 0.88x
DataCountMedium 28 31 +10.7% 0.90x (?)
Data.hash.Empty 68 74 +8.8% 0.92x
Improvement
PrefixWhileAnySeqCRangeIter 358 322 -10.1% 1.11x
PrefixWhileAnySeqCntRange 358 322 -10.1% 1.11x (?)
DataSubscriptSmall 31 28 -9.7% 1.11x
FlattenListLoop 4331 3970 -8.3% 1.09x (?)
SuffixSequence 589 541 -8.1% 1.09x
SuffixSequenceLazy 589 541 -8.1% 1.09x
Array2D 7520 6912 -8.1% 1.09x (?)
SuffixAnySequence 588 541 -8.0% 1.09x
DropLastSequenceLazy 576 533 -7.5% 1.08x (?)
MapReduce 397 368 -7.3% 1.08x (?)
DropLastSequence 575 533 -7.3% 1.08x
ObjectiveCBridgeStubNSDateRefAccess 400 371 -7.2% 1.08x (?)
FlattenListFlatMap 6517 6054 -7.1% 1.08x (?)
MapReduceAnyCollection 398 370 -7.0% 1.08x
DictionaryGroup 245 228 -6.9% 1.07x (?)

Code size: -O

TEST OLD NEW DELTA RATIO
Regression
NSDictionaryCastToSwift.o 1689 1769 +4.7% 0.95x
ReversedCollections.o 11387 11883 +4.4% 0.96x
DeadArray.o 1892 1972 +4.2% 0.96x
MonteCarloPi.o 1593 1657 +4.0% 0.96x
DictionaryOfAnyHashableStrings.o 10861 11245 +3.5% 0.97x
NopDeinit.o 5584 5779 +3.5% 0.97x
TwoSum.o 5572 5764 +3.4% 0.97x
HashQuadratic.o 5676 5868 +3.4% 0.97x
DictionaryCopy.o 7885 8141 +3.2% 0.97x
DictTest.o 19929 20567 +3.2% 0.97x
XorLoop.o 2028 2092 +3.2% 0.97x
DictionaryBridgeToObjC.o 6169 6361 +3.1% 0.97x
Fibonacci.o 1612 1660 +3.0% 0.97x
SevenBoom.o 1642 1690 +2.9% 0.97x
ByteSwap.o 1652 1700 +2.9% 0.97x
RangeIteration.o 1700 1748 +2.8% 0.97x
PointerArithmetics.o 1759 1807 +2.7% 0.97x
DictTest2.o 14635 15019 +2.6% 0.97x
Ackermann.o 1852 1900 +2.6% 0.97x
BitCount.o 1876 1924 +2.6% 0.98x
ProtocolDispatch2.o 1920 1968 +2.5% 0.98x
DictionaryKeysContains.o 10751 11007 +2.4% 0.98x
DictionaryBridge.o 3374 3454 +2.4% 0.98x
StringRemoveDupes.o 7648 7824 +2.3% 0.98x
DictionaryLiteral.o 1392 1424 +2.3% 0.98x
DropWhile.o 22980 23508 +2.3% 0.98x
Histogram.o 4203 4299 +2.3% 0.98x
PrefixWhile.o 21358 21838 +2.2% 0.98x
Memset.o 2148 2196 +2.2% 0.98x
DictionaryRemove.o 14456 14772 +2.2% 0.98x
DropFirst.o 24996 25540 +2.2% 0.98x
FloatingPointPrinting.o 5911 6039 +2.2% 0.98x
RGBHistogram.o 26998 27574 +2.1% 0.98x
WordCount.o 45195 46116 +2.0% 0.98x
LinkedList.o 2376 2424 +2.0% 0.98x
Integrate.o 2456 2504 +2.0% 0.98x
DictTest3.o 22155 22587 +1.9% 0.98x
MonteCarloE.o 3396 3460 +1.9% 0.98x
DictionaryCompactMapValues.o 18673 19009 +1.8% 0.98x
Calculator.o 2708 2756 +1.8% 0.98x
Prefix.o 24377 24809 +1.8% 0.98x
ChainedFilterMap.o 2750 2798 +1.7% 0.98x
StrComplexWalk.o 2785 2833 +1.7% 0.98x
COWTree.o 13211 13435 +1.7% 0.98x
UTF8Decode.o 12590 12798 +1.7% 0.98x
DictionarySwap.o 21700 22048 +1.6% 0.98x
DictionarySubscriptDefault.o 28057 28505 +1.6% 0.98x
OpenClose.o 3216 3264 +1.5% 0.99x
ArrayLiteral.o 3311 3359 +1.4% 0.99x
Suffix.o 25841 26177 +1.3% 0.99x
RandomValues.o 3856 3904 +1.2% 0.99x
ArraySubscript.o 3892 3940 +1.2% 0.99x
PopFront.o 5197 5261 +1.2% 0.99x
ObjectAllocation.o 4139 4187 +1.2% 0.99x
RC4.o 4219 4267 +1.1% 0.99x
DropLast.o 26027 26315 +1.1% 0.99x
StringInterpolation.o 7267 7347 +1.1% 0.99x
CharacterProperties.o 19388 19596 +1.1% 0.99x
StringEdits.o 11983 12111 +1.1% 0.99x
Exclusivity.o 4507 4555 +1.1% 0.99x
SequenceAlgos.o 19930 20138 +1.0% 0.99x
NibbleSort.o 12420 12548 +1.0% 0.99x
ReduceInto.o 17161 17337 +1.0% 0.99x
PopFrontGeneric.o 4702 4750 +1.0% 0.99x

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
PrefixAnySeqCntRangeLazy 159 176 +10.7% 0.90x (?)
SubstringComparable 12 13 +8.3% 0.92x (?)
Improvement
DropWhileAnySeqCRangeIter 198 163 -17.7% 1.21x (?)
PrefixAnySeqCRangeIterLazy 176 159 -9.7% 1.11x (?)
RandomDoubleLCG 980 886 -9.6% 1.11x (?)
DropWhileAnySeqCntRange 180 163 -9.4% 1.10x (?)
ObjectiveCBridgeStubFromNSDateRef 4420 4080 -7.7% 1.08x (?)
SortLettersInPlace 552 511 -7.4% 1.08x (?)

Code size: -Osize

TEST OLD NEW DELTA RATIO
Regression
SevenBoom.o 1816 1938 +6.7% 0.94x
DictionaryLiteral.o 1075 1145 +6.5% 0.94x
NSDictionaryCastToSwift.o 1722 1834 +6.5% 0.94x
BitCount.o 1634 1698 +3.9% 0.96x
TwoSum.o 3093 3205 +3.6% 0.97x
Histogram.o 1920 1984 +3.3% 0.97x
MonteCarloPi.o 1578 1626 +3.0% 0.97x
ReversedCollections.o 9610 9898 +3.0% 0.97x
Fibonacci.o 1642 1690 +2.9% 0.97x
NSError.o 1663 1711 +2.9% 0.97x
ByteSwap.o 1682 1730 +2.9% 0.97x
HashQuadratic.o 2880 2959 +2.7% 0.97x
DictionaryBridge.o 3500 3596 +2.7% 0.97x
RangeIteration.o 1770 1818 +2.7% 0.97x
StringRemoveDupes.o 4857 4984 +2.6% 0.97x
PointerArithmetics.o 1864 1912 +2.6% 0.97x
DeadArray.o 1890 1938 +2.5% 0.98x
DictionaryOfAnyHashableStrings.o 7581 7773 +2.5% 0.98x
ProtocolDispatch2.o 1948 1996 +2.5% 0.98x
Ackermann.o 1957 2005 +2.5% 0.98x
XorLoop.o 2098 2146 +2.3% 0.98x
Memset.o 2114 2162 +2.3% 0.98x
DictionaryBridgeToObjC.o 5387 5499 +2.1% 0.98x
LinkedList.o 2313 2361 +2.1% 0.98x
NopDeinit.o 6260 6388 +2.0% 0.98x
Integrate.o 2454 2502 +2.0% 0.98x
DictionaryCopy.o 6177 6289 +1.8% 0.98x
DictTest2.o 9737 9912 +1.8% 0.98x
DictionaryKeysContains.o 8119 8263 +1.8% 0.98x
Calculator.o 2722 2770 +1.8% 0.98x
StrComplexWalk.o 2770 2818 +1.7% 0.98x
UTF8Decode.o 10878 11054 +1.6% 0.98x
ArrayLiteral.o 3109 3157 +1.5% 0.98x
NibbleSort.o 14548 14772 +1.5% 0.98x
DropWhile.o 22036 22356 +1.5% 0.99x
PrefixWhile.o 20134 20422 +1.4% 0.99x
DictTest.o 12489 12665 +1.4% 0.99x
Suffix.o 24681 25017 +1.4% 0.99x
RandomValues.o 3529 3577 +1.4% 0.99x
ChainedFilterMap.o 3566 3614 +1.3% 0.99x
DictionaryRemove.o 9741 9869 +1.3% 0.99x
OpenClose.o 3662 3710 +1.3% 0.99x
ReduceInto.o 9939 10067 +1.3% 0.99x
Prefix.o 22393 22681 +1.3% 0.99x
RangeAssignment.o 5018 5082 +1.3% 0.99x
MonteCarloE.o 3778 3826 +1.3% 0.99x
DictTest3.o 14041 14216 +1.2% 0.99x
SortLettersInPlace.o 9038 9150 +1.2% 0.99x
RC4.o 3926 3974 +1.2% 0.99x
DictionaryCompactMapValues.o 12133 12281 +1.2% 0.99x
DropFirst.o 22532 22804 +1.2% 0.99x
ObjectAllocation.o 4046 4094 +1.2% 0.99x
DropLast.o 24419 24707 +1.2% 0.99x
StringInterpolation.o 6922 7002 +1.2% 0.99x
ArraySubscript.o 4163 4211 +1.2% 0.99x
Exclusivity.o 4372 4420 +1.1% 0.99x
RGBHistogram.o 23694 23934 +1.0% 0.99x

Performance: -Onone

TEST OLD NEW DELTA RATIO
Regression
Integrate 2050 2212 +7.9% 0.93x (?)

Code size: -swiftlibs

TEST OLD NEW DELTA RATIO
Regression
libswiftCoreGraphics.dylib 61440 65536 +6.7% 0.94x
libswiftFoundation.dylib 1585152 1613824 +1.8% 0.98x
libswiftStdlibUnittest.dylib 360448 364544 +1.1% 0.99x
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 fix-protocol-resilience branch from 900391f to 73b248f Compare February 20, 2019 20:08
@slavapestov
Copy link
Contributor Author

@swift-ci Please benchmark

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please benchmark

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov changed the title Fix problem with protocol resilience [WIP] Fix problem with protocol resilience Feb 20, 2019
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Regression
DataSetCountSmall 131 160 +22.1% 0.82x
Data.hash.Empty 68 74 +8.8% 0.92x (?)

Code size: -O

TEST OLD NEW DELTA RATIO
Regression
UTF8Decode.o 12506 12746 +1.9% 0.98x

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
DataSubscriptSmall 25 31 +24.0% 0.81x
DataSetCountSmall 131 162 +23.7% 0.81x
DataCountSmall 25 28 +12.0% 0.89x
DataCountMedium 31 34 +9.7% 0.91x (?)

Code size: -Osize

TEST OLD NEW DELTA RATIO
Regression
UTF8Decode.o 10849 11025 +1.6% 0.98x

Performance: -Onone

TEST OLD NEW DELTA RATIO
Regression
DataSetCountSmall 197 225 +14.2% 0.88x (?)
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 fix-protocol-resilience branch from 73b248f to 82d1ae1 Compare February 20, 2019 21:48
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

If the conforming type is generic, we have to treat the conformance as
resilient if it is defined outside of the current module.

This is because it can resiliently change from being non-dependent
to dependent.
@slavapestov slavapestov force-pushed the fix-protocol-resilience branch from 82d1ae1 to 71ab1bb Compare February 21, 2019 01:00
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@slavapestov slavapestov merged commit b9eb17c into swiftlang:master Feb 21, 2019
@compnerd
Copy link
Member

This change caused a regression on Windows.

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