Commit Graph

2114 Commits (c56cb531d546d9816817bce1599dccde3cf7aa54)
 

Author SHA1 Message Date
Vivek Khandelwal 3451dd32a7 build: manually update PyTorch version
Set PyTorch and TorchVision version to nightly release 2023-04-01.

Signed-Off By: Vivek Khandelwal <vivek@nod-labs.com>
2023-04-01 21:45:58 +05:30
Vivek Khandelwal 82fb9c7fb8 [MLIR][TORCH] Add decomposition for prims::squeeze op
This commit adds the decomposition for the prims.squeeze op.

Signed-Off By: Vivek Khandelwal<vivek@nod-labs.com>
2023-04-01 21:45:58 +05:30
Vivek Khandelwal b2af43b17c
build: manually update PyTorch version (#1988) 2023-03-31 02:09:53 -07:00
Tanyo Kwok c47d4bd852
Update llvm tag to 9c4611f9c7a7 (#1980)
* Update llvm tag to 9c4611f9c7a7

* add llvm-project patch
2023-03-31 14:16:50 +08:00
Ramiro Leal-Cavazos e0f301c890
Add `extra_library` kwarg to `torch_mlir.compile` (#1986)
This commit adds the ability to specify extra abstract interpretation
functions in `torch_mlir.compile` to use during type refinement. This
allows users to easily add custom ops without having to interact with
MLIR or C++ directly.
2023-03-30 09:20:19 -07:00
Chi_Liu 6bb9965a41
[TOSA] Add support for AtenZerosOp 0/strided layout (#1983) 2023-03-30 07:08:20 -07:00
Ramiro Leal-Cavazos 42d780dde0
Remove convolution_overrideable, convolution_backward_overrideable (#1984)
The ops `aten.convolution_overrideable` and
`aten.convolution_backward_overrideable` are currently not e2e tested
in Torch-MLIR. Moreover, there is no way to add e2e tests for them
because the ops cannot be called using the CPU backend (this also
prevents adding tested dtype functions for these ops). Since these two
ops are not expected to ever appear in PyTorch traces obtained through
standard means (https://github.com/pytorch/pytorch/issues/97481),
Torch-MLIR should not have to worry about them.
2023-03-29 15:05:56 -07:00
Ramiro Leal-Cavazos 0103c55e55
Add `RecomposeComplexOps` declaration + fix typos in pass name (#1950)
The `RecomposeComplexOps` pass currently does not have a TableGen
declaration and it is using the base class of `DecomposeComplexOps`,
which causes `--mlir-print-ir-after-all` to create wrong pass
labels. This commit fixes that as well as some minor typos in the name
of the pass.
2023-03-28 11:07:47 -07:00
Ramiro Leal-Cavazos d803ab4eeb
Cast `number` to `float` when shape function takes Scalar arg (#1978)
To keep things simple in shape functions, `Scalar` inputs are
considered `float`s. This means that when inserting the shape
functions into the IR, we must cast any `!torch.number`s into `float`s
so that the operand type matches the expected type in the shape
function. This commit adds the cast from `Scalar` to `float`.
2023-03-28 09:30:31 -07:00
Ziheng Jiang 72bb902640
[STABLEHLO] Move utils.h to include/ (#1974) 2023-03-27 21:16:21 -07:00
Sean Silva 4e82b30c88 Update long_term_roadmap.md 2023-03-27 12:34:07 -07:00
wkwkes aa43261cff
[README] fix line break (#1969) 2023-03-24 21:42:15 -07:00
Maksim Levental 953ea39cb5
handles 2,3,4 from https://github.com/llvm/torch-mlir/issues/1963 (#1964) 2023-03-24 21:50:01 -05:00
Ramiro Leal-Cavazos a7449785ec
Use upstream shape functions when available (#1952)
There are several ops that have their shape function upstream and had
not been updated in Torch-MLIR to use the upstream version. This
commit updates those shape function. In addition, TODOs have been
added for shape functions that should be upstream but are not.
2023-03-24 09:13:43 -07:00
Roll PyTorch Action 158be370d1 update PyTorch version to 2.1.0.dev20230324 2023-03-24 13:23:10 +00:00
Michael Feliz 2389729fb9
Add support for aten_remainder in TorchToTosa (#1966) 2023-03-23 17:55:58 -07:00
Ramiro Leal-Cavazos eae3ff7f1c
Change dtype functions interface to take ints tuple for each tensor (#1965)
The original design for the dtype functions outlined in
https://github.com/llvm/torch-mlir/issues/1462 was unable to properly
handle ops that take optional tensors as an input when the optional
tensor has a value of None. By the time the op gets imported into
torch-mlir, if an optional value is None, all information about the
original type is lost from the op type signature, preventing
torch-mlir from knowing if a value of None was from an optional tensor
or not, which was crucial in the original design since each tensor
argument must be turned into two separate arguments for the dtype
function.

This commit changes the interface to dtype functions such that each
tensor turns into a tuple of two ints, the first representing the rank
of the tensor and the second the dtype of the tensor. Since now there
is a one-to-one correspondence between the operands of an op and the
operands of its dtype function, there is no ambiguity about which
operand of the op corresponds with which operand of the dtype
function.

To test the implementation, this commit defines dtype function for
convolution op, which takes one optional tensor as an argument.
2023-03-23 11:05:39 -07:00
Roll PyTorch Action f2a05f2dc0 update PyTorch version to 2.1.0.dev20230323 2023-03-23 13:34:51 +00:00
Zhekun Zhang 5758a0bfbb
[StableHLO] Support for slice_scatter (#1960)
Co-authored-by: zhekun.zhang <zhekun.zhang@bytedance.com>
2023-03-22 13:41:04 -07:00
Roll PyTorch Action 544b5f232b update PyTorch version to 2.1.0.dev20230322 2023-03-22 13:23:58 +00:00
lisaliu1 d632afce31
Max pool2d ceil mode to tosa (#1957)
* implemented ceil_mode== true support for lowering aten.max_pool2d to tosa
* add e2e test for lowering aten.max_pool2d to tosa with ceil_mode=true

---------

Co-authored-by: Lisa Liu <lingl@xilinx.com>
2023-03-21 10:17:39 -07:00
Roll PyTorch Action c1b7de109e update PyTorch version to 2.1.0.dev20230321 2023-03-21 13:21:07 +00:00
Sean Silva c319a20828 Update to LLVM 029313cc979ae71877b65794b1063d4e51184cc8
- mergeBlockBefore -> inlineBlockBefore
- move tosa-to-tensor pass ordering

https://github.com/llvm/torch-mlir/issues/1178#issuecomment-1476217922
2023-03-21 04:16:20 -07:00
Yuanqiang Liu 3698a95586
[MHLO] add conversion for aten.linalg_vector_norm (#1850) 2023-03-20 14:14:27 -07:00
Sean Silva a412c85fd7 [docs] Add changes to e2e testing to long-term roadmap 2023-03-20 11:38:13 -07:00
Matthias Gehre aa5bcb3cf2
LowerToBackendContract: Explicitly error out on unimplemented operator (#1947)
* LowerToBackendContract: Explicitly error out on unimplemented operator

But only reject torch.operator when results are invalid.
Otherwise it might be a custom op that the backend supports.
2023-03-20 16:27:08 +01:00
Roll PyTorch Action 6eeed46060 update PyTorch version to 2.1.0.dev20230320 2023-03-20 13:24:16 +00:00
Roll PyTorch Action be9c0de957 update PyTorch version to 2.1.0.dev20230319 2023-03-19 13:22:18 +00:00
Roll PyTorch Action 679fa96bb3 update PyTorch version to 2.1.0.dev20230318 2023-03-18 13:21:57 +00:00
Roll PyTorch Action 3f3833d770 update PyTorch version to 2.1.0.dev20230317 2023-03-17 13:23:44 +00:00
Ramiro Leal-Cavazos 18035021f0
RefineTypes aten.sum: check dtype exists before accessing methods (#1944)
This commit adds a check that `defaultDtype` exists in the RefineTypes
handling of `AtenSumOp` before accessing the method `isInteger`, which
crashes the program is `defaultDtype` is null.

The handling of `defaultDtype` is the same as the one used for the
`AtenSumDimIntListOp`.
2023-03-16 08:35:49 -07:00
Roll PyTorch Action 91cd37256c update PyTorch version to 2.1.0.dev20230316 2023-03-16 13:36:59 +00:00
lisaliu1 7d711b9f9f
Constant pad nd to tosa (#1933)
* implemented lowering torch.aten.constant_pad_nd to tosa
* add constant_pad_nd e2e tests to TOSA_PASS_SET
* add PadModule_basic & PadWithNoneValModule_basic to TOSA_PASS_SET
---------

Co-authored-by: Lisa Liu <lingl@xilinx.com>
2023-03-15 08:42:15 -07:00
Roll PyTorch Action 2468347376 update PyTorch version to 2.1.0.dev20230315 2023-03-15 13:24:04 +00:00
Sambhav Jain 91e0f38b57
[Bazel] Add StableHLO registration dependency (#1937)
Fixes a broken bazel build from https://github.com/llvm/torch-mlir/pull/1887 causing the following build error:

```
ERROR: /root/.cache/bazel/_bazel_root/b89349c08f7224396763d14fe35cba11/external/torch-mlir/BUILD.bazel:819:10: Compiling tools/torch-mlir-opt/torch-mlir-opt.cpp failed: (Exit 1): clang failed: error executing command /usr/lib/llvm-16/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer ... (remaining 366 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/torch-mlir/tools/torch-mlir-opt/torch-mlir-opt.cpp:16:10: fatal error: 'stablehlo/dialect/Register.h' file not found
#include "stablehlo/dialect/Register.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Target @torch-mlir//:torch-mlir-opt failed to build
```

GHA workflow with the fix:
https://github.com/sjain-stanford/torch-mlir/actions/runs/4421486154
2023-03-14 20:04:09 -07:00
Yuanqiang Liu b967469906
[e2e] fix stack e2e test typo (#1931) 2023-03-14 09:32:44 -07:00
Jiahao Li 4912c3937d
Support aten.stack op and decompose it into unsqueeze & cat (#1747) 2023-03-11 09:25:25 +08:00
Ramiro Leal-Cavazos d310bb12bd
Expand definition of tensor subtype to include shape/dtype info (#1929)
Currently, the op `torch.tensor_static_info_cast` will not get
canonicalized away if the result type has any shape or dtype
information. This is because `isValidSubtype` only returns true when
the tensor types being compared are exactly the same or the supertype
has no shape and dtype information. Being unable to canonicalize away
the `torch.tensor_static_info_cast` gets in the way of further
optimizations, such as shape propagation.

This commit improves `isValidSubtype` by adding logic that compares
the shapes and dtypes of the two tensor types to determine of one type
is indeed a valid subtype of the other.

Fixes https://github.com/llvm/torch-mlir/issues/1926
2023-03-10 16:43:57 -08:00
gpetters94 66b1045a80
Add a new RecomposeComplexOps pass, fold slice+copy_ into indeX_put_ (#1901) 2023-03-10 16:42:11 -05:00
Ramiro Leal-Cavazos 2be48c3a67
Fix deprecation warnings for `isOneValue` and `getAllOnesValue` (#1928)
The functions `isOneValue` and `getAllOnesValues` are
deprecated. `isOne` and `getAllOnes` should be used instead.
2023-03-10 09:50:56 -08:00
Roll PyTorch Action 327deb90cd update PyTorch version to 2.1.0.dev20230310 2023-03-10 13:23:52 +00:00
Ziheng Jiang dca2b8a40a
[TORCH] Improve type refinement for aten.cat. (#1908)
* [TORCH] Fix type refinement for aten.cat.

* Add test.

* Address comments.

* Update.

* Update.

* Update.

* Update.

* Update.

---------

Co-authored-by: Ziheng Jiang <ziheng.jiang@bytedance.com>
2023-03-09 16:17:35 -08:00
Roll PyTorch Action 1e6608f90c update PyTorch version to 2.1.0.dev20230309 2023-03-09 13:27:36 +00:00
Roll PyTorch Action 40c25cecc4 update PyTorch version to 2.1.0.dev20230308 2023-03-08 15:25:16 +00:00
Kan Chen 86b792520b
Fix the error of type casting in dynamo example (#1860) 2023-03-07 10:50:35 -06:00
Kan Chen 13533307ca
Adding stablehlo dialects support for torch-mlir-opt tool (#1887)
* Adding stablehlo dialects support for torch-mlir-opt tool.

* Update torch-mlir-opt.cpp

Fixed the build error according to build configuration for macOS.
2023-03-07 10:48:49 -06:00
Roll PyTorch Action 6c06b9560d update PyTorch version to 2.1.0.dev20230307 2023-03-07 13:37:23 +00:00
Eric Kunze 4c7e7ec116
Update LLVM tag to 21f4b84c (#1918)
Update PassManager C interface to use mlirPassManagerRunOnOp
Update python calls to PassManager to also use operation instead of
module
2023-03-06 22:53:26 -08:00
Maksim Levental c718f87c5d
- rename no-jit -> core (#1920)
- add windows release
2023-03-07 00:20:06 -06:00
Zhekun Zhang 1d3a7419c5
[Torch Dialect] add RSub, ScalarImplicit canonicalize (#1899)
* add rsub, scalarimplit canonicalizer

* reformat

* address comments

* fix bug

* fix test

* Update elementwise.py

* resolve merge conflict

* change to 3

* change to 3

* real fix

* fix name

* add torchdynamo fail test

---------

Co-authored-by: zhekun.zhang <zhekun.zhang@bytedance.com>
2023-03-06 17:38:27 -08:00