Skip to content
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
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Oct 12, 2023

  1. Temporary commit at 10/5/2023, 2:10:31 PM

    Differential Revision:
    D49759512
    
    test_codegen
    
    fbshipit-source-id: c2d9f9ee4aeda516e56229b5369bf46cc313e256
    ColinPeppler authored and facebook-github-bot committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    df82a82 View commit details
    Browse the repository at this point in the history
  2. Fix accuracy issue for double output alias (facebookincubator#950)

    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
    ColinPeppler authored and facebook-github-bot committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    2b87bc1 View commit details
    Browse the repository at this point in the history