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
[SR-15201] [AutoDiff] Assertion failure when using a throwing function within gradient()
#57523
Comments
@swift-ci create |
This is very similar to #57945 (formerly SR-15666). The stack trace and assertion failure are very close, and they both started appearing at the same time. That suggests that both bugs have the same underlying source. The reproducer can be narrowed down further, but you need to pass import _Differentiation
import Swift // Required for accessing `Builtin`.
// Having the `throws` attribute makes this function not differentiable. The
// compiler should gracefully fail with that warning, but doesn't.
func wrapped(_ x: Double) throws -> Double {
return x
}
func encapsulating(_ x: Double) -> Double {
return try! wrapped(x)
}
_ = Builtin.applyDerivative_vjp(encapsulating(_:), 2.0) Replication of the original reproducer's crash on the 2021-04-18 toolchain
Different crash found on the 2021-01-27 toolchain
Error on 2020-07-22 toolchain from unsupported control flow
|
Still crashes on 05/24 toolchain. |
Additional Detail from JIRA
md5: 58e7af91200f09a12afa7f4d5dd2f852
Issue Description:
When a throwing function is used within gradient(), as in the following simple reproducer:
an assertion failure of "(!NodePtr->isKnownSentinel())" results. This seems closely related to TF-7, and may be another case of needing to add a diagnostic to catch this.
The full stack traces that results is as follows:
The text was updated successfully, but these errors were encountered: