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-15666] [AutoDiff] Assertion failure when differentiating through a map function involving keypaths #57945
Comments
This reproducer can be narrowed down further. I don't think it's about whether the function is differentiable, because the reproducer works with import _Differentiation
@differentiable(reverse)
func readAll(from root: Float) -> [Float] {
// [Int] can be any array type. It can also be initialized outside of the
// function.
return [Int]().map { _ in root }
} The crash appeared between the 2021-01-27 and 2021-04-18 snapshots. On 2021-01-27, there seems to be a pre-existing bug that triggered before this one. To reproduce it on that toolchain, you must change Crash on 2021-04-18 toolchain
Crash on 2021-01-27 toolchain
On the 2020-07-22 toolchain, it fails gracefully when using With [Int]()
With [Float]()
|
Additional Detail from JIRA
md5: ae84dcea4936a75e0d58dcc65a61c26e
Issue Description:
The following simple file involving differentiation through a map function that uses keypaths triggers an assertion failure of "Assertion failed: (!NodePtr->isKnownSentinel()), function operator*, file ilist_iterator.h, line 138.":
To reproduce, place the above in a file and run `swiftc file.swift` to hit the assertion failure. This is present in current nightly snapshots and is not a recent regression.
My guess is that we're missing a diagnostic stating that the above isn't differentiable, in a similar manner to the missing diagnostic in SR-15201.
This is the full text of the assertion failure:
The text was updated successfully, but these errors were encountered: