Commit Graph

2319 Commits (46a0745438f725fc9554cc6b9664e71fd82f098e)
 

Author SHA1 Message Date
Stella Laurenzo 46a0745438 Cleanup source build exclusions. 2023-11-18 20:06:23 -08:00
Stella Laurenzo 947715b68f Disable pytorch build from source for out of tree. 2023-11-18 19:43:35 -08:00
Stella Laurenzo a1cd142340 Disable LTC for out-of-tree. 2023-11-18 19:12:14 -08:00
Stella Laurenzo 9ed175e352 Link explicitly against extra torch libraries. 2023-11-18 18:53:35 -08:00
Stella Laurenzo 47a8e396e2 Add debugging. 2023-11-18 18:27:55 -08:00
Stella Laurenzo f1d9136210 First step of move common jit_ir_importer. 2023-11-18 18:12:15 -08:00
Stella Laurenzo 606dc45896 Get LTC building. 2023-11-18 17:56:00 -08:00
Stella Laurenzo fabb4d6e5d Set correct name on lit test suite. 2023-11-18 17:27:52 -08:00
Stella Laurenzo e9a9b62caa Load torch dialect in jit_ir_importer. 2023-11-18 17:25:22 -08:00
Stella Laurenzo 2ed2ca9817 Rename jit_ir python package. 2023-11-18 17:25:22 -08:00
Stella Laurenzo 61f5ff2ee4 Make build work (LTC not adapted yet). 2023-11-18 17:25:22 -08:00
Stella Laurenzo e7ead186cb Initial moves 2023-11-18 17:25:16 -08:00
Yuanqiang Liu facbe5d96b
[Torch Dialect] support AtenArangeStartOutOp in ReduceOpVariants like… (#2563)
… AtenBernoulli_FloatOp

It fixing case like: `%2110 = torch.aten.arange.start_out %int1,
%int1517, %int1, %2109 : !torch.int, !torch.int, !torch.int,
!torch.tensor -> !torch.tensor`.
`aten.arange.start_out` doesn't have value semantics also, means`%2110`
is an alias for %2109.
So I decompose it to `aten.arange.start` + `torch.contents.overwrite`.  
The complex decomposition logic is target to handle cases like view and
dtype cast which I add in e2e tests.
2023-11-17 00:51:55 +08:00
James Newling dad1f012f6
Add verification for torch permute op (#2551)
- adds support for an optional verifier to the generated torch op
tablegen (GeneratedTorchOps.td)
- uses the above to add a verifier for the torch permute op. 

Motivation: I hit an unclear error from linalg while developing a
decomposition pass for pixel_shuffle. The error would have been clearer
if the problem had been detected earlier in the invalid aten.permute op.

Testing: new tests added. To run added tests, from the base directory
run

```
 ./build/bin/llvm-lit  test/Dialect/Torch/invalid.mlir
 ```
2023-11-15 11:47:54 -08:00
James Newling e81282ae8f
Support for prims collapse op (lowering to linalg) (#2572)
Steps taken:
1) add generator code to torch_ods_gen.py, run update_torch_ods.sh
2) add (custom) shape and type inference generator code to
abstract_interp_lib_gen.py, run update_abstract_interp_lib.sh
3) Implement lowering to tensor.collapse_dims. Requires the `start` and
`end` values to be constant, else lowering fails
4) Update xfail_sets.py (append to LTC_XFAIL_SET) after running
/tools/e2e_test.sh --filter Collapse --verbose -c XX for all support
backends (XX).

