Skip to content

[SR-15818] [AutoDiff] Compiler crash for inout @noDerivative closure parameter #58095

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

Closed
philipturner opened this issue Feb 4, 2022 · 2 comments · Fixed by #63080
Closed
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@philipturner
Copy link
Contributor

Previous ID SR-15818
Radar None
Original Reporter @philipturner
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 74613197bdf79640c6596a3142e64468

Issue Description:

The following code produces a crash during compilation. It was caught while testing bug fixes brought by #41174 - a pull request which fixes the crash.

import _Differentiation

typealias MyType = @differentiable(reverse) (inout @noDerivative Float, Float) -> Void

@differentiable(reverse)
func myFunc(_ x:  inout @noDerivative Float, _ y: Float) -> Void {}

print(myFunc as MyType)
@asl
Copy link
Contributor

asl commented Feb 25, 2022

This looks strange:

[AD] Getting a subset parameters thunk for derivative function   %11 = thin_to_thick_function %10 : $@convention(thin) (@inout Float, Float) -> @owned @callee_guaranteed (@inout Float
 of the original function   %9 = thin_to_thick_function %8 : $@convention(thin) (@inout Float, Float) -> () to $@callee_guaranteed (@inout Float, Float) -> () // user: %12
 from (parameters={1, 1} results={1}) to (parameters={0, 1} results={1})
[AD] Getting a subset parameters thunk for @callee_guaranteed (@inout Float, Float) -> () from (parameters={1, 1} results={1}) to (parameters={0, 1} results={1})

Note the

parameters={1, 1}

thing

@philipturner
Copy link
Contributor Author

philipturner commented Feb 25, 2022

Fix submitted as #41174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
2 participants