-
Notifications
You must be signed in to change notification settings - Fork 373
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
Fix accuracy issue for double alias #950
Open
ColinPeppler
wants to merge
2
commits into
facebookincubator:main
Choose a base branch
from
ColinPeppler:export-D50202241
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix accuracy issue for double alias #950
ColinPeppler
wants to merge
2
commits into
facebookincubator:main
from
ColinPeppler:export-D50202241
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Oct 12, 2023
This pull request was exported from Phabricator. Differential Revision: D50202241 |
This pull request was exported from Phabricator. Differential Revision: D50202241 |
ColinPeppler
force-pushed
the
export-D50202241
branch
from
October 12, 2023 16:50
af5f71d
to
6a5d1ec
Compare
ColinPeppler
added a commit
to ColinPeppler/AITemplate
that referenced
this pull request
Oct 12, 2023
Summary: Pull Request resolved: facebookincubator#950 ## Problem Here's an edge case for AIT. Suppose we have two outputs, and both are view on the same tensor. Atm, AIT will not provide accurate results for output0. ``` some-tensor <--view-- output0 ^------view-- ouptut1 void SetUpInputOutput() { input_x = static_cast<decltype(input_x)>(params_[0].ptr); elementwise_0_0 = static_cast<decltype(elementwise_0_0)>(params_[2].ptr); output_0 = elementwise_0_0; output_1 = elementwise_0_0; } void DeviceToDeviceCopies(stream) { // empty } ``` Why doesn't AIT provide accurate results for output0? Because notice how `params_[1]` isn't assigned to anything. ## Solution Use a D2D copy to pass data from `params_[2]` to `params_[1]`. We do this by checking to see if the view is aliased by another output. * If yes, then run a D2D copy. * If no, don't worry about this output. ## Refactor We refactor `_codegen_output_tensor` by combining the `external_tensor` case with the `is_view` case. Differential Revision: D50202241 fbshipit-source-id: 13c1eb2d4171992f6a391672a6291a7485c8df2b
This pull request was exported from Phabricator. Differential Revision: D50202241 |
ColinPeppler
added a commit
to ColinPeppler/AITemplate
that referenced
this pull request
Oct 12, 2023
Summary: Pull Request resolved: facebookincubator#950 ## Problem Here's an edge case for AIT. Suppose we have two outputs, and both are view on the same tensor. Atm, AIT will not provide accurate results for output0. ``` some-tensor <--view-- output0 ^------view-- ouptut1 void SetUpInputOutput() { input_x = static_cast<decltype(input_x)>(params_[0].ptr); elementwise_0_0 = static_cast<decltype(elementwise_0_0)>(params_[2].ptr); output_0 = elementwise_0_0; output_1 = elementwise_0_0; } void DeviceToDeviceCopies(stream) { // empty } ``` Why doesn't AIT provide accurate results for output0? Because notice how `params_[1]` isn't assigned to anything. ## Solution Use a D2D copy to pass data from `params_[2]` to `params_[1]`. We do this by checking to see if the view is aliased by another output. * If yes, then run a D2D copy. * If no, don't worry about this output. ## Refactor We refactor `_codegen_output_tensor` by combining the `external_tensor` case with the `is_view` case. Differential Revision: D50202241 fbshipit-source-id: 8d61bac9ed2be0b3ba8f9e017b1373e4b0473d34
ColinPeppler
force-pushed
the
export-D50202241
branch
from
October 12, 2023 17:52
6a5d1ec
to
d0eb418
Compare
Differential Revision: D49759512 test_codegen fbshipit-source-id: c2d9f9ee4aeda516e56229b5369bf46cc313e256
Summary: Pull Request resolved: facebookincubator#950 ## Problem Here's an edge case for AIT. Suppose we have two outputs, and both are view on the same tensor. Atm, AIT will not provide accurate results for output0. ``` some-tensor <--view-- output0 ^------view-- ouptut1 void SetUpInputOutput() { input_x = static_cast<decltype(input_x)>(params_[0].ptr); elementwise_0_0 = static_cast<decltype(elementwise_0_0)>(params_[2].ptr); output_0 = elementwise_0_0; output_1 = elementwise_0_0; } void DeviceToDeviceCopies(stream) { // empty } ``` Why doesn't AIT provide accurate results for output0? Because notice how `params_[1]` isn't assigned to anything. ## Solution Use a D2D copy to pass data from `params_[2]` to `params_[1]`. We do this by checking to see if the view is aliased by another output. * If yes, then run a D2D copy. * If no, don't worry about this output. ## Refactor We refactor `_codegen_output_tensor` by combining the `external_tensor` case with the `is_view` case. Differential Revision: D50202241 fbshipit-source-id: 599cc609dcb11f92e432479f2f3214236f6d68c5
This pull request was exported from Phabricator. Differential Revision: D50202241 |
ColinPeppler
force-pushed
the
export-D50202241
branch
from
October 12, 2023 17:56
d0eb418
to
2b87bc1
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Problem
Here's an edge case for AIT. Suppose we have two outputs, and both are view on the same tensor. Atm, AIT will not provide accurate results for output0.
Why doesn't AIT provide accurate results for output0? Because notice how
params_[1]
isn't assigned to anything.Solution
Use a D2D copy to pass data from
params_[2]
toparams_[1]
. We do this by checking to see if the view is aliased by another output.Refactor
We refactor
_codegen_output_tensor
by combining theexternal_tensor
case with theis_view
case.Differential Revision: D50202241