You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
0 commit comments