Commit Graph

1642 Commits (b1f68328497c53aa2a9aba5dfa079c69a0b72132)
 

Author SHA1 Message Date
Jae Hoon (Antonio) Kim 2f300935bf
Reference lazy graph executor (#1507)
* Add LazyGraphExecutor registration

* Update PyTorch version to 1.14.0.dev20221024

Co-authored-by: Roll PyTorch Action <torch-mlir@users.noreply.github.com>
2022-10-24 17:15:11 -04:00
powderluv 3f883802e8
Relax the need for only CPU versions of PyTorch (#1505)
* Relax the need for only CPU versions of PyTorch

This allows installing corresponding PyTorch CUDA / ROCM versions and using torch-mlir.

* Remove obsolete comments
2022-10-24 13:46:31 -07:00
Roll PyTorch Action 470a2f62f3 update PyTorch version to 1.14.0.dev20221021 2022-10-21 15:25:28 +00:00
Sean Silva efbebf2001 [docs] Initial code_owners.md
As discussed in #1506, this should help to distribute the review load
and ensure timely, high quality reviews.

Closes #1506
2022-10-21 04:53:00 -07:00
Sean Silva 0dab31666e Fix old reference to !numpy.ndarray 2022-10-21 02:10:18 -07:00
Ashay Rane 4a776be156
build: make PyTorch caching more robust (#1510)
Whether or not the PyTorch build is cached should not affect the success
of the Torch-MLIR build, but based on the existing code, a build may
fail if the `TM_PYTORCH_INSTALL_WITHOUT_REBUILD` variable was set but
the build cache doesn't exist.

Although that variable is set by CI upon a cache hit, nuances of
Github's caching behavior can create situations where the coupling
between `TM_PYTORCH_INSTALL_WITHOUT_REBUILD` and the cache lookup fails.

Specifically, a branch other than our default branch (`main`) may create
the cache entry, but because Github doesn't share this cache entry with
builds running on the `main` branch, the `main` branch build tries to
create it's own cache entry.  However, since cache identifiers are
unique and because caches are immutable, the caching step running in the
`main` branch appears to create an invalid cache entry (of 233 bytes,
instead of the expected ~60 MB).

Consequently, subsequent builds observe a cache "hit", since caches
created by the `main` branch are shared with all other branches, but
because this cache entry is invalid (since it doesn't actually contain
the ~60 MB PyTorch WHL file), the builds fail.

One workaround would be to let only the `main` branch create caches, but
in doing so, we would also prevent other branches from _reading_ the
cache, making the builds in those branches terribly slow.

So this patch uses a different workaround, which is to check whether the
PyTorch WHL file exists, even if the build observed a cache hit.  If the
file doesn't exist, even if it was a purported cache hit, the code
builds PyTorch from source, which is probably intuitive.

A longer term fix will follow, after a discussion with the wider team.
2022-10-20 08:50:18 -05:00
Roll PyTorch Action 724d8d183a update PyTorch version to 1.14.0.dev20221020 2022-10-20 13:38:23 +00:00
Roll PyTorch Action c97df38e3e update PyTorch version to 1.14.0.dev20221019 2022-10-19 15:27:42 +00:00
Ashay Rane 1d28098c3c
Revert "update PyTorch version to 1.14.0.dev20221018" (#1504)
Upstream PyTorch nightly page
[https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html]
somehow dropped the link for torch-1.14.0.dev20221018 for macOS but not
for Linux or Windows, whereas our RollPyTorch action assumes that if the
nightly version is available for Linux, it is also available for macOS.
This reverts the commit that changed the PyTorch version.
2022-10-18 13:51:26 -05:00
Chi_Liu ad6f5848cb
[MLIR][TORCH] Add TorchToTosa lowering for aten.where.self op (#1454) 2022-10-18 09:39:39 -07:00
Roll PyTorch Action 943cc9e736 update PyTorch version to 1.14.0.dev20221018 2022-10-18 16:05:58 +00:00
Ashay Rane b86ec38541
ci: use the LLVM linker instead of GNU ld (#1501)
Without this patch, CI logs contained the line:

    -- Linker detection: GNU ld

GNU ld is notoriously slow at linking large binaries, so this patch
swaps GNU ld with the LLVM linker.

Since the linker invocation is driven through the compiler, perhaps the
best way to use the LLVM linker is to tell the compiler which linker
binary to use.  This patch adds the `-fuse-ld=lld` flag to all Linux
builds of Torch-MLIR in CI to make it use lld.
2022-10-18 00:43:04 -05:00
Ashay Rane a9942f343a
Cache PyTorch source builds to reduce CI time (#1500)
* ci: cache PyTorch source builds

This patch reduces the time spent in regular CI builds by caching
PyTorch source builds.  Specifically, this patch:

1. Makes CI lookup the cache entry for the PyTorch commit hash in
   pytorch-version.txt
2. If lookup was successful, CI fetches the previously-generated WHL
   file into the build_tools/python/wheelhouse directory
3. CI sets the `TM_PYTORCH_INSTALL_WITHOUT_REBUILD` variable to `true`
4. The build_libtorch.sh script then uses the downloaded WHL file
   instead of rebuilding PyTorch

* ci: warm up PyTorch source cache during daily RollPyTorch action

This patch makes the RollPyTorch action write the updated WHL file to
the cache, so that it can be later retrieved by CI that runs for each
PR.  We deliberately add the caching step to the end of the action since
the RollPyTorch action never needs to read from the cache, although
executing this step earlier in the process should not cause problems
either.
2022-10-18 00:42:42 -05:00
Ramiro Leal-Cavazos 82a3860e25
build: update llvm tag to 4546397e (#1502)
This commit makes the following changes needed to update bump LLVM:

- Replace `linalg.init_tensor` with `tensor.empty` (see:
https://reviews.llvm.org/D135129)
- Replace `NoSideEffect` with `Pure` (see
https://reviews.llvm.org/D135505)
- Replace `body` region accessor for `ReduceOp` and `ReduceWindowOp`
with `getBody`
- Fix incorrect use of `tosa::ReduceSumOp` in `AtenNativeLayerNormOp`
conversion pattern. The result type of `tosa::ReduceSumOp` must have
the same rank as the input type. (see:
https://www.mlplatform.org/tosa/tosa_spec.html#_reduce_sum)

Co-authored-by: Ashay Rane <ashay@users.noreply.github.com>

Co-authored-by: Ashay Rane <ashay@users.noreply.github.com>
2022-10-18 04:22:53 +00:00
Ahmed S. Taei 844d58279d
[Bazel] Update bazel_skylib version (#1498)
This should fix current bazel build
2022-10-17 09:05:54 -07:00
Roll PyTorch Action 679170702c update PyTorch version to 1.14.0.dev20221017 2022-10-17 13:40:06 +00:00
Roll PyTorch Action 5f69d2c2ef update PyTorch version to 1.14.0.dev20221016 2022-10-16 14:03:14 +00:00
Roll PyTorch Action a9177102c6 update PyTorch version to 1.14.0.dev20221015 2022-10-15 16:47:22 +00:00
Ramiro Leal-Cavazos 86095dd432
Replace linear transformation with `low` and `high` in test inputs (#1485)
This commit replaces test inputs that were being linearly transformed
by multiplying and adding/subtracting to the input tensor with inputs
that use the `low` and `high` keyword arguments instead.
2022-10-14 18:52:07 +00:00
Gleb Kazantaev bdb5083d33
New ops support & enhancements (#1494)
* New ops support & enhancements

* Enabled xfail ltc tests
2022-10-14 10:28:21 -04:00
Roll PyTorch Action 7df9179f85 update PyTorch version to 1.14.0.dev20221014 2022-10-14 14:04:52 +00:00
Roll PyTorch Action a0dd0ddcbf update PyTorch version to 1.14.0.dev20221013 2022-10-13 14:13:56 +00:00
Ashay Rane 0374a6da4e
ci: re-enable auto execution of the RollPyTorch action (#1488)
Now that the RollPyTorch action seems to have become stable, this patch
enables that action to be run at around 4am Pacific Time every day.
2022-10-12 19:18:54 -05:00
Prashant Kumar 3a2cd23380 [LINALG] Add lowering for aten::round op.
-- Added the lowering for aten::round op.
-- Added the folding for integer cases.
2022-10-13 02:41:26 +05:30
Ramiro Leal-Cavazos 8f76c74be9
Remove unused input tensor from linalg.generic in aten.convolution (#1487)
This commit removes the `weight` tensor from the inputs of one of the
`linalg.generic` ops generated by the `aten.convolution` linalg
lowering, since the indexed values are not actually used by the body
of the `linalg.generic`. Moreover, in general the `weight` tensor does
not have the same shape as the output tensor of the `linalg.generic`,
so both tensors being indexed by the same indexing maps is wrong.
2022-10-12 14:01:24 -07:00
Roll PyTorch Action b487113ef1 update PyTorch version to 1.14.0.dev20221012 2022-10-12 14:37:13 +00:00
Daniel Ellis c085da148a Publish Python 3.7 packages.
This is the runtime Colab uses.
2022-10-12 08:50:12 -04:00
Sean Silva c8280d67bd Remove the heavydep tests
We originally added these to help bring up more complex models with
heavier dependencies. However, over time it has become clear that these
models usually require more than just heavier dependencies -- they often
require a nontrivial amount of "one-off" code to extract the relevant
parts of the model and compile them. This is not a good fit for a
component in the core Torch-MLIR repo.

However, in the community, nod.ai has developed the ["Shark
Tank"](https://github.com/nod-ai/SHARK/tree/main/tank) which has all the
appropriate code to wrangle these models and organize them. We intend to
more heaviliy lean on that as a community and improve the symbiosis
there to serve the role that these heavydep tests were meant to play.
2022-10-12 05:19:36 -07:00
Sean Silva 6403c0e56f torch_mlir.compile: allow custom backend_legal_ops set
Allow customizing `backend_legal_ops` for "torch" output type, since we
don't know which backend will be used (it might be a custom backend).
We don't allow customizing the `backend_legal_ops` for the other output
types (Linalg, TOSA, MHLO) since those backends control their set of
legal ops directly.

Fixes #1418
2022-10-12 04:21:22 -07:00
Abhishek Varma 61db1b5c4d
[MLIR][TORCH] Add e2e support for `aten.Mish` op (#1470)
-- This commit adds e2e support for `aten.Mish` op.
-- `aten.Mish` op is decomposed as following :-
    Mish(x) = x * Tanh(Softplus(x))

Signed-off-by: Abhishek Varma <avarma094@gmail.com>

Signed-off-by: Abhishek Varma <avarma094@gmail.com>
2022-10-11 14:03:10 -07:00
Daniel Ellis 67a0fb14ef Fix build release workflow. 2022-10-11 15:19:53 -04:00
Jae Hoon (Antonio) Kim 3e08f5a779
Fix `fromIntArrayRef` call (#1479)
* Fix fromSymint call

* Update PyTorch requirement

* Re-enable LTC
2022-10-11 13:29:07 -04:00
Ashay Rane aefbf65e27
Disable LTC and update PyTorch (#1472)
* build: disable LTC again so that we can bump PyTorch version

When built using PyTorch's master branch, the LTC code has been failing
to build for a few days.  As a result, the PyTorch version referenced by
Torch-MLIR is stalled to the one from October 4th.

In an effort to advance to PyTorch version, this patch disables LTC, and
a subsequent patch will advance the PyTorch version.

* update PyTorch version to 1.14.0.dev20221010

Also disables the `UpSampleNearest2dDynamicFactor_basic` e2e test, since
the (PyTorch) oracle differs from the computed value for both the
refbackend and the eager_mode backends.
2022-10-10 23:05:40 -05:00
Gaurav Shukla da90a25f90 [MLIR][TORCH] Add E2E support for `aten.[div.int|bitwise_or.Tensor]` ops
This commit adds lowering of `aten.div.int` and `aten.bitwise_or.Tensor`
ops. Both these ops are required in order to support bloom_560m model.

Signed-Off-by: Gaurav Shukla <gaurav@nod-labs.com>
2022-10-10 22:28:51 +05:30
Daniel Ellis 2e0d806bf7 Publish releases page after both mac and linux builds.
Mac was finishing first, causing linux releases to be lagged a day behind.
2022-10-10 10:37:02 -04:00
Vivek Khandelwal d4e1867e90 [MLIR] Fix bazel build
Signed-Off By: Vivek Khandelwal<vivek@nod-labs.com>
2022-10-06 23:16:51 +05:30
Vivek Khandelwal d3cc3f1aff [tosa] Add lowering for aten.to.dtype and aten._to_copy op
This commit adds the TorchToTosa lowering for `aten.to.dtype` and
`aten._to_copy` op.

Signed-Off By: Vivek Khandelwal<vivek@nod-labs.com>
2022-10-06 12:00:25 +05:30
Vivek Khandelwal 56f9a9b5de [tosa] Add TorchToTosa lowering for torch.prim.NumToTensor.Scalar op
Signed-Off By: Vivek Khandelwal<vivek@nod-labs.com>
2022-10-06 12:00:25 +05:30
Ramiro Leal-Cavazos 8201e7b067
[LINALG] Make `AtenMaxDimOp` use `arith.maxf` to calculate maximum (#1466)
This commit updates the linalg conversion of `AtenMaxDimOp` to use
`arith.maxf` instead of `arith.select` to calculate the maximum. This
allows better vectorization further downstream, since the operation
can be converted to a simple max reduction when the `indices` result
is not used. See: https://github.com/iree-org/iree/issues/10666.
2022-10-05 18:22:59 -07:00
Daniel Ellis e7b2b84a66 Update torch-mlir-opt error message. 2022-10-05 15:02:10 -04:00
Jae Hoon (Antonio) Kim c57d801260
Fix functionalize_aten_op calls for symint ops (#1459)
* Fix functionalize_aten_op calls for symint ops

* Update PyTorch version
2022-10-05 10:23:48 -04:00
Ashay Rane faa9a78e38
build: update llvm tag to 6f46ff37 (#1448)
Summary of changes:
 - Updated references to the Arith dialect
   (https://reviews.llvm.org/D134762)
 - Switched to prefixed accessors for MemRef dialect
   (https://reviews.llvm.org/D134995)
 - Fixed warnings about signed/unsigned comparisons, ignored return
   values, and unused variables
2022-10-05 08:28:06 -05:00
Gleb Kazantaev 708fa346a6
Fix Base Lazy Backend Type Conversion (#1412)
* Fix c10::prim::Constant conversion; Added CAPI for passes; Added passes to base lazy backend

* Update ivalue_importer to use ImportOptions; Added tests for non-value/value tensor types

* Added tests for scalar Constant import; Updated MB::importFunction to use ImportOptions

* Test updates

* Move back module variable name

* Remove RefineTypes from TorchMlirLoweringContext::Build()

* Rename pass; Remove passes from base lazy backend

* Rename pass to VerifyBackendContractPass

* Aligned cmd pass name; Fixed TorchConversion passes registration
2022-10-04 15:53:28 -07:00
Gleb Kazantaev eda18e351c
LTC aten.where support (#1455)
aten.where support
2022-10-04 10:17:41 -07:00
Ashay Rane 760cb13be0
build: switch to the correct directory before updating ODS (#1452) 2022-10-04 11:24:32 -05:00
Daniel Ellis 2ba71af651 Add support for mv decomposition. 2022-10-04 11:34:45 -04:00
Prashant Kumar 6777a9484d [LINALG] Add lowering for the aten.upsample_nearest2d op. 2022-10-04 17:20:29 +05:30
Ashay Rane 8a8e779529
Disable auto-update of PyTorch version until CI script stabilizes (#1456)
Instead of letting the auto-update script either fail because of script
errors or letting it commit bad versions, this patch makes the update
process manual, for now.  Once the script stabilizes, I will its
re-enable periodic execution.
2022-10-04 03:02:44 -05:00
Roll PyTorch Action 7da1af85c2 update PyTorch version to 1.13.0.dev20221003 2022-10-03 16:35:07 +00:00
Ashay Rane da02390188
build: update ODS and shape library when updating PyTorch (#1450)
Updating the PyTorch version may break the Torch-MLIR build, as it did
recently, since the PyTorch update caused the shape library to change,
but the shape library was not updated in the commit for updating
PyTorch.

This patch introduces a new default-off environment variable to the
build_linux_packages.sh script called `TM_UPDATE_ODS_AND_SHAPE_LIB`
which instructs the script to run the update_torch_ods.sh and
update_shape_lib.sh scripts.

However, running these scripts requires an in-tree build and the tests
that run for an in-tree build of Torch-MLIR are more comprehensive than
those that run for an out-of-tree build, so this patch also swaps out
the out-of-tree build for an in-tree build.
2022-10-02 18:02:34 -05:00