-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix accuracy issue for double alias (#950)
Summary: Pull Request resolved: #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
- Loading branch information
1 parent
59784d2
commit 6a5d1ec
Showing
2 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
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
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