Skip to content

[AutoDiff] Revamp PullbackInfo #26587

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 6 commits into from
Aug 12, 2019

Conversation

bartchr808
Copy link
Contributor

PullbackInfo -> LinearMapInfo

With the introduction of Forward Mode Differentiation, the name PullbackInfo is not correct anymore. To recall, it stores information about the JVP/VJP generation. thus, a more general name of LinearMapInfo more appropriately represents what it stores.

Specifically, it stores the differential and pullback functions, which are linear functions. We map those functions to the original apply calls, which is where LinearMapInfo and linearMapStructs comes from.

Revamp linearMapStruct creation to occur before JVP/VJP emission

In my forward mode PR #26057 , I experienced an LLVM IR bug. What was going on is that it was caching the linear map structs before the linear functions were added. Those functions were being added while we were visiting the relevant instructions in JVP/VJP emission.

The solution to avoid this caching problem was to bring the part where we add the linear map functions earlier to when we create the LinearMapInfo. Thus, when the JVP/VJP emission pass occurs, it will cache the full linear map struct.

@bartchr808 bartchr808 added the tensorflow This is for "tensorflow" branch PRs. label Aug 9, 2019
@bartchr808 bartchr808 requested review from rxwei and dan-zheng August 9, 2019 22:52
@bartchr808 bartchr808 force-pushed the revamp-linear-map-info branch from 4694266 to 725308a Compare August 9, 2019 22:56
@bartchr808
Copy link
Contributor Author

@swift-ci please test tensorflow

@bartchr808 bartchr808 force-pushed the revamp-linear-map-info branch from 608844b to b9637c9 Compare August 11, 2019 20:09
@bartchr808 bartchr808 force-pushed the revamp-linear-map-info branch from b9637c9 to 1a7e8b6 Compare August 11, 2019 20:21
return false;
}

void LinearMapInfo::populateLinearMapStructDeclarationFields(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with checking this function to unblock things, but it should be broken down into multiple functions to reduce nesting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries I can make it part of this PR. Currently rebuilding my Xcode build, so will push a separate commit to make this change soon once it finishes.

Copy link
Contributor Author

@bartchr808 bartchr808 Aug 11, 2019

Choose a reason for hiding this comment

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

Added this change in my latest commit, separated out the code of when I find an apply instruction.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@bartchr808 bartchr808 force-pushed the revamp-linear-map-info branch 2 times, most recently from 0fa5f61 to 332c1f5 Compare August 11, 2019 22:49
@bartchr808 bartchr808 force-pushed the revamp-linear-map-info branch from 332c1f5 to 81b8592 Compare August 11, 2019 22:52
@bartchr808
Copy link
Contributor Author

@swift-ci please test tensorflow

2 similar comments
@bartchr808
Copy link
Contributor Author

@swift-ci please test tensorflow

@bartchr808
Copy link
Contributor Author

@swift-ci please test tensorflow

@bartchr808 bartchr808 merged commit 4df23c8 into swiftlang:tensorflow Aug 12, 2019
@bartchr808 bartchr808 deleted the revamp-linear-map-info branch August 12, 2019 00:30
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.

3 participants