Skip to content

[SR-12156] Make @differentiable attribute on class methods more fine-grained #54336

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

Open
Tracked by #52130
dan-zheng opened this issue Dec 6, 2019 · 0 comments
Open
Tracked by #52130
Labels
attributes Feature: Declaration and type attributes AutoDiff class Feature → type declarations: Class declarations compiler The Swift compiler itself feature A feature request or implementation methods Feature → functions: methods (member functions)

Comments

@dan-zheng
Copy link
Contributor

dan-zheng commented Dec 6, 2019

Previous ID SR-12156
Radar None
Original Reporter @dan-zheng
Type Sub-task
Additional Detail from JIRA
Votes 0
Component/s
Labels Sub-task
Assignee None
Priority Medium

md5: 5db9c5c7c42530ea5694370955eac541

Issue Description:

@differentiable attribute on class methods currently does two orthogonal things:

  • Requests derivative generation for the class method.

  • Adds JVP/VJP vtable entries for the class method.

There's currently no way using @differentiable to do only one of the above. There may be use cases for doing only one of the above:

  • Adding JVP/VJP vtable entries + custom derivative registration via @derivative attribute (no derivative generation).

  • Requesting derivative generation without JVP/VJP vtable entries? Maybe there's no use for this.

Supporting this may require new attribute syntax.


Note that this issue does not occur for protocol requirements, where @differentiable attribute can only mean one thing: add JVP/VJP witness table entries (and require implementations to specify same @differentiable attribute). This is because they have no function body for derivative generation.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler itself AutoDiff attributes Feature: Declaration and type attributes feature A feature request or implementation class Feature → type declarations: Class declarations methods Feature → functions: methods (member functions) labels May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attributes Feature: Declaration and type attributes AutoDiff class Feature → type declarations: Class declarations compiler The Swift compiler itself feature A feature request or implementation methods Feature → functions: methods (member functions)
Projects
None yet
Development

No branches or pull requests

2 participants