-
Notifications
You must be signed in to change notification settings - Fork 10.5k
add SILDeclRef modifier for autodiff functions #21224
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
@swift-ci please test tensorflow |
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.
Ok, this makes sense.
@@ -316,6 +316,14 @@ struct SILAutoDiffIndices { | |||
[&s](unsigned p) { s << p; }, [&s]{ s << ' '; }); | |||
s << "))"; | |||
} | |||
|
|||
std::string mangle() const { |
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.
Can you define a new AutoDiffMangler or similar, even if its still doing stuff like this? It will be easier to move to a real mangling in the future (which I encourage you to do).
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.
Kind of following the example in ASTMangler? I haven't read through that and understood how it works yet, but I'll do that and then implement something like it, in a later PR.
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.
Awesome!
@swift-ci please test tensorflow |
1 similar comment
@swift-ci please test tensorflow |
) This deletes the AutoDiffAssociatedFunctionWitness from the witness table, and instead puts the autodiff associated functions in normal method witness table entries, using the autodiff SILDeclRef from #21224.
Adds a new field to SILDeclRef that modifies it to refer to an autodiff function that is associated with the original one. Adds printing/parsing for it. Uses the SILDeclRef to TBDGen a public symbol that the AD pass creates.
I want to remove the "autodiff" witness table entries and replace them with normal method witness table entries that use this SILDeclRef, but I will do that in a subsequent PR.
@slavapestov, @rjmccall: This is based on some discussion that I had with @rjmccall on Friday. There's a difference: I made a new field that "modifies" the meaning of the rest of the SILDeclRef, rather than a new kind of SILDeclRef. After having played with it a bit, it seems most natural to do it this way. (It's sort of a derivation path idea, I think?) I will probably merge this quite quickly to unblock some autodiff stuff that we are working on, but we can continue the discussion and I'll eventually come back and modify things to whatever we eventually come up with.