Commit Graph

923 Commits (eecbf0bab6ce5b0d5197a8e43485aa2896a708fb)
 

Author SHA1 Message Date
dan 7750d2173a add argmax lowering
Add argmax lowering from torch to linalg
2021-10-13 14:31:16 -04:00
Sean Silva 19e9fc4ef1 Bring some more order to the e2e error reporting situation.
- Move `run_pipeline_with_repro_report` to a more common place, and use it
  consistently
- Attach a `torch.debug_module_name` to the enclosing `builtin.module`
  op to allow for self-contained error reporting (not needing to pass
  the names around.
- Remove redundant error reporting in linalg_on_tensors_backend.py and
  tosa_backend.py (their respective backend abstract base classes now
  take care of the error reports themselves)
- Save off original value of sys.stderr, rather than always resetting to
  `sys.__stderr__`. This is just more hygienic, and allows nesting if
  desired.
2021-10-08 13:00:12 -07:00
Stephen Neuendorffer fc5d03c081 post-commit review cleanup for #356
see https://github.com/llvm/torch-mlir/pull/356
2021-10-08 11:28:40 -07:00
Sean Silva 0c5c84d63d Add a basic TOSA E2E backend.
We lower through linalg-on-tensors and use RefBackend to run it.
This adds enough support for a "tanh" op. Adding more ops should be
fairly mechanical now that things are wired up. Run with:
```
./tools/torchscript_e2e_test.sh -c tosa
```

The backend structure is very similar to linalg-on-tensors based E2E
backends and is a nice parallel (see `tosa_backend.py`). Actually, this
forced a nice refactoring to the layering here. We removed
`torchscript-module-to-linalg-on-tensors-backend-pipeline` and instead
require separately running
```
torchscript-function-to-torch-backend-pipeline,torch-backend-to-linalg-on-tensors-backend-pipeline
```
This highlights the step that lowers to the "torch backend contract"
of cleaned up `torch` dialect ops is a critical step in the lowering.
Going forward, that is the key load-bearing contract of the torch-mlir
project, not the linalg-on-tensors backend contract.

Recommended review order:
- `TorchToTosa.cpp` / `TorchToTosa/basic.mlir`
- `python/torch_mlir_e2e_test/torchscript/configs/tosa_backend.py` and
  the new `utils.py` file there.
- `python/torch_mlir_e2e_test/tosa_backends/linalg_on_tensors.py` and
  `abc.py` in that directory for the TOSA backend e2e interface.
- other misc mechanical changes
2021-10-08 09:59:45 -07:00
stephenneuendorffer df12cc0c37
Add support for out-of-tree building (#356)
Currently I haven't attempted to get the python bits working.
Instead the python bits are forcibly disabled.
2021-10-07 21:44:15 -07:00
Stephen Neuendorffer 00d42ccaee Add tool substitutions to support out-of-tree builds 2021-10-07 21:16:43 -07:00
Sean Silva b74779ff8d Remove stray references to non-existent .td file.
This must be old copypasta.
2021-10-08 01:21:23 +00:00
Sean Silva 00e94c70ef Remove packaging info for now.
Need to do manylinux build for it to work across many machines.
2021-10-07 01:38:42 +00:00
Sean Silva de8ea59d52 Fix feedback from Anush. 2021-10-07 01:28:13 +00:00
Sean Silva a157d6c946 Add instructions for installing from packages. 2021-10-07 01:20:49 +00:00
Sean Silva b6628fe774 Mark releases as "published".
This allows `pip` to see them.
2021-10-06 22:48:21 +00:00
Sean Silva 4a8d05e4a5 Add torch_mlir snapshot packages.
This closely follows IREE's
[schedule_snapshot_release.yml](f2f153d394/.github/workflows/schedule_snapshot_release.yml (L1))
workflow.

The snapshot releases can be installed with:
```
python -m pip install torch_mlir -f "https://github.com/llvm/torch-mlir/releases"
```
2021-10-06 14:50:31 -07:00
Sean Silva 712445eaa8 Bring back Python packaging.
Will add a CI job that builds and uploads snapshot packages next.
2021-10-05 13:33:30 -07:00
Sean Silva dcab39146f Remove the last mentions of npcomp from torch-mlir
These snuck through.
2021-10-05 20:17:23 +00:00
dan 2e1498ad11 add i64 support to refbackend 2021-10-05 15:12:44 -04:00
Yi Zhang fadd76e9b8 E2e for MiniLM-L6-H384-uncased-sst2
Replace the original BertSequenceClassification with this new one.
The ops needed to support are identical.
2021-10-05 12:45:19 -04:00
Phoenix Meadowlark c3e0a1e1dc Add shell markdown formatting to README.md 2021-10-04 11:59:25 -07:00
Sean Silva f69630255a Add --external-config option to tools/torchscript_e2e_test.sh
This is a simple way for externals to plug their backends into the test
suite. They just implement the `TestConfig` class for their backend and
write a small script that exposes it.

I have a pending PR for iree-samples that successfully integrates this.
2021-10-04 11:48:16 -07:00
Yi Zhang 98ba255288 E2e support for layernorm. 2021-10-04 14:15:13 -04:00
Sean Silva b01f579687 Missing newline in notebook. 2021-10-04 17:53:46 +00:00
Sean Silva 4ab23261ba Fix notebook after relicensing.
The find/replace mangled it.
2021-10-04 17:52:12 +00:00
Sean Silva f0ed9e2d8d Fix update_torch_ods.sh 2021-10-01 17:47:25 +00:00
Sean Silva 5b6902e31c Dual license the torch-mlir project.
This commit (with approval from all contributors) dual licenses
the torch-mlir project under both the standard LLVM license and the
standard PyTorch license. This will facilitate moving code between
torch-mlir and the two upstream projects.

The standard file comment is now:

```
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Also available under a BSD-style license. See LICENSE.
```

See `LICENSE` in the project root for the terms of both licenses.
2021-10-01 10:46:08 -07:00
Sean Silva 5917f1dc47 Remove last mentions of IREE. 2021-10-01 17:28:07 +00:00
Sean Silva 9fc059e948 Remove old outdated roadmaps. Add placeholder new one. 2021-10-01 10:23:41 -07:00
Ramiro Leal-Cavazos 25a2c8bd85 Add notes on missing lazy tensor ops for ResNet18 and MaskRCNN 2021-09-30 16:38:12 -07:00
Ramiro Leal-Cavazos 3aef3a9e30 Remove duplicate example + fix README typo 2021-09-30 13:23:25 -07:00
Sean Silva 05a01b10b3
Add example deps for torchscript_resnet18_e2e.py 2021-09-30 12:48:35 -07:00
Sean Silva bc62a7fbf3 Update to new name of torchscript-module-to-linalg-on-tensors-backend-pipeline 2021-09-30 19:46:05 +00:00
Yi Zhang 89225b0cd8 Add BertSequenceClassification model to e2e
Use torch tracing to get the module because the original model is not
TorchScriptable out of box.
2021-09-30 13:30:29 -04:00
powderluv 649d6e4f28 Update README.md 2021-09-29 10:14:20 -07:00
Sean Silva 4a64fa28e7
Add MLP1Layer IR sample. 2021-09-29 09:20:04 -07:00
powderluv 36ac87dd83
Update Readme with examples (#336) 2021-09-28 21:43:38 -07:00
Sean Silva 8b2c099914 Update llvm-project to 204d301bb1921431a853c0bfba32007c018df1d5
This brings in the fix for the obscure RefBackend bug we were hitting.
2021-09-28 17:38:10 -07:00
Ramiro Leal-Cavazos b59f2cb673
Implement the lazytensor package (#331)
Implement the `lazytensor` python package for converting
lazy computations captured by the Lazy Tensor Core into MLIR.
This PR also fixes a few things with `torchfx` and its example
2021-09-28 17:25:06 -07:00
Sean Silva 2b99c8b990
Wordsmith readme 2021-09-28 13:53:33 -07:00
powderluv b55baf508a
Updates to Readme.md (#334) 2021-09-28 13:50:25 -07:00
powderluv 2e6c423a65
Caught by grammar police. PyTorch it is, not Pytorch. (#333) 2021-09-27 21:44:23 -07:00
Sean Silva de1a8c92f7 First pass cleaning the README 2021-09-27 17:20:50 -07:00
Sean Silva 64ce5d54d3 Update examples.
TorchFX example has been simplified, since it seems to be hitting that
weird RefBackend bug. Will dig into that.
2021-09-27 17:20:50 -07:00
Sean Silva e687d39074 Update buildAndTest.yml 2021-09-27 17:11:08 -07:00
Sean Silva 4fad753073 Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
Sean Silva d8f603a4e5 Remove old stuff in prep for move-to-root. 2021-09-27 17:11:08 -07:00
Sean Silva 404bd74ddf Port the bulk of the remaining code to torch-mlir
This leaves no real code outside torch-mlir.

This also renames the "npcomp backend contract" to "linalg on tensors
backend contract" as the name of the abstraction layer that RefBackend
(IREE too) accepts.
2021-09-27 12:48:33 -07:00
Yi Zhang aa10ec66a7 Fix torchscript_resnet18_e2e.py and resnet_inference.ipynb
Fix the tests to run with refbackend.
2021-09-27 13:03:54 -04:00
Yi Zhang cd7053dfde Add runtime check 2021-09-24 12:01:36 -04:00
Yi Zhang c9cc4cb2e9 Add i64 tensor argument support and bring back GatherModule_basic 2021-09-24 12:01:36 -04:00
Sean Silva 12d0fe7c85 Emit a proper error.
This assertion was reachable from user code (e.g. !torch.qint8 dtype),
which should never be possible for an assertion.

Instead, emit a diagnostic.
2021-09-23 21:39:31 -07:00
Sean Silva a99cbeeb7e Move TorchConversion dialect and TorchTo* into torch-mlir 2021-09-23 21:39:31 -07:00
Sean Silva 35fa1a34cd npcomp-lsp-server -> torch-mlir-lsp-server 2021-09-23 21:39:31 -07:00