-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AutoDiff] Support ref_element_addr
differentiation.
#29749
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
[AutoDiff] Support ref_element_addr
differentiation.
#29749
Conversation
Support differentiation of `ref_element_addr`: class stored property references. Teach activity analysis about `ref_element_addr`, handling it like `struct_element_addr`. Do not propagate activity for `ref_element_addr` to `@noDerivative` members. Pullback generation rules: ``` Original: y = ref_element_addr x, <n> Adjoint: adj[x] += struct (0, ..., #field': adj[y], ..., 0) ^~~~~~~ field in tangent space corresponding to #field ``` Exposes TF-1149: cannot differentiate active value with loadable type but address-only `TangentVector` type. Diagnose for now. Resolves SR-12152.
@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.
Very nice!
@swift-ci Please test tensorflow |
5012f1b fixes incorrect
|
@swift-ci Please test tensorflow |
Add `ref_element_addr` case to `PullbackEmitter::getAdjointProjection`. The adjoint projection of a `ref_element_addr` is a local allocation initialized with the corresponding field value from the class's base adjoint value. Fixes incorrect `ref_element_addr` zero derivatives. Add class initializer differentiation tests.
5012f1b
to
358c1ce
Compare
@swift-ci Please test tensorflow |
/// Adjoint: adj[x] += struct (0, ..., #field': adj[y], ..., 0) | ||
/// ^~~~~~~ | ||
/// field in tangent space corresponding to #field | ||
void visitRefElementAddrInst(RefElementAddrInst *reai); |
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 should get rid of this header soon...
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.
I can do it soon :)
Support differentiation of
ref_element_addr
: class stored property references.Activity analysis:
ref_element_addr
likestruct_element_addr
.ref_element_addr
to@noDerivative
members.Pullback generation rules:
ref_element_addr
case toPullbackEmitter::getAdjointProjection
.ref_element_addr
is a local allocationinitialized with the corresponding field value from the class's base
adjoint value.
Exposes TF-1149: cannot differentiate active value with loadable type but
address-only
TangentVector
type. Diagnose for now.Resolves SR-12152.
Todos:
TangentVector
struct assertions with diagnostics.Example:
Before:
After: