Skip to content

[AutoDiff upstream] Add @noDerivative flag to SILParameterInfo. #29405

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

Conversation

dan-zheng
Copy link
Contributor

The @noDerivative attribute marks the non-differentiability parameters of a
@differentiable function type. All parameters except those marked with
@noDerivative are differentiability parameters.

For example, @differentiable (Float, @noDerivative Float) -> Float is only
differentiable with respect to its first parameter.

The @noDerivative attribute is represented as a
SILParameterDifferentiability bit on SILParameterInfo.

The existing @noDerivative AST attribute is now lowered to SIL.

Add round-trip serialization and SILGen tests.

Resolves TF-872.

The `@noDerivative` attribute marks the non-differentiability parameters of a
`@differentiable` function type. All parameters except those marked with
`@noDerivative` are differentiability parameters.

For example, `@differentiable (Float, @noDerivative Float) -> Float` is only
differentiable with respect to its first parameter.

The `@noDerivative` attribute is represented as a
`SILParameterDifferentiability` bit on `SILParameterInfo`.

Add round-trip serialization tests.

Resolves TF-872.
@dan-zheng dan-zheng requested review from rxwei and marcrasi January 23, 2020 23:36
@rxwei rxwei requested a review from jckarter January 23, 2020 23:44
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@dan-zheng
Copy link
Contributor Author

@jckarter: would you like to review this PR, or suggest a reviewer? I'm asking you since you seem like a SIL code owner.

This PR is part of our effort to upstream differentiable programming. It lowers an existing AST flag to SIL and should be relatively non-controversial.

If there's no activity, I'll merge within a day to unblock progress. Happy to address feedback at any time!

@jckarter
Copy link
Contributor

Looks good to me.

@dan-zheng dan-zheng merged commit 8c17687 into swiftlang:master Jan 24, 2020
@dan-zheng dan-zheng deleted the autodiff-upstream-sil-diff-param branch January 24, 2020 18:10
davezarzycki added a commit to davezarzycki/swift that referenced this pull request Jan 24, 2020
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.

3 participants