Skip to content

Lower OwnershipModelEliminator to just before inlining #68180

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 8 commits into from
Jan 10, 2024

Conversation

meg-gupta
Copy link
Contributor

No description provided.

@meg-gupta
Copy link
Contributor Author

@swift-ci please apple silicon benchmark

@meg-gupta meg-gupta changed the title Lower OwnershipModelEliminator to just before inlining [DNM] Lower OwnershipModelEliminator to just before inlining Aug 29, 2023
@meg-gupta meg-gupta changed the title [DNM] Lower OwnershipModelEliminator to just before inlining Lower OwnershipModelEliminator to just before inlining Oct 23, 2023
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci please apple silicon benchmark

@meg-gupta meg-gupta marked this pull request as ready for review October 23, 2023 06:15
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

meg-gupta added a commit to meg-gupta/swift that referenced this pull request Nov 1, 2023
Remove unnecessary cases
@meg-gupta meg-gupta requested review from a team and eeckstein as code owners November 1, 2023 23:06
@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@Azoy
Copy link
Contributor

Azoy commented Nov 1, 2023

Would this let us bring back the move only deinit devirtualizer?

@atrick
Copy link
Contributor

atrick commented Nov 2, 2023

Would this let us bring back the move only deinit devirtualizer?

I don't think there's anything stopping it from being enabled if there's a compelling need. It should run at the end of the OSSA pipeline. Ideally, this would also be combined with the regular release devirtualizer.
It would be nice to complete the implementation of the pass itself. lookUpMoveOnlyDeinit might have completely arbitrary limitations and may not be well tested.

@eeckstein
Copy link
Contributor

It would be nice to complete the implementation of the pass itself.

I'm working on this because we need it for embedded swift - as a mandatory optimization

https://github.com/eeckstein/swift/blob/fixed-array/SwiftCompilerSources/Sources/Optimizer/Utilities/Devirtualization.swift

meg-gupta added a commit to meg-gupta/swift that referenced this pull request Nov 2, 2023
Remove unnecessary cases
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@meg-gupta
Copy link
Contributor Author

Benchmarks look clean:

------- Performance (arm64): -O -------

REGRESSION OLD NEW DELTA RATIO
InsertCharacterEndIndexNonASCII 21.556 23.786 +10.3% 0.91x (?)

IMPROVEMENT OLD NEW DELTA RATIO
NopDeinit 26550.0 20310.0 -23.5% 1.31x
SIMDReduce.Int32x16.Initializer 13.413 11.07 -17.5% 1.21x (?)
NaiveRRC.append.smallContiguousRepeated 80.227 69.455 -13.4% 1.16x (?)
ParseFloat.Double.Exp 6.511 5.867 -9.9% 1.11x
CharacterPropertiesStashed 484.118 437.963 -9.5% 1.11x (?)

------- Code size: -O -------

REGRESSION OLD NEW DELTA RATIO
FloatingPointParsing.o 7295 7823 +7.2% 0.93x

####### Testing optimization level -Osize #######
------- Performance (arm64): -Osize -------

REGRESSION OLD NEW DELTA RATIO
ObserverForwarderStruct 192.885 229.4 +18.9% 0.84x (?)
CxxVecU32.sum.Swift.reduce 68.219 78.258 +14.7% 0.87x (?)
CxxVecU32.sum.Swift.forInLoop 68.083 77.955 +14.5% 0.87x

IMPROVEMENT OLD NEW DELTA RATIO
DataAccessBytesMedium 46.783 34.3 -26.7% 1.36x
DataAccessBytesSmall 49.882 37.432 -25.0% 1.33x
NopDeinit 32800.0 26550.0 -19.1% 1.24x (?)
UTF16Decode.initFromCustom.cont 390.0 362.0 -7.2% 1.08x (?)

------- Code size: -Osize -------

####### Testing optimization level -Onone #######

------- Performance (arm64): -Onone -------

REGRESSION OLD NEW DELTA RATIO
DataAppendArray 1900.0 2193.75 +15.5% 0.87x (?)
RawBufferCopyBytes 12.488 14.056 +12.6% 0.89x (?)
Data.init.Sequence.64kB.Count.I 737.0 819.0 +11.1% 0.90x (?)
Data.init.Sequence.64kB.Count 737.0 819.0 +11.1% 0.90x (?)
Data.append.Sequence.64kB.Count.I 737.333 819.0 +11.1% 0.90x
Data.append.Sequence.64kB.Count 737.333 819.0 +11.1% 0.90x
Data.init.Sequence.2049B.Count.I 1162.0 1290.0 +11.0% 0.90x (?)
Data.init.Sequence.2047B.Count.I 1161.0 1288.0 +10.9% 0.90x (?)
Data.init.Sequence.809B.Count.I 930.0 1031.0 +10.9% 0.90x (?)
Data.init.Sequence.809B.Count 930.0 1031.0 +10.9% 0.90x (?)
Data.append.Sequence.809B.Count 940.5 1042.0 +10.8% 0.90x (?)
Data.append.Sequence.809B.Count.I 941.0 1042.5 +10.8% 0.90x (?)
Data.init.Sequence.511B.Count.I 896.0 991.5 +10.7% 0.90x (?)
Data.init.Sequence.513B.Count.I 899.5 994.5 +10.6% 0.90x (?)
String.replaceSubrange.Substring.Small 22.552 24.564 +8.9% 0.92x (?)

IMPROVEMENT OLD NEW DELTA RATIO
Set.filter.Int100.24k 92.148 62.35 -32.3% 1.48x
Set.filter.Int100.20k 77.188 52.375 -32.1% 1.47x
Set.filter.Int100.16k 62.194 42.379 -31.9% 1.47x
Set.filter.Int100.28k 109.273 74.636 -31.7% 1.46x
ArrayAppendGenericStructs 893.333 680.909 -23.8% 1.31x (?)
StringWithCString2 0.005 0.004 -16.7% 1.20x (?)
SIMDReduce.Int32x4.Cast 593.25 514.5 -13.3% 1.15x (?)
RandomInt64LCG 15913.0 14656.0 -7.9% 1.09x (?)
ArrayAppendToGeneric 352.581 326.034 -7.5% 1.08x (?)

@meg-gupta
Copy link
Contributor Author

Seems to have exposed a bug in Linux.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

1 similar comment
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

1 similar comment
@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@meg-gupta
Copy link
Contributor Author

@swift-ci test

meg-gupta added a commit to meg-gupta/swift that referenced this pull request Dec 6, 2023
Remove unnecessary cases
meg-gupta added a commit to meg-gupta/swift that referenced this pull request Dec 14, 2023
Remove unnecessary cases
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci build toolchain

@meg-gupta
Copy link
Contributor Author

@swift-ci test source compatibility

@meg-gupta
Copy link
Contributor Author

@swift-ci test Linux Platform

meg-gupta added a commit to meg-gupta/swift that referenced this pull request Jan 8, 2024
Remove unnecessary cases
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@meg-gupta
Copy link
Contributor Author

@swift-ci test source compatibility

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta
Copy link
Contributor Author

@swift-ci build toolchain

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta
Copy link
Contributor Author

@swift-ci build toolchain Linux platform

@meg-gupta
Copy link
Contributor Author

@swift-ci test linux

@meg-gupta
Copy link
Contributor Author

@swift-ci build toolchain linux platform

@meg-gupta meg-gupta merged commit 5d2454f into swiftlang:main Jan 10, 2024
Catfish-Man pushed a commit to Catfish-Man/swift that referenced this pull request Jan 19, 2024
Remove unnecessary cases
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