Skip to content
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-9653] [AD] DiagnoseStaticExclusivity needs special cases for AD instructions #52097

Closed
swift-ci opened this issue Jan 14, 2019 · 2 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. swift for tensorflow

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-9653
Radar None
Original Reporter jekbradbury (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Swift for TensorFlow
Labels Bug
Assignee @dan-zheng
Priority Medium

md5: 4a8078b4abcae3315ea4a5f173126471

Issue Description:

This snippet:

func foo() {
  let x: Float = 0
  var y: Float = 0
  let grad = gradient(at: x) { (x: Float) -> Float in
    y = x
    return x + x
  }
}
foo()

gives the following error:

Unexpected partial_apply use:   %18 = autodiff_function [wrt 0] [order 1] %17 : $@noescape @callee_guaranteed (Float) -> Float // users: %27, %23, %19
A partial_apply with @inout_aliasable may only be used as a @noescape function type argument.
UNREACHABLE executed at /usr/local/google/home/jekbradbury/swift-sources/swift/lib/SILOptimizer/Mandatory/DiagnoseStaticExclusivity.cpp:1078!

This is because checkNoEscapePartialApplyUse is unable to check that autodiff_function is using its partially-applied closure argument with an @noescape attribute. I believe we also need to add support there for autodiff_function_extract.

@swift-ci
Copy link
Collaborator Author

Comment by Jianwei Xie (JIRA)

I think we need to prioritize this bug. Now I can make most of the AD works. But I fail to generate summary after the training.

I want to do something like line 111 to 115.

https://gist.github.com/xiejw/054a76d654a8d1ffef88c30d33d4e7a8#file-gistfile1-txt-L22

@dan-zheng
Copy link
Collaborator

Done in #21925

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. swift for tensorflow
Projects
None yet
Development

No branches or pull requests

2 participants