Skip to content

[AutoDiff] Fix SR-12641: Handle address-only types in derivative fn types #31496

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

Merged
merged 5 commits into from
May 5, 2020

Conversation

marcrasi
Copy link

@marcrasi marcrasi commented May 2, 2020

  • The update in SILFunctionType.cpp fixes SR-12641 by making address-only parameters/results in differentials have indirect convention.
  • I updated the crasher test to use a resilient struct defined in the test, instead of Tracked<Float>, so that the test does not need to depend on DifferentiationUnittest.
  • The update in VJPEmitter.cpp fixes a similar issue with pullbacks that I discovered while investigating.
  • I added code that exposes this new issue to the SR-12641 crasher test.

@marcrasi marcrasi requested a review from dan-zheng May 2, 2020 04:41
Copy link
Contributor

@dan-zheng dan-zheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This fixes some original vs tangent convention mismatch issues - do you think any holes remain in the codebase?

@marcrasi
Copy link
Author

marcrasi commented May 2, 2020

do you think any holes remain in the codebase?

I didn't do any exhaustive thinking while writing this PR, I just stumbled on these two cases by accident. So it's possible that there are some more holes somewhere.

There is this inelegant diagnostic that simply rejects a lot of these cases: https://github.com/apple/swift/blob/a021e6ca020e667ce4bc8ee174e2de1cc0d9be73/include/swift/AST/DiagnosticsSIL.def#L500

@marcrasi
Copy link
Author

marcrasi commented May 2, 2020

@swift-ci please test

@dan-zheng
Copy link
Contributor

dan-zheng commented May 2, 2020

Merging now to unblock progress.

Edit: actually, unblocking progress isn't deathly urgent. I'm not sure whether you'd like to merge/squash commits, so I'll hold off.

@dan-zheng
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 5, 2020

Build failed
Swift Test Linux Platform
Git Sha - b77170a

@swift-ci
Copy link
Contributor

swift-ci commented May 5, 2020

Build failed
Swift Test OS X Platform
Git Sha - b77170a

@marcrasi marcrasi merged commit ce5e0e7 into swiftlang:master May 5, 2020
@marcrasi marcrasi deleted the sr-12641 branch May 5, 2020 19:29
rxwei pushed a commit to rxwei/swift that referenced this pull request Jun 3, 2020
…ypes (swiftlang#31496)

* The update in `SILFunctionType.cpp` fixes SR-12641 by making address-only parameters/results in differentials have indirect convention.
* I updated the crasher test to use a resilient struct defined in the test, instead of `Tracked<Float>`, so that the test does not need to depend on `DifferentiationUnittest`.
* The update in `VJPEmitter.cpp` fixes a similar issue with pullbacks that I discovered while investigating.
* I added code that exposes this new issue to the SR-12641 crasher test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants