Skip to content

[AutoDiff upstream] Add derivative function witness/vtable entry SILGen. #30569

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 2 commits into from
Mar 22, 2020

Conversation

dan-zheng
Copy link
Contributor

@differentiable attribute on protocol requirements and non-final class
members now produces derivative function entries in witness tables and vtables.

This enables witness_method and class_method differentiation.

Existing type-checking rules:

  • Witness declarations of @differentiable protocol requirements must have a
    @differentiable attribute with the same configuration (or a configuration
    with superset parameter indices).

    • Witness table derivative function entries are SILGen'd for @differentiable
      witness declarations.
  • Class vtable derivative function entries are SILGen'd for non-final
    @differentiable class members.

    • These derivative entries can be overridden or inherited, just like other
      vtable entries.

Resolves TF-1212.


See test/AutoDiff/SILGen/{witness_,v}table.swift for examples.

`@differentiable` attribute on protocol requirements and non-final class
members now produces derivative function entries in witness tables and vtables.

This enables `witness_method` and `class_method` differentiation.

Existing type-checking rules:

- Witness declarations of `@differentiable` protocol requirements must have a
  `@differentiable` attribute with the same configuration (or a configuration
  with superset parameter indices).
  - Witness table derivative function entries are SILGen'd for `@differentiable`
    witness declarations.

- Class vtable derivative function entries are SILGen'd for non-final
  `@differentiable` class members.
  - These derivative entries can be overridden or inherited, just like other
    vtable entries.

Resolves TF-1212.
@dan-zheng dan-zheng requested review from rxwei and marcrasi March 22, 2020 20:09
@dan-zheng
Copy link
Contributor Author

@rjmccall @slavapestov: as SIL code owners, would you like to review this patch?

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test Windows platform

@dan-zheng
Copy link
Contributor Author

All tests passed on a previous commit, so I'll just trigger smoke tests now.
@swift-ci Please smoke test

@dan-zheng
Copy link
Contributor Author

Merging to unblock progress. Happy to address feedback later!

@dan-zheng dan-zheng merged commit 723b2d2 into swiftlang:master Mar 22, 2020
@dan-zheng dan-zheng deleted the autodiff-upstream-sil branch March 22, 2020 23:59
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.

2 participants