-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AutoDiff] Re-enable LoadableByAddress. #27923
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] Re-enable LoadableByAddress. #27923
Conversation
if (F.getModule().getStage() == SILStage::Canonical || | ||
dfi->hasDerivativeFunctions()) { | ||
// Skip lowered SIL: LoadableByAddress changes parameter/result conventions. | ||
// TODO: Check that derivative function types match excluding |
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.
Note: robust verification here should be aware of the lowered SIL stage and check that address-lowered SIL function types match.
In the meantime, we could use a custom function for recursively checking SIL function type equality, ignoring parameter/result conventions. SILFunctionType::isABICompatibleWith
is not suitable because it checks parameter/result conventions and returns an opaque ABICompatibilityCheckResult
.
Checking if tests pass. |
@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.
Changes to what identifies a SIL instruction should be reflected in its syntax.
differentiable_function_extract [...] [...] %foo : $(T) -> T as $(@in T) -> @out T
331d8a6
to
c23f208
Compare
Nice! I have no additional comments on this. |
39849ea
to
da3e68c
Compare
The LoadableByAddress transform rewrites function types. This caused verification failures in lowered SIL for `differentiable_function` and `differentiable_function_extract` instructions, which have precise type verification rules. Now, verification has been relaxed for these instructions in lowered SIL. - `differentiable_function_extract` can now have an explicit extractee type in lowered SIL: parsing/printing/serialization support have been added. - LoadableByAddress rewrites `differentiable_function_extract` instructions using explicit address-lowered function type, similar to other function conversion instructions. - Add SIL FileCheck and runtime tests.
da3e68c
to
cadc7c1
Compare
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.
Nice!
@swift-ci Please test tensorflow |
@swift-ci Please test tensorflow linux |
Confirmed that the extended test suite passed: |
The next step is to resolve cases where an original value's value category mismatches that of its corresponding tangent value. |
LoadableByAddress was re-enabled by default on tensorflow branch in swiftlang#27923. IRGen tests no longer require an explicit `-enable-large-loadable-types` flag.
LoadableByAddress was re-enabled by default on tensorflow branch in #27923. IRGen tests no longer require an explicit `-enable-large-loadable-types` flag.
The LoadableByAddress transform rewrites function types. This caused
verification failures in lowered SIL for
differentiable_function
anddifferentiable_function_extract
instructions, which have precise typeverification rules.
Now, verification has been relaxed for these instructions in lowered SIL.
differentiable_function_extract
can now have an explicit extractee typein lowered SIL: parsing/printing/serialization support have been added.
differentiable_function_extract
instructionsusing explicit address-lowered function type, similar to other function
conversion instructions.