-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Mark Differentiable related array methods with inlinable for big performance boost #75778
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
asl
merged 1 commit into
swiftlang:main
from
JaapWijnen:mark-autodiff-array-methods-inlinable
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware, adding
@usableFromInline
introduces a newly exported symbol without availability. It would not be safe to make this change in a module that's expected to have stable ABI. Newly built code after this change may not be binary compatible with Differentiation in earlier Swift releases.(However, as I understand it, while Differentation is being build with library evolution enabled, it is not distributed as such on any platform where Swift is ABI stable. It is also unclear if the problematic stored property accessor exports are ever actually called in practice for a
@frozen
structure like this.)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @lorentey !
Just to double check, this is considered unsafe because the struct was already decorated with
@frozen
? Or is using@usableFromInline
without public availability generally ABI unstable? I might not fully grasp the subtlety here but would love to understand better to keep these in mind for future changes.But indeed Differentiation is not yet distributed to a platform that is ABI stable, so it's not an issue yet!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rxwei in your opinion, are we good to go here? As @lorentey points out we break ABI here but that's currently not an issue yet right? I'll add some comments to the main PR message regarding ABI stability.
As an additional question, just for my understanding. Is the following change binary incompatible? And if so why? It seems to me that we're only adding information to the interface not changing the binary layout of the struct. But I also don't have a lot of experience here so would like to understand the details if possible!
->
Also tagging @asl