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

Some slice fixes #37

Merged
merged 7 commits into from
May 25, 2023
Merged

Commits on May 25, 2023

  1. Fix result type of index_put in slice+copy_ recomposition

    The `copy_` op being replaced by `RecomposeSliceCopy_` operates on a
    subset of the tensor being mutated, while the `index_put` op being
    used to replace the `copy_` op operates on the entire tensor being
    mutated. This means that the result type of the `index_put` should be
    the type of the input to `index_put` and we need to make sure that
    `copy_` does not have users before replacing to avoid type conflicts.
    
    Note: this commit fixes a type conflict that only seems to arise when
    `use_tracing=True`, since normally the recomposition happens before
    type propagation takes place. Since the e2e testing framework does not
    do tracing, here we use a lit test to check correctness.
    ramiro050 authored and mgehre-amd committed May 25, 2023
    Configuration menu
    Copy the full SHA
    2f9c663 View commit details
    Browse the repository at this point in the history
  2. Add alias analysis for cast-like ops to maximize-value-semantics

    When `use_tracing=True` is used to import a model into Torch-MLIR,
    several casts get inserted in the IR to bridge the untyped inputs and
    outputs with the typed body of the computation. These casts create
    extra aliases of tensors that cause the current analysis in
    `maximize-value-semantics` to fail.
    
    In particular, the `maximize-value-semantics` analysis assumes that the
    only valid alias right after an overwrite is the overwritten
    alias. So, if there is a use of a casted version of the overwritten
    alias after the overwrite, the analysis fails.
    
    This commit improves the analysis by identifying all cast-like aliases
    of the overwritten alias and allowing such aliases to be used after an
    overwrite.
    
    Because this issue only arises when using tracing, it cannot be
    currently tested e2e, so only lit test is added.
    ramiro050 authored and mgehre-amd committed May 25, 2023
    Configuration menu
    Copy the full SHA
    02c733e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ca171df View commit details
    Browse the repository at this point in the history
  4. lib/Conversion/TorchToTosa/TorchToTosa.cpp: Don't create tosa.slice o…

    …ps where end > dim size
    mgehre-amd committed May 25, 2023
    Configuration menu
    Copy the full SHA
    f758e68 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7a4807b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4ef2fea View commit details
    Browse the repository at this point in the history
  7. lib/Dialect/Torch/IR/TorchOps.cpp: AtenSliceTensorOp::fold: Fold slic…

    …es that go from 0:int_max
    mgehre-amd committed May 25, 2023
    Configuration menu
    Copy the full SHA
    b411842 View commit details
    Browse the repository at this point in the history