-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[WIP] [NO-MERGE] Make "unique" flag more robust and update access enforcement opts to make use of it. #32877
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
Adds a new flag to alloc_ref instructions. This flag, "unique", signifies that the reference is unique meaning it is not stored elsewhere and may not be written to elsewhere. This means accesses of this reference may be "static" instead of "dynamic". Uniqueness of the reference is enforced by the SILVerifier. This is good because it may be run between each pass so errors will be easy to track down. Currently the SILVerifier only supports a very few cases where it can prove uniqueness, all other cases will end in an error. Later this verifier check may be extended to be more robust. Currently the only way to mark a reference as unique is through textual SIL. Later optimization passes may be added or updated to add this information.
…erence information and update AccessEnforcementOpts to promote accesses of unique storage to static access enforcement.
@swift-ci please benchmark. |
Build failed before running benchmark. |
* Recurrsive functions / BB * Empty functions
@swift-ci please benchmark. |
@swift-ci please benchmark |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -OnoneCode size: -swiftlibsHow to read the dataThe 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 Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
This is a WIP PR to get a benchmark of the performance improvements of access enforcement opts when it promotes uniquely identified storage accesses to statically enforced accesses.
I'm not sure to what degree
AccessedStorage::isUniquelyIdentified
is used throughout the optimizer. I wouldn't be supprised if this PR doesn't have any meaningful performance gains. I think another pass that just updated accesses of "unique" references might be much more beneficial (performance-wise). We'll see.Later, I'll clean up these individual commits and break each one into its own PR. The tests do not currently pass, this PR is just for benchmarking.
Refs (and based on) #32844. Related forum post.