Motivation: 
- Supporting the collapse operation will be useful for lowering of
pixel_shuffle (see Issue #2559)
2023-11-15 08:34:38 -08:00
Stella Laurenzo 6be9789f9f
update PyTorch version to 2.2.0.dev20231115 (#2577)
torch version: 2.2.0.dev20231115
torch commit hash: a5a404865c01f86881f6b3ab0cd9a562d0b420de
torchvision version: 0.17.0.dev20231115

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-15 06:38:54 -08:00
Stella Laurenzo d734f7890c
update PyTorch version to 2.2.0.dev20231114 (#2574)
torch version: 2.2.0.dev20231114
torch commit hash: ec2f8fd2f1ac81996641848d9c7b904fddbbf9cf
torchvision version: 0.17.0.dev20231114

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-14 06:23:05 -08:00
Shehroze Khan dde66e66b0
add bool scalar type to int implicit cast (#2571)
[LTC] Add bool scalar type to int implicit cast
2023-11-14 08:56:12 -05:00
Stella Laurenzo c61f0bd5bb
update PyTorch version to 2.2.0.dev20231113 (#2570)
torch version: 2.2.0.dev20231113
torch commit hash: a45a8bf9e7e1530692f2703f8da430bc2825af7c
torchvision version: 0.17.0.dev20231113

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-13 07:19:30 -08:00
lzw dd759a24f2
Update readme to fit new project structure (#2548)
Co-authored-by: lanzongwei.lan <lanzongwei.lan@bytedance.com>
2023-11-12 21:19:18 -08:00
Stella Laurenzo 1a064cdf1a
update PyTorch version to 2.2.0.dev20231112 (#2569)
torch version: 2.2.0.dev20231112
torch commit hash: 63a5a14da9ef3ebd68ce0cebea4aa84e030a2cf8
torchvision version: 0.17.0.dev20231112

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-12 07:32:55 -08:00
Stella Laurenzo 2a99402796
update PyTorch version to 2.2.0.dev20231111 (#2568)
torch version: 2.2.0.dev20231111
torch commit hash: f40306d6c4b2613c18525a274d98feeda0036473
torchvision version: 0.17.0.dev20231111

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-11 07:00:47 -08:00
Yuanqiang Liu 3ab790c50a
[Torch Dialect] add canonicalize for aten.numel (#2562) 2023-11-11 12:16:53 +08:00
Stella Laurenzo b20daf5710
update PyTorch version to 2.2.0.dev20231110 (#2566)
torch version: 2.2.0.dev20231110
torch commit hash: edbf22fa03bafd1d2849ba41db75a2bea172dbcc
torchvision version: 0.17.0.dev20231110

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-10 06:23:58 -08:00
James Newling 98ee7fe548 Update E2E links 2023-11-09 13:55:37 -06:00
Ramiro Leal-Cavazos d082310bd8 Move Wiki to `docs/`
Currently the docs are split into two places, the `docs/` directory
and the Github Wiki of Torch-MLIR. This commit moves the wiki docs to
`docs/` to consolidate everything into one place. This has the added
benefit that users will get all the documentation when they clone the
repository.

Note: there are 4 files in the wiki, but only one is truly needed
- Torch-ops-E2E-implementation.md: only file needed
- Coding-Style.md: the contents of this file are already in
Torch-ops-E2E-implementation.md
- Weekly-LLVM-Update.md: this is outdated. We no longer have a weekly
schedule for llvm updates
- Home.md: Contains links to talks and resources that are already
present in the documentation in `docs/` or in
Torch-ops-E2E-implementation.md

Co-authored-by: Yi Zhang <cathyzhyi@google.com>
Co-authored-by: Ashay Rane <ashay@users.noreply.github.com>
Co-authored-by: Sean Silva <silvasean@google.com>
Co-authored-by: Daniel Ellis <1346302+dellis23@users.noreply.github.com>
Co-authored-by: Vivek Khandelwal <vivekkhandelwal1424@gmail.com>
2023-11-09 13:55:37 -06:00
Stella Laurenzo a7b5dfb389
update PyTorch version to 2.2.0.dev20231109 (#2564)
torch version: 2.2.0.dev20231109
torch commit hash: 2c3ba6926e38dba05bda34f0af9c092a40cff5b7
torchvision version: 0.17.0.dev20231109

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-09 06:21:48 -08:00
Yuanqiang Liu 60effcee89
[Dtype Function] fix aten.div.Tensor_mode's dtype function (#2555) 2023-11-09 09:46:53 +08:00
saienduri ad18219820
Fix for unused variable failure when trying to bump torch-mlir in IREE (#2560)
Due to blob being an unused variable, we are not able to bump torch-mlir
in iree. With this PR, we remove this unused variable.
2023-11-08 15:55:41 -08:00
Stella Laurenzo f3bfa81857
update PyTorch version to 2.2.0.dev20231106 (#2556)
torch version: 2.2.0.dev20231106
torch commit hash: a04dd794ad694baeb257c12329c3166c6a44ae50
torchvision version: 0.17.0.dev20231106

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-08 07:20:36 -08:00
James Newling b6e551c7b8
Decomposition of aten.pixel_shuffle with static input shape (#2550)
For static tests (that is when the shape is know) for example:

 ```
 @annotate_args([None, ([3, 18, 2, 2], torch.float32, True)])
 ```
 
The e2e passes. But only if the replacement op's return type is set as
undefined (optional shape and type must be explicitly made unset),
otherwise there's a error about the function return type.
 
 For dynamic cases, for example if the above is replaced with 
 
  ```
 @annotate_args([None, ([-1, -1, -1, -1], torch.float32, True)])
 ```

There is a failure to lower to linalg from torch ("view op explicitly
labelled as illegal"). This seems to be because the support for lowering
from torch to linalg with dynamic shapes is limited.
2023-11-08 08:52:44 -05:00
JianzheXiao a42d4c18ff
[Torch Dialect]Support aten.cosine_similarity (#2364)
As title, add support for aten.cosine_similarity, support broadcast
inputA/inputB to the same shape
2023-11-08 15:28:30 +08:00
James Newling 026cb314da
Specify path of e2e_test.sh after directory change (#2557)
Is there a way to disable some of CI for docs-only PR's?
2023-11-07 16:07:02 -08:00
Stella Laurenzo 4b9db995b5
update PyTorch version to 2.2.0.dev20231105 (#2554)
torch version: 2.2.0.dev20231105
torch commit hash: 2d7dd2e800dfd6332656074bfa208e4b25cfe907
torchvision version: 0.17.0.dev20231105

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2023-11-05 06:57:01 -08:00
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