Commit Graph

2585 Commits (d030bffc624860b57d43dc918e3bd2a55d33e077)
 

Author SHA1 Message Date
Jiawei Wu d5ee8ee73a
[Torch Dialect] emit aten.reshape_as op and add decomposition pattern. (#2553) 2023-11-05 11:38:36 +08:00
Stella Laurenzo 71ca529a62
update PyTorch version to 2.2.0.dev20231104 (#2552)
torch version: 2.2.0.dev20231104
torch commit hash: a89fef71845d0dbc2c4c4a4c7878f51f4968ab90
torchvision version: 0.17.0.dev20231104

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-04 09:01:26 -07:00
Yuanqiang Liu 0378da0abd
[Torch Dialect] support aten.isinf (#2544)
Also fix linalg lowering from `UEQ` to `OEQ`.  
I will check other comparison's lowering later.
2023-11-04 22:26:01 +08:00
saienduri 88adf384cc
torch-mlir change for dense resource implementation (#2513)
Co-authored-by: Avinash Sharma <avinash@nod-labs.com>
2023-11-03 11:44:07 -07:00
Sambhav Jain 1b9fb1b51d
[Bazel] Mirror project reorganization (#2547)
Updates Bazel build to mirror project reorganization from
https://github.com/llvm/torch-mlir/pull/2542.

GHA:
https://github.com/sjain-stanford/torch-mlir/actions/runs/6744430250/job/18334262852
2023-11-03 08:45:51 -07:00
Stella Laurenzo 3caddd2dd9
update PyTorch version to 2.2.0.dev20231103 (#2549)
torch version: 2.2.0.dev20231103
torch commit hash: fd56aa0daeec624bcff822fef04fe9339770dc33
torchvision version: 0.17.0.dev20231103

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-03 08:25:58 -07:00
Stella Laurenzo 6961f0a247
Re-organize project structure to separate PyTorch dependencies from core project. (#2542)
This is a first step towards the structure we discussed here:
https://gist.github.com/stellaraccident/931b068aaf7fa56f34069426740ebf20

There are two primary goals:

1. Separate the core project (C++ dialects and conversions) from the
hard PyTorch dependencies. We move all such things into projects/pt1 as
a starting point since they are presently entangled with PT1-era APIs.
Additional work can be done to disentangle components from that
(specifically LTC is identified as likely ultimately living in a
`projects/ltc`).
2. Create space for native PyTorch2 Dynamo-based infra to be upstreamed
without needing to co-exist with the original TorchScript path.

Very little changes in this path with respect to build layering or
options. These can be updated in a followup without commingling
directory structure changes.

This also takes steps toward a couple of other layering enhancements:

* Removes the llvm-external-projects/torch-mlir-dialects sub-project,
collapsing it into the main tree.
* Audits and fixes up the core C++ build to account for issues found
while moving things. This is just an opportunistic pass through but
roughly ~halves the number of build actions for the project from the
high 4000's to the low 2000's.

It deviates from the discussed plan by having a `projects/` tree instead
of `compat/`. As I was thinking about it, this will better accommodate
the follow-on code movement.

Once things are roughly in place and the CI passing, followups will
focus on more in-situ fixes and cleanups.
2023-11-02 19:45:55 -07:00
Stella Laurenzo 536e45cb3b
update PyTorch version to 2.2.0.dev20231102 (#2545)
torch version: 2.2.0.dev20231102
torch commit hash: d2c3aa1fded6d1a0165eafe6e08816a85a1190d8
torchvision version: 0.17.0.dev20231102

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-02 08:39:55 -07:00
Zhekun(Josh) Zhang 88d4c475d3
[Torch] Fix mixP case for non value semantic ops (#2540)
NonValueSemantic Ops like Add_, div_, etc. expect result DType to be the
same as the first input. However, current implementation would result in
wrong result type for case like:

```python
a = torch.randn(3, 3).half() # float16
b = torch.randn(3, 3) # float32
a += b # i.e. torch.ops.aten.add_(a, b)
```
torch expects `a` to be float16, but dtype refinement would infer
float32 type, since it's replaced by `aten.add`.
2023-11-02 12:40:08 +08:00
Daniel Garvey 4901773f77
add uncovered cases in view lowering (#2524)
removes unecessary checks from empty strided
2023-11-01 21:56:44 -05:00
Yuanqiang Liu 365655ca29
[Torch Dialect] add canonicalize pattern for aten.floor with integer … (#2534)
…type
2023-11-02 09:51:31 +08:00
saienduri a2e694df40
add e2e support for torch.eye operations (aten.eye, aten.eye.m) (#2478) 2023-11-01 11:23:28 -07:00
Stella Laurenzo e12937c642
update PyTorch version to 2.2.0.dev20231101 (#2538)
torch version: 2.2.0.dev20231101
torch commit hash: e844d7ab047429425f117b1c566038713d2d7784
torchvision version: 0.17.0.dev20231101

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-01 08:17:40 -07:00
Daniel Garvey 1d41f7b6fe
Rework AtenEmptyStridedOp checks (#2537)
Now using Value instead of Ints. Trades compile failure for a runtime
assert
2023-10-31 22:56:54 -05:00
xiaolou86 4199feffed
Fix typos in comments (#2539)
Fix typos in comments
2023-10-31 20:10:47 -07:00
JianzheXiao e8706957c0
[Torch Dialect] Add Support for aten.unflatten.int (#2475)
As title, Add support for aten.unflatten.int, support dim to be negative
and one of the sizes' elements to be -1
2023-10-31 15:36:16 +08:00
Stella Laurenzo b88f9ec8f2
update PyTorch version to 2.2.0.dev20231027 (#2536)
torch version: 2.2.0.dev20231027
torch commit hash: 525a926aaa127e59c71ed66915055ac027dba507
torchvision version: 0.17.0.dev20231027

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-27 09:47:45 -07:00
Stella Laurenzo 2e5c624b58
update PyTorch version to 2.2.0.dev20231026 (#2535)
torch version: 2.2.0.dev20231026
torch commit hash: bf9fd89f63f213a5c449dd589ac96cf9c9218885
torchvision version: 0.17.0.dev20231026

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-26 09:45:36 -07:00
Yuanqiang Liu e7282487ea
[Torch Dialect] support aten.glu (#2531) 2023-10-26 10:36:18 +08:00
Stella Laurenzo b0f39ac966
update PyTorch version to 2.2.0.dev20231025 (#2532)
torch version: 2.2.0.dev20231025
torch commit hash: e6efc2915b4ac65c784fbcbbf42ad87b49214417
torchvision version: 0.17.0.dev20231025

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-25 10:11:06 -07:00
Stella Laurenzo e184e45398
update PyTorch version to 2.2.0.dev20231024 (#2530)
torch version: 2.2.0.dev20231024
torch commit hash: a422515e75cad4e785bbdbdff4f4e1c7c406bb24
torchvision version: 0.17.0.dev20231024

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-24 07:50:06 -07:00
Ze Zhang 7cb2db6279
Update dtype check in torch-to-tosa clamp op (#2529)
As titled.

---------

Co-authored-by: Ze Zhang <ze.zhang@getcruise.com>
2023-10-23 17:04:30 -07:00
Stella Laurenzo 6d74e8cccd
update PyTorch version to 2.2.0.dev20231023 (#2528)
torch version: 2.2.0.dev20231023
torch commit hash: 88eb6bbb1ab58d7cdb49349b64c02a04911be8f2
torchvision version: 0.17.0.dev20231023

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-23 09:32:21 -07:00
Stella Laurenzo 0f781ab4bf
update PyTorch version to 2.2.0.dev20231022 (#2526)
torch version: 2.2.0.dev20231022
torch commit hash: f468e74875f6b7f95b7b01ccf3b05c3917e2865d
torchvision version: 0.17.0.dev20231022

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-22 08:01:12 -07:00
Sarthak Gupta 7633619ed2
[torch] Implement stronger verifiers for non-value semantic ops (#2519)
Attempt to solve https://github.com/llvm/torch-mlir/issues/2490

Changes for Non Value Semantic Ops having the
`IsTrailingUnderscoreInplaceVariant` trait :
- AnyTorchTensorType -> Torch_NonValueTensorType
- AnyTorchOptionalTensorType -> AnyTorchOptionalNonValueTensorType
- AnyTorchListOfOptionalTensorType ->
AnyTorchListOfOptionalNonValueTensorType
- AnyTorchListOfTensorType -> AnyTorchListOfNonValueTensorType

Created three new tensor types for optional and list non value tensors.
2023-10-21 09:09:55 -07:00
Stella Laurenzo 0acbb264d4
update PyTorch version to 2.2.0.dev20231021 (#2525)
torch version: 2.2.0.dev20231021
torch commit hash: 147ac6b312c4c71e89013be592dc519c81fcac4e
torchvision version: 0.17.0.dev20231021

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-21 08:57:42 -07:00
Stella Laurenzo caa533cc5f
update PyTorch version to 2.2.0.dev20231020 (#2522)
torch version: 2.2.0.dev20231020
torch commit hash: 6ffe31abcae7d580c451cea195bd52258c72ac81
torchvision version: 0.17.0.dev20231020

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-20 09:01:22 -07:00
Vivek Khandelwal 5bc2009332
build: manually update PyTorch version (#2521) 2023-10-19 07:03:00 -07:00
Sambhav Jain 52abae1526
Bump LLVM to get bazel fixes (#2517)
The last llvm bump in https://github.com/llvm/torch-mlir/pull/2511
pointed to
b44b3494f6,
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
28b27c1b10.
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
2023-10-17 22:00:26 -07:00
Ze Zhang 4279b750da
update AtenClampOp in torch-to-tosa to handle fp inputs (#2516)
As titled.

---------

Co-authored-by: Ze Zhang <ze.zhang@getcruise.com>
2023-10-17 14:49:47 -07:00
Chi_Liu 14a4da923b
Update llvm-project to b44b3494f60296db6aca38a14cab061d9b747a0a (#2511)
The main purpose is to bring in the new mesh dialect change.
https://github.com/llvm/llvm-project/pull/68007
2023-10-16 19:29:48 -07:00
Ze Zhang f2c53b8ca5
Add aten.isclose support and its torch-to-tosa lowering (#2512)
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 <ze.zhang@getcruise.com>
2023-10-16 09:44:53 -07:00
Ze Zhang e649e06b7b
Add aten.unflatten.int support and its torch-to-tosa lowering (#2509)
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 <ze.zhang@getcruise.com>
2023-10-13 18:39:41 -07:00
Ramiro Leal-Cavazos 9b5a4afadd
Update README to include new meeting schedule (#2503) 2023-10-10 09:54:54 -07:00
Stella Laurenzo 26ea13ddf5
update PyTorch version to 2.2.0.dev20231006 (#2507)
torch version: 2.2.0.dev20231006
torch commit hash: 20217d1426d99d0caa70e1473d89e0c834b7f35e
torchvision version: 0.17.0.dev20231006

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-06 07:27:45 -07:00
Quinn Dawkins 6f81ad7293
[TorchToLinalg] Improve broadcast lowerings in strict symbolic modes (#2505)
With strict symbolic shapes, we can assume numpy-style dynamic
broadcasts never occur. This improves the lowering in the presence of
this assumption.
2023-10-05 15:15:26 -04:00
Stella Laurenzo 42b6c0a14a
update PyTorch version to 2.2.0.dev20231005 (#2506)
torch version: 2.2.0.dev20231005
torch commit hash: 439cba92777ff61b49d24096edfaf128fbd742ea
torchvision version: 0.17.0.dev20231005

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-05 09:45:53 -07:00
Quinn Dawkins ae72eec224
Improve aten.broadcast_to folder when in strict symbol mode (#2504)
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).
2023-10-05 09:02:10 -04:00
Stella Laurenzo 14e6da8588
update PyTorch version to 2.2.0.dev20231004 (#2502)
torch version: 2.2.0.dev20231004
torch commit hash: 56af607c0437ed7321da4b96a4dbccdbd8b5a98b
torchvision version: 0.17.0.dev20231004

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-04 07:55:21 -07:00
Ramiro Leal-Cavazos 2e5d65064c [linalg] Add handling for leadin and trailing size-1 dims in ViewOp
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), ...)`
2023-10-03 23:04:52 +00:00
Ramiro Leal-Cavazos 1c508af0ba Revert "[linalg] Fix handling of trailing size-1 dimensions in aten.view (#2474)"
This reverts commit 7c6b9d2445.
2023-10-03 23:04:52 +00:00
Stella Laurenzo 4892ed433f
update PyTorch version to 2.2.0.dev20231003 (#2500)
torch version: 2.2.0.dev20231003
torch commit hash: 4e30fa82315208dcd38fa16a0ed9851fa8e98bc9
torchvision version: 0.17.0.dev20231003

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-03 10:02:55 -07:00
Vivek Khandelwal ca6ce8974f [MLIR][TORCH] Add support for int8 dtype for sub, add, and bitwise_and op
Signed-Off By: Vivek Khandelwal <vivek@nod-labs.com>
2023-10-03 22:12:31 +05:30
Jae Hoon (Antonio) Kim 32d9b20bde
Add linspace/cumprod/roll ops (#2498)
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.
2023-10-03 11:01:07 -04:00
Vivek Khandelwal d10a86f51c Disable LTC for arm release
Also, revert https://github.com/llvm/torch-mlir/pull/2488.
Disabling LTC based on the discussion here:
https://discord.com/channels/636084430946959380/742573221882364009/1156272667813494824
2023-10-02 22:22:07 +05:30
Stella Laurenzo b75c208f4e
update PyTorch version to 2.2.0.dev20231002 (#2497)
torch version: 2.2.0.dev20231002
torch commit hash: 4dae8b49630d2784f6a5d8726db30923e2d1e077
torchvision version: 0.17.0.dev20231002

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-10-02 08:02:15 -07:00
Vivek Khandelwal 9293326e1e [MLIR][TORCH] Add support for bitwise_right_shit and bitwise_and.Scalar op
Signed-Off By: Vivek Khandelwal <vivek@nod-labs.com>
2023-10-02 13:06:59 +05:30
Vivek Khandelwal c434736ee9 [MLIR][TORCH] Add support for conversion to int8 dtype
Signed-Off By: Vivek Khandelwal <vivek@nod-labs.com>
2023-10-02 09:48:46 +05:30
Vivek Khandelwal 71ac62f3a8 build: manually update PyTorch version
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: 9399e0b1ff
2023-10-02 09:48:32 +05:30
Stella Laurenzo 860be09a39
Elide dynamic broadcast checks when in strict symbolic shapes mode. (#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.
2023-09-29 16:45:48 -07:00