Commit Graph

17 Commits (84a9693006f2c86cd1f5e48bf31c88ff392202fc)

Author SHA1 Message Date
Ramiro Leal-Cavazos 029c30c060
Fix typo in lazytensor example passes (#385) 2021-10-27 12:40: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
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 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
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 bc62a7fbf3 Update to new name of torchscript-module-to-linalg-on-tensors-backend-pipeline 2021-09-30 19:46:05 +00: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 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
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
Ramiro Leal-Cavazos 2b18aad807 Removed import typo in torchfx example 2021-09-22 16:49:46 -07:00
Sean Silva 1a0b953ea7 Eliminate almost all mentions of IREE.
A few remain in examples/docs that will be naturally be updated in due
time.

This regresses the list support and the general direction of more widely
supported control flow, lists/dicts/globals that we were going for with
the TorchScript path. The idea is that we are deferring that work to
make torch-mlir a very clean standalone thing. We will reboot it,
probably using some of the tools of iree_pydm to make it simpler, and in
a more natural place (such as an iree-torch repo that depends on IREE and
torch-mlir to build a working PyTorch frontend solution for IREE -- it
was really weird that npcomp depended on IREE).
2021-09-22 16:06:38 -07:00
Sean Silva 8779d920b2 Remove "refjit" terminology.
We now use RefBackend/refbackend consistently.
2021-09-22 15:41:23 -07:00
Ramiro Leal-Cavazos 1f00f95d2e
WIP implementation of torchfx (#304)
Implements a python package for taking a `torch.fx.GraphModule`
and turning it into MLIR in the `torch` dialect that can then
be further compiled by `npcomp`. This is a WIP, so the coverage
of PyTorch operations is very small.
2021-09-22 10:27:55 -07:00
Sean Silva 0eb767ea45 Remove frontends/pytorch directory.
It just contained the e2e testing framework. We now fold it into the
main project to reduce complexity.

- `frontends/pytorch/python/` -> `python/torch_support`
- `frontends/pytorch/e2e_testing -> e2e_testing`
- `frontends/pytorch/examples -> examples`
- `frontends/pytorch/test` -> `python/test`
- `torch_mlir_torchscript` python module -> `npcomp_torchscript`
- `torch_mlir_torchscript_e2e_test_configs` python module ->
  `npcomp_torchscript_e2e_test_configs`

This also changes the license of a handful of files from the
"pytorch-style" license to the regular LLVM/npcomp license. The only
people who committed to those files were myself and Yi.
2021-09-17 09:27:49 -07:00