forked from llvm/torch-mlir
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Some slice fixes #37
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
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.
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.
…ps where end > dim size
…on non-value tensors
…es that go from 0:int_max
mgehre-amd
force-pushed
the
matthias.some_slice_fixes
branch
from
May 25, 2023 14:06
3203f52
to
b411842
Compare
ttjost
reviewed
May 25, 2023
ttjost
approved these changes
May 25, 2023
mgehre-amd
added a commit
that referenced
this pull request
Jun 10, 2023
mgehre-amd
added a commit
that referenced
this pull request
Jun 12, 2023
mgehre-amd
added a commit
that referenced
this pull request
Jun 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This mostly comes from TOSA having very strong requirements of start/end in slices
For pytorch, start and end can be larger than the dimension size, and they are than clamped to the size of the dimension.