-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AutoDiff upstream] AST bits for @differentiable fn ty #28156
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
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.
LG thanks!
include/swift/AST/Types.h
Outdated
@@ -3750,6 +3774,16 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode, | |||
// Is this function guaranteed to be no-escape by the type system? | |||
bool isNoEscape() const { return Bits & NoEscapeMask; } | |||
|
|||
bool isDifferentiable() const { | |||
return getDifferentiabilityKind() > |
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.
nit, but it seems like != would be more natural here than >
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.
Fixed
auto einfo = SILFunctionType::ExtInfo(representation, | ||
flags.isPseudogeneric(), | ||
!flags.isEscaping()); | ||
auto einfo = SILFunctionType::ExtInfo( |
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.
Is there a mangling for these flags? If so, it seems like it should be plumbed in here for the demangler to use.
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.
We've got some mangling in the tensorflow
branch. I will upstream it in a separate PR. There is a ticket for that: https://bugs.swift.org/browse/TF-948
fbbde63
to
1b8b0bc
Compare
@swift-ci please test and merge |
1b8b0bc
to
40524de
Compare
@swift-ci please test and merge |
1 similar comment
@swift-ci please test and merge |
40524de
to
6413f43
Compare
@swift-ci please test and merge |
Adds the AST bits necessary to represent
@differentiable
AnyFunctionType
andSILFunctionType
. Plumbs these bits through parsing and printing so that they can be tested. Adds serialization for them.This resolves TF-871.
Intentionally omits any functionality based on these bits to keep this PR small. (e.g. typechecking that the
@differentiable
attr is allowed on the types; lowering@differentiable
AnyFunctionType
to the corresponding@differentiable
SILFunctionType
)