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

[Tcp] Merge main into mlir-tcp #2518

Merged
merged 42 commits into from
Oct 18, 2023

Conversation

navahgar
Copy link
Collaborator

As titled

sogartar and others added 30 commits September 14, 2023 10:23
Set PyTorch and TorchVision version to nightly release 2023-09-18.

Signed-Off By: Vivek Khandelwal <[email protected]>
Picks up DenseResourceElementsAttr python support and fixes minf/maxf
C++ rename.
Adds ODS for `avg_pool2d` and `avg_pool3d`, including their backward and
`adaptive_` variants.
MSVC (and other compilers with implicit narrowing warnings) don't like
this type mismatch.
Set PyTorch and TorchVision version to nightly release 2023-09-22.

Signed-Off By: Vivek Khandelwal <[email protected]>
…lvm#2481)

This PR adds device="cpu" support for `aten.to_dtypeLayout` op and
corresponding e2e test suit.
(refer:  PR llvm#812)
While trying to fix a bug in the `ConvertAtenViewOp` pattern in the
linalg backend, I realized that the pattern had become quite complex and
had accumulated some dead code, making it hard to reason about.

This commit simplifies the pattern quite a bit. The main changes are:
1. All the static helper functions in the `ConvertAtenViewOp` class have
been simplified, both in their signature and their body. Each one now
performs simple calculations on arrays, and take the least number of
arguments necessary.
2. The body of [the `while`
loop](https://github.com/ramiro050/torch-mlir/blob/9fce566b0cb64ff2b198693d1f6ee9580b8fa01f/lib/Conversion/TorchToLinalg/DataMovement.cpp#L407)
inside the main pattern has been changed to work on `MutableArrayRef`
slices, to avoid having to keep track of `start` and `end` indices for
the input and output shape arrays.
3. All the heuristics used to determine the mapping between the input
and output dimensions are now in [this relatively short `if-else`
section](https://github.com/ramiro050/torch-mlir/blob/9fce566b0cb64ff2b198693d1f6ee9580b8fa01f/lib/Conversion/TorchToLinalg/DataMovement.cpp#L428-L460),
making it easy to see what is going on.
4. Dead code was eliminated + updates to some of the documentation
comments

This commit does not add any new functionality to the
`ConvertAtenViewOp` pattern.
Set PyTorch and TorchVision version to nightly release 2023-09-26.

aten._convolution.deprecated changes done because upstream PyTorch has
now added support for fp16 native convolution on CPU.
Refer: pytorch/pytorch@7c90521

Signed-Off By: Vivek Khandelwal <[email protected]>
torch version: 2.2.0.dev20230927
torch commit hash: d7520d8668dc08f7bed27a64f006c909006e653a
torchvision version: 0.17.0.dev20230927

Co-authored-by: Roll PyTorch Action <[email protected]>
…m#2474)

This commit adds to the lowering of `aten.view` handling for the
following cases:

- `(..., a.size(i))` -> `(..., a.size(i), 1, ..., 1)`
- `(..., a.size(i), 1, ..., 1)` -> `(..., a.size(i))`

Fixes: llvm#2448
The LTC backend has drifted from being able to pass tests on the stable
PyTorch version, so pinning to nightly on ARM.

Signed-Off By: Vivek Khandelwal <[email protected]>
…lvm#2496)

When importing dynamic shaped programs from Dynamo, via torch.compile or
torch.export, we can assume that strict symbolic shape checks have been
done prior to generating torch IR. Among other shape checking, this
eliminates the case where an unknown dimension can be dynamically '1' in
a way that signals a broadcast.

Adds a `isAssumingStrictSymbolicShapes` utility which consults a
`torch.assume_strict_symbolic_shapes` attribute on an enclosing scope
and returns true if present.

In the linalg pipeline, many runtime checks are elided when this returns
true.
Set PyTorch and TorchVision version to nightly release 2023-09-28.

aten.baddbmm changes done because upstream PyTorch has now added
support for fp16 gemm on CPU.
Refer: pytorch/pytorch@9399e0b
torch version: 2.2.0.dev20231002
torch commit hash: 4dae8b49630d2784f6a5d8726db30923e2d1e077
torchvision version: 0.17.0.dev20231002

Co-authored-by: Roll PyTorch Action <[email protected]>
Add linspace/cumprod/roll ops to ODS and add shape inference functions
to make it work with LTC.

Also, add some tensor utils to LTC library for searching for non-detach
copy nodes.
torch version: 2.2.0.dev20231003
torch commit hash: 4e30fa82315208dcd38fa16a0ed9851fa8e98bc9
torchvision version: 0.17.0.dev20231003

Co-authored-by: Roll PyTorch Action <[email protected]>
This commit adds to the lowering of `aten.view` handling for the
following cases:

- `(..., a.size(i))` -> `(..., a.size(i), 1, ..., 1)`
- `(..., a.size(i), 1, ..., 1)` -> `(..., a.size(i))`
- `(a.size(i), ...)` -> `(1, ..., 1, a.size(i), ...)`
- `(1, ..., 1, a.size(i), ...)` -> `(a.size(i), ...)`
torch version: 2.2.0.dev20231004
torch commit hash: 56af607c0437ed7321da4b96a4dbccdbd8b5a98b
torchvision version: 0.17.0.dev20231004

Co-authored-by: Roll PyTorch Action <[email protected]>
Strict symbolic shapes allow us to assume numpy-style dynamic broadcasts
never occur. This allows us to strengthen the folder for broadcasts to
cases where the rank is the same and all shapes match (including dynamic
sentinel values).
stellaraccident and others added 11 commits October 5, 2023 09:45
torch version: 2.2.0.dev20231005
torch commit hash: 439cba92777ff61b49d24096edfaf128fbd742ea
torchvision version: 0.17.0.dev20231005

Co-authored-by: Roll PyTorch Action <[email protected]>
…lvm#2505)

With strict symbolic shapes, we can assume numpy-style dynamic
broadcasts never occur. This improves the lowering in the presence of
this assumption.
torch version: 2.2.0.dev20231006
torch commit hash: 20217d1426d99d0caa70e1473d89e0c834b7f35e
torchvision version: 0.17.0.dev20231006

Co-authored-by: Roll PyTorch Action <[email protected]>
)

Add aten.unflatten.int op
Add its torch-to-tosa lowering
Update the TorchToTosa/basic.mlir tests

To test e2e tosa lowering:

`python -m e2e_testing.main -v -c=tosa`

---------

Co-authored-by: Ze Zhang <[email protected]>
Add aten.isclose op
Add its torch-to-tosa lowering
Update the TorchToTosa/basic.mlir tests


To test e2e tosa lowering:
`python -m e2e_testing.main -v -c=tosa`

---------

Co-authored-by: Ze Zhang <[email protected]>
The main purpose is to bring in the new mesh dialect change.
llvm/llvm-project#68007
The last llvm bump in llvm#2511
pointed to
llvm/llvm-project@b44b349,
however the bazel build upstream was not clean at this point:

```
ERROR: /root/.cache/bazel/_bazel_root/b89349c08f7224396763d14fe35cba11/external/llvm-project/mlir/BUILD.bazel:5837:18: TdGenerate
external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsInterface.h.inc failed: (Exit 1): mlir-tblgen failed: error executing command ...
                                                                                                                                                    
external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td:20:9: error: Could not find include file 'mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td'                                                                                                           
include "mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td"                                                                                                                                                                                                              
        ^                                                                                                                                                                                                                                                              
external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td:20:9: error: Unexpected token at top level                                                                                                                                                           
include "mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td"                                                                                                                                                                                                              
        ^       
```

The bazel fixes followed in a subsequent commit at
llvm/llvm-project@28b27c1.
This PR bumps LLVM by a few more commits (to include the bazel fixes)
which helps restore Torch-MLIR's bazel build back to 🟢 .

GHA workflow to test bazel build:
https://github.com/sjain-stanford/torch-mlir/actions/runs/6555101471/job/17803082508
@navahgar navahgar merged commit 9624268 into llvm:mlir-tcp Oct 18, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.