Skip to content

[tmp] Access scope handling #31208

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

Closed
wants to merge 10 commits into from

Conversation

zoecarver
Copy link
Contributor

Don't merge this PR. This PR is to run the benchmarks and compare to #31078.

Adds support for projecting through begin_access instructions.
After low-level SSA passes, often the only use of an object will be dead stores. At some point after dead store elimination, dead object elimination is useful. The dead code elimination pass is fast and removes some remaining uses of the object after DSE (such as dead access instructions).
Simple check for the following pattern:
x = begin_access
end_access x
RLE can ignore end_access, set_deallocating, dealloc_ref, begin_access,
and strong_release instructions.

DSE can ignore end_access, set_deallocating, begin_access, and sometimes
strong_Release.
This means that "LastRelease" can be tracked through multiple basic blocks.
@zoecarver
Copy link
Contributor Author

@swift-ci please benchmark

@zoecarver
Copy link
Contributor Author

I should elaborate: I want to benchmark #31136 in isolation but, the performance improvements I'm looking for there are only possible with changes from other PRs. I've benchmarked all the live value analysis changes in #31078 so, I'm running the benchmarks on the non-alias analysis changes here. That way I can compare to two benchmark results and see if #31136 has a significant performance improvement.

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
Data.append.Sequence.64kB.Count.RE.I 21 44 +109.5% 0.48x
Data.append.Sequence.64kB.Count.RE 21 44 +109.5% 0.48x
Data.append.Sequence.809B.Count.RE 65 92 +41.5% 0.71x
Data.append.Sequence.809B.Count.RE.I 65 92 +41.5% 0.71x
DataAppendSequence 6600 9200 +39.4% 0.72x
PrefixWhileArrayLazy 20 26 +30.0% 0.77x
RemoveWhereMoveInts 19 23 +21.1% 0.83x
FlattenListLoop 2823 3403 +20.5% 0.83x (?)
PrefixSequenceLazy 22 26 +18.2% 0.85x
PrefixSequence 22 26 +18.2% 0.85x
ObjectiveCBridgeStubDateAccess 130 152 +16.9% 0.86x
DataSubscriptSmall 13 15 +15.4% 0.87x
DropWhileArray 21 24 +14.3% 0.88x
NopDeinit 8800 9900 +12.5% 0.89x
ArrayPlusEqualSingleElementCollection 423 470 +11.1% 0.90x (?)
RemoveWhereSwapInts 37 40 +8.1% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
PrefixWhileAnySequence 1165 193 -83.4% 6.04x
Set.subtracting.Seq.Int.Empty 183 110 -39.9% 1.66x
SortIntPyramid 730 465 -36.3% 1.57x
SortAdjacentIntPyramids 950 670 -29.5% 1.42x
SetSymmetricDifferenceInt100 146 105 -28.1% 1.39x
DropFirstSequence 40 29 -27.5% 1.38x
DropFirstSequenceLazy 40 29 -27.5% 1.38x
EqualSubstringSubstring 30 23 -23.3% 1.30x
LessSubstringSubstring 30 23 -23.3% 1.30x
EqualStringSubstring 30 23 -23.3% 1.30x
EqualSubstringSubstringGenericEquatable 30 23 -23.3% 1.30x
EqualSubstringString 30 23 -23.3% 1.30x
LessSubstringSubstringGenericComparable 30 23 -23.3% 1.30x
CharIteration_tweet_unicodeScalars 4840 3720 -23.1% 1.30x
CharIteration_ascii_unicodeScalars 2440 1880 -23.0% 1.30x (?)
DictionarySwap 872 684 -21.6% 1.27x
DataCountSmall 19 15 -21.1% 1.27x
Set.isSubset.Seq.Box0 1110 877 -21.0% 1.27x
DropWhileSequenceLazy 62 49 -21.0% 1.27x (?)
Set.isStrictSuperset.Seq.Box25 1109 877 -20.9% 1.26x
Set.isStrictSuperset.Seq.Box0 11042 8738 -20.9% 1.26x
Set.isStrictSubset.Seq.Box0 1092 878 -19.6% 1.24x
Set.isSubset.Seq.Box25 1224 993 -18.9% 1.23x
Set.isStrictSubset.Seq.Box25 1212 994 -18.0% 1.22x
DictionarySwapAt 680 564 -17.1% 1.21x
Array2D 4992 4192 -16.0% 1.19x
SetSymmetricDifferenceInt50 140 118 -15.7% 1.19x
DropWhileArrayLazy 58 49 -15.5% 1.18x
Set.subtracting.Seq.Empty.Int 129 110 -14.7% 1.17x
Set.intersection.Seq.Box0 320 274 -14.4% 1.17x (?)
CharIteration_punctuated_unicodeScalars 560 480 -14.3% 1.17x
Set.intersection.Seq.Box25 412 356 -13.6% 1.16x (?)
Prims.NonStrongRef.UnmanagedUGR 177 155 -12.4% 1.14x (?)
WordCountUniqueASCII 1470 1290 -12.2% 1.14x
Prims.NonStrongRef.UnmanagedUGR.Closure 177 156 -11.9% 1.13x (?)
DataCountMedium 17 15 -11.8% 1.13x
SetUnionBox25 266 235 -11.7% 1.13x (?)
SetSymmetricDifferenceBox25 403 358 -11.2% 1.13x (?)
StringRemoveDupes 247 221 -10.5% 1.12x (?)
SetUnion_OfObjects 4150 3740 -9.9% 1.11x (?)
Prims.NonStrongRef.Unmanaged 173 156 -9.8% 1.11x (?)
WordCountUniqueUTF16 1620 1470 -9.3% 1.10x
StringComparison_longSharedPrefix 358 325 -9.2% 1.10x
Prims.NonStrongRef.UnownedUnsafe 217 198 -8.8% 1.10x (?)
Prims.NonStrongRef.Unmanaged.Closure 172 157 -8.7% 1.10x (?)
Prims.NonStrongRef.UnownedUnsafe.Closure 217 199 -8.3% 1.09x (?)
SetExclusiveOr_OfObjects 5350 4910 -8.2% 1.09x (?)
AngryPhonebook 273 252 -7.7% 1.08x (?)
CharIteration_chinese_unicodeScalars 2320 2160 -6.9% 1.07x (?)

Code size: -O

Regression OLD NEW DELTA RATIO
PrimsNonStrongRef.o 121112 125720 +3.8% 0.96x
NopDeinit.o 4007 4055 +1.2% 0.99x
 
Improvement OLD NEW DELTA RATIO
Prefix.o 18608 17760 -4.6% 1.05x
PrefixWhile.o 18196 17654 -3.0% 1.03x
ExistentialPerformance.o 50428 49244 -2.3% 1.02x
DropWhile.o 18386 18036 -1.9% 1.02x
StringReplaceSubrange.o 5739 5659 -1.4% 1.01x
ObjectiveCBridgingStubs.o 16741 16517 -1.3% 1.01x
Combos.o 5070 5006 -1.3% 1.01x
AngryPhonebook.o 10038 9926 -1.1% 1.01x

Performance: -Osize

Regression OLD NEW DELTA RATIO
CharIndexing_chinese_unicodeScalars 3520 4480 +27.3% 0.79x
CharIndexing_tweet_unicodeScalars 7200 9160 +27.2% 0.79x
CharIndexing_ascii_unicodeScalars 3560 4520 +27.0% 0.79x
CharIndexing_punctuated_unicodeScalars 920 1160 +26.1% 0.79x (?)
CharIndexing_japanese_unicodeScalars 5920 7440 +25.7% 0.80x
CharIndexing_korean_unicodeScalars 4800 5880 +22.5% 0.82x
CharIteration_japanese_unicodeScalars 3440 4200 +22.1% 0.82x
CharIndexing_russian_unicodeScalars 4200 5080 +21.0% 0.83x
CharIndexing_punctuatedJapanese_unicodeScalars 960 1160 +20.8% 0.83x
CharIndexing_utf16_unicodeScalars 5200 6280 +20.8% 0.83x
CharIteration_tweet_unicodeScalars 4280 5120 +19.6% 0.84x
CharIteration_chinese_unicodeScalars 2040 2440 +19.6% 0.84x
CharIteration_ascii_unicodeScalars 2200 2600 +18.2% 0.85x
CharIteration_punctuatedJapanese_unicodeScalars 480 560 +16.7% 0.86x
CharIteration_punctuated_unicodeScalars 520 600 +15.4% 0.87x
CharIteration_korean_unicodeScalars 2680 3080 +14.9% 0.87x
CharIteration_russian_unicodeScalars 2480 2840 +14.5% 0.87x
DropFirstAnyCollection 100 112 +12.0% 0.89x (?)
Array2D 3984 4432 +11.2% 0.90x (?)
SuffixAnyCollection 37 41 +10.8% 0.90x (?)
DropLastAnyCollection 37 41 +10.8% 0.90x
 
Improvement OLD NEW DELTA RATIO
PrefixWhileAnySequence 1302 194 -85.1% 6.71x
Set.subtracting.Seq.Int.Empty 183 112 -38.8% 1.63x
LessSubstringSubstring 31 23 -25.8% 1.35x
LessSubstringSubstringGenericComparable 31 23 -25.8% 1.35x
EqualSubstringSubstring 30 23 -23.3% 1.30x
EqualStringSubstring 30 23 -23.3% 1.30x
EqualSubstringSubstringGenericEquatable 30 23 -23.3% 1.30x
EqualSubstringString 30 23 -23.3% 1.30x (?)
DictionarySwap 864 672 -22.2% 1.29x
Set.isStrictSuperset.Seq.Box0 11252 8801 -21.8% 1.28x
Set.isSubset.Seq.Box0 1126 882 -21.7% 1.28x
Set.isStrictSuperset.Seq.Box25 1124 883 -21.4% 1.27x
Set.isStrictSubset.Seq.Box0 1126 886 -21.3% 1.27x
Set.isSubset.Seq.Box25 1241 997 -19.7% 1.24x
Set.isStrictSubset.Seq.Box25 1243 1002 -19.4% 1.24x
DictionarySwapAt 684 556 -18.7% 1.23x
Set.intersection.Seq.Box0 327 277 -15.3% 1.18x
CharIteration_russian_unicodeScalars_Backwards 4120 3520 -14.6% 1.17x
Set.intersection.Seq.Box25 420 360 -14.3% 1.17x
Prims.NonStrongRef.Unmanaged.Closure 192 166 -13.5% 1.16x
Set.subtracting.Seq.Empty.Int 129 112 -13.2% 1.15x (?)
Prims.NonStrongRef.UnmanagedUGR 191 166 -13.1% 1.15x
Prims.NonStrongRef.UnmanagedUGR.Closure 191 166 -13.1% 1.15x
Prims.NonStrongRef.Unmanaged 189 165 -12.7% 1.15x (?)
SetSymmetricDifferenceBox25 409 361 -11.7% 1.13x
WordCountUniqueASCII 1470 1300 -11.6% 1.13x
SetUnionBox25 267 237 -11.2% 1.13x (?)
WordCountUniqueUTF16 1630 1460 -10.4% 1.12x (?)
StringComparison_longSharedPrefix 357 320 -10.4% 1.12x (?)
SetUnion_OfObjects 4170 3760 -9.8% 1.11x (?)
SetUnionBox0 416 376 -9.6% 1.11x (?)
Prims.NonStrongRef.UnownedUnsafe.Closure 229 208 -9.2% 1.10x (?)
Prims.NonStrongRef.UnownedUnsafe 229 208 -9.2% 1.10x (?)
SetExclusiveOr_OfObjects 5430 4940 -9.0% 1.10x (?)
SetSymmetricDifferenceBox0 543 494 -9.0% 1.10x (?)
StringUTF16Builder 230 210 -8.7% 1.10x (?)
StringRemoveDupes 265 242 -8.7% 1.10x (?)
PrefixWhileAnyCollection 153 140 -8.5% 1.09x
Walsh 630 579 -8.1% 1.09x (?)
AngryPhonebook 273 252 -7.7% 1.08x
SortAdjacentIntPyramids 1140 1055 -7.5% 1.08x (?)
DataAccessBytesMedium 58 54 -6.9% 1.07x (?)
PrefixAnyCollection 106 99 -6.6% 1.07x (?)
SetSubtractingBox25 197 184 -6.6% 1.07x (?)

Code size: -Osize

Improvement OLD NEW DELTA RATIO
PrefixWhile.o 16540 16316 -1.4% 1.01x
DropWhile.o 17940 17712 -1.3% 1.01x

Performance: -Onone

Improvement OLD NEW DELTA RATIO
LessSubstringSubstring 34 27 -20.6% 1.26x (?)
EqualSubstringSubstringGenericEquatable 34 27 -20.6% 1.26x
LessSubstringSubstringGenericComparable 34 27 -20.6% 1.26x
EqualSubstringSubstring 34 28 -17.6% 1.21x
EqualStringSubstring 34 28 -17.6% 1.21x
EqualSubstringString 34 28 -17.6% 1.21x
DictionarySwapAt 2912 2560 -12.1% 1.14x
SetSubtractingInt100 375 333 -11.2% 1.13x
Set.filter.Int100.24k 3154 2897 -8.1% 1.09x (?)
Set.filter.Int100.20k 2671 2466 -7.7% 1.08x (?)
Set.filter.Int100.28k 4075 3785 -7.1% 1.08x (?)
Set.filter.Int50.24k 1873 1747 -6.7% 1.07x (?)
Set.filter.Int50.16k 1324 1236 -6.6% 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 mini
  Model Identifier: Macmini8,1
  Processor Name: 6-Core Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

@zoecarver zoecarver closed this Apr 22, 2020
@zoecarver
Copy link
Contributor Author

A rough summary of the difference between the performance improvements with optimizations: the regressions are similar. There are five or six added regressions in both PRs (all 10-20% slower). There are about 50% more tests that had improvements (big and small) with the alias analysis patch. Given this, I think that the alias analysis patch is sufficiently beneficial.

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.

2 participants