Skip to content

Conversation

@dan-zheng
Copy link
Contributor

Update derivative name in @differentiable attribute when a derivative
function is set. This prevents linker errors.

Disable serialization for @differentiable attribute. It is unnecessary:

  • Currently, type-checking sets the derivative in a @differentiable attribute
    on the original function, which is serialized.
    • If both @differentiable and @differentiating are serializable, using
      @differentiating attribute causes an infinite loop occurs during
      deserialization.
  • In the future, @differentiating attribute will be lowered to SIL
    differentiability witness tables, which will be serialized.

Unblocks #23193: using @differentiating attribute in the stdlib.

@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Mar 20, 2019
@dan-zheng dan-zheng requested a review from rxwei March 20, 2019 08:59
lib/AST/Attr.cpp Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the location of decl's name here (DeclNameLoc(decl->getNameLoc())) might not make sense.

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

Update derivative name in `@differentiable` attribute when a derivative
function is set. This prevents linker errors.

Disable serialization for `@differentiable` attribute. It is unnecessary:
- Currently, type-checking sets the derivative in a `@differentiable` attribute
  on the original function, which is serialized.
  - If both `@differentiable` and `@differentiating` are serializable, using
    `@differentiating` attribute causes an infinite loop occurs during
    deserialization.
- In the future, `@differentiating` attribute will be lowered to SIL
  differentiability witness tables, which will be serialized.

Unblocks swiftlang#23193: using `@differentiating` attribute in the stdlib.
@dan-zheng dan-zheng force-pushed the fix-differentiating-attr branch from de21726 to 541f005 Compare March 20, 2019 09:16
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

Fix serialization tests.
 In `test/Serialization/differentiating_attr.swift`, check that generated
  `@differentiable` attribute is correct:
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@dan-zheng
Copy link
Contributor Author

Confirmed that this unblocks #23193. Merging to unblock progress.

@dan-zheng dan-zheng merged commit 5f8cb74 into swiftlang:tensorflow Mar 20, 2019
rxwei pushed a commit to rxwei/swift that referenced this pull request May 11, 2019
Update derivative name in `@differentiable` attribute when a derivative
function is set. This prevents linker errors.

Disable serialization for `@differentiable` attribute. It is unnecessary:
- Currently, type-checking sets the derivative in a `@differentiable` attribute
  on the original function, which is serialized.
  - If both `@differentiable` and `@differentiating` are serializable, using
    `@differentiating` attribute causes an infinite loop occurs during
    deserialization.
- In the future, `@differentiating` attribute will be lowered to SIL
  differentiability witness tables, which will be serialized.

Unblocks swiftlang#23193: using `@differentiating` attribute in the stdlib.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tensorflow This is for "tensorflow" branch PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant