Skip to content

[AutoDiff upstream] Add SIL differentiability witness serialization. #29642

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

SIL differentiability witnesses are a new top-level SIL construct mapping
an "original" SIL function and derivative configuration to derivative SIL
functions.

This patch adds SILDifferentiabilityWitness serialization/deserialization.

Resolves TF-1136.


Todos:

  • TF-1137: upstream SILDifferentiabilityWitness verification.
  • TF-1138: upstream SILDifferentiabilityWitness SILGen from
    @differentiable and @derivative attributes.
  • TF-20: robust mangling for SILDifferentiabilityWitness names.

SIL differentiability witnesses are a new top-level SIL construct mapping
an "original" SIL function and derivative configuration to derivative SIL
functions.

This patch adds `SILDifferentiabilityWitness` serialization/deserialization.

Resolves TF-1136.
@@ -2550,6 +2615,24 @@ void SILSerializer::writeSILBlock(const SILModule *SILMod) {
processSILFunctionWorklist();
}

// Write out differentiability witnesses.
// Note: this must be done after visiting SIL functions above so that
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: diff. witness deserialization seems a bit overly complicated right now (auxiliary DifferentiabilityWitnessesToEmit data structure, etc) because the differentiability_witness_function instruction hasn't been upstreamed yet.

I decided to upstream the code as-is because it's the final desired version.

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 4, 2020

Build failed
Swift Test Linux Platform
Git Sha - 6482b67

`sed -i` behaves differently on macOS and Ubuntu.
Instead, use `sed ... > ...` to redirect the output.
@swift-ci
Copy link
Contributor

swift-ci commented Feb 4, 2020

Build failed
Swift Test OS X Platform
Git Sha - 6482b67

This likely explains and fixes the macOS CI SIL deserialization failure.
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2020

Build failed
Swift Test OS X Platform
Git Sha - 6482b67

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2020

Build failed
Swift Test Linux Platform
Git Sha - 6482b67

@dan-zheng
Copy link
Contributor Author

CI failures seem unrelated, maybe they're fixed now.
@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 6, 2020

Build failed
Swift Test OS X Platform
Git Sha - f6d99b0

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test macOS platform

@dan-zheng
Copy link
Contributor Author

dan-zheng commented Feb 7, 2020

All tests passed. I had to resolve a merge conflict, so tests must be run again.
@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 7, 2020

Build failed
Swift Test Linux Platform
Git Sha - f6d99b0

@swift-ci
Copy link
Contributor

swift-ci commented Feb 7, 2020

Build failed
Swift Test OS X Platform
Git Sha - f6d99b0

@dan-zheng dan-zheng merged commit 7b064a6 into swiftlang:master Feb 7, 2020
@dan-zheng dan-zheng deleted the autodiff-upstream-sil-diff-witness branch February 7, 2020 17:35
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