Commit Graph

198 Commits (main)

Author SHA1 Message Date
Clément Fournier 4a2535a86d Add build-out-of-tree job 2022-04-19 15:11:17 -07:00
Clément Fournier 37087ccd5f Refactor current CI workflow into composable jobs 2022-04-19 15:11:17 -07:00
Sean Silva 8250f50c81 Attempt to set Python package version to the snapshot identifier.
This should make the releases sort properly when `pip`'s
`-f`/`--find-links` argument is used.
2022-03-30 17:54:11 +00:00
Sean Silva 4f61b1fce1 Try to get the release packages publishing again.
As per the docs on:
https://github.com/eregon/publish-release

> Note that the release must *not be marked as prerelease* for this to work.

For some reason, we were marking the release as pre-release before and
this was working, but the docs here seem pretty clear, so I'm going to
try it.
2022-03-30 00:35:02 +00:00
Sean Silva 3a96078571 Pin the CI to the latest working PyTorch.
I am investigating the breakage.

Also, fix "externals" rename in setup.py and some cases where we weren't
using `requirements.txt` consistently.

Also, fix a case where the packaging script would get confused due to
".." in the path name.
2022-03-29 15:02:17 -07:00
Ahmed S. Taei 8383497704
[NFC] Rename external -> externals (#699) 2022-03-26 09:12:27 -07:00
Yi Zhang 869daf3c22 Add TMTensor dialect to torch-mlir
This is intended to explore support for non-structured ops that can't
be modeled by Linalg dialect. `tm_tensor.scan` and `tm_tensor.scatter`
are added as the first such ops. The dialect should aim to be
upstreamed in the future.
2022-02-15 16:45:38 -05:00
Sean Silva c46d48f9f5 Make error reporting a bit better.
- Split out TOSA in the CI.
- Add summary of unexpected test outcomes. This works better when there
  are many XFAIL'ing tests, as it only prints out the error_str on
  FAIL, not on XFAIL. Example here:
  https://gist.github.com/silvasean/c7886ec7b3d35c21563cb09f7c3407da
2021-10-28 13:20:16 -07:00
Stella Laurenzo 92ae692387
Filter checks to only run on push to main branch. (#372)
Keeps redundent pull request and push workflows from running when pushing to branches in the main repo.
2021-10-21 21:23:21 -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 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 e687d39074 Update buildAndTest.yml 2021-09-27 17:11:08 -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
Sean Silva d94d6800fa Bring CI back to life.
This brings back `check-npcomp-all` and the refbackend e2e tests
coverage.
2021-09-16 12:07:32 -07:00
Sean Silva b6be96d722 [torch-mlir earthmoving (2/N)] Python code movement.
This moves the bulk of the Python code (including the Torch interop)
from `frontends/pytorch` into `torch-mlir/TorchPlugin`. This also
required reconciling a bunch of other Python-related stuff, like the
`torch` dialects.

As I did this, it was simpler to just remove all the old numpy/basicpy
stuff because we were going to delete it anyway and it was faster than
debugging an intermediate state that would only last O(days) anyway.

torch-mlir has two top-level python packages (built into the
`python_packages` directory):

- `torch_mlir_dialects`: `torch` dialect Python bindings (does not
  depend on PyTorch). This also involves building the aggregate CAPI for
  `torch-mlir`.
- `torch_mlir`: bindings to the part of the code that links against
  PyTorch (or C++ code that transitively does).

Additionally, there remain two more Python packages in npcomp (but
outside `torch-mlir`):

- `npcomp_torch`: Contains the e2e test framework and testing configs
  that plug into RefBackend and IREE.
- `npcomp_core`: Contains the low-level interfaces to RefBackend and
  IREE that `npcomp_torch` uses, along with its own
  `MLIR_PYTHON_PACKAGE_PREFIX=npcomp.` aggregation of the core MLIR
  python bindings. (all other functionality has been stripped out)

After all the basicpy/numpy deletions, the `npcomp` C++ code is now very
tiny. It basically just contains RefBackend and the `TorchConversion`
dialect/passes (e.g. `TorchToLinalg.cpp`).

Correspondingly, there are now 4 main testing targets paralleling the
Python layering (which is reflective of the deeper underlying dependency
structure)

- `check-torch-mlir`: checks the `torch-mlir` pure MLIR C++ code.
- `check-torch-mlir-plugin`: checks the code in `TorchPlugin` (e.g.
  TorchScript import)
- `check-frontends-pytorch`: Checks the little code we have in
  `frontends/pytorch` -- mainly things related to the e2e framework
  itself.
- `check-npcomp`: Checks the pure MLIR C++ code inside npcomp.

There is a target `check-npcomp-all` that runs all of them.
The `torch-mlir/build_standalone.sh` script does a standalone build of
`torch-mlir`.

The e2e tests (`tools/torchscript_e2e_test.sh`) are working too.

The update_torch_ods script now lives in
`torch-mlir/build_tools/update_torch_ods.sh` and expects a standalone
build.

This change also required a fix upstream related to cross-shlib Python
dependencies, so we also update llvm-project to
8dca953dd39c0cd8c80decbeb38753f58a4de580 to get
https://reviews.llvm.org/D109776 (no other fixes were needed for the
integrate, thankfully).

This completes most of the large source code changes. Next will be
bringing the CI/packaging/examples back to life.
2021-09-15 13:40:30 -07:00
Sean Silva 28762699b3
Comment out the full wheel build
Last commit was only the last step of that.
2021-09-10 21:43:25 -07:00
Sean Silva 0d8af19550
Temporarily disable wheel building
It will be re-enabled after the torch-mlir excision is completed.
2021-09-10 21:40:16 -07:00
Sean Silva 7c788dbfec Remove CI pinning. 2021-08-02 11:07:08 -07:00
Stella Laurenzo 8494455282 Re-enable integration tests in CI. 2021-07-29 22:57:20 -07:00
Stella Laurenzo 445472c51e Build packages for npcomp-torch.
* Adds a minimal setup.py for frontends/pytorch
* Makes npcomp-core export its headers and libraries
* Adds a script to build packages.
* Adds CI step to package and smoke test.
* Will need some more tweaks and coordination prior to deploying (version locking etc).
2021-07-29 19:58:59 -07:00
Stella Laurenzo 2dbab50444
Rework the python build to a static assembly of MLIR+NPCOMP (#251)
* Adapt to python build system updates.

* Bump llvm to 310c9496d80961188e8d8f8ad306cdf44bd7541f (includes python build updates)
* Adds refback C-API.
* Re-layers all python builds.
* Rework CI.
2021-07-27 16:10:10 -07:00
Sean Silva ef118eb1e1 Add E2E tests to CI
This includes IREE and RefBackend.

This includes a fixup to torchscript_e2e_test.sh for handling the
situation where PYTHONPATH was not already exported.
2021-07-02 13:46:38 -07:00
Sean Silva 30400d5492 Pin PyTorch version in the CI.
I'm seeing the following error:

```
CMake Error in frontends/pytorch/csrc/CMakeLists.txt:
  Imported target "torch" includes non-existent path

    "/usr/local/include/breakpad"

  in its INTERFACE_INCLUDE_DIRECTORIES.
```

Reported upstream in: https://github.com/pytorch/pytorch/issues/60485
2021-07-02 11:15:27 -07:00
Sean Silva 577bf1600a Undo CI pinning.
The underlying issue seems to be resolved now:
https://github.com/pytorch/pytorch/issues/60485
2021-06-28 11:01:36 -07:00
Sean Silva bbd749620e Try again to pin the CI to a working PyTorch version.
For some reason, pytorch_nightly was being installed for the LLVM build,
and so the wrong line got updated in the previous attempt.
2021-06-22 15:04:49 -07:00
Sean Silva f7ebd870f6 Pin torch to a specific version in the CI.
This temporarily works around the CMake error:

```
CMake Error in frontends/pytorch/csrc/CMakeLists.txt:
  Imported target "torch" includes non-existent path

    "/pytorch/torch/lib"

  in its INTERFACE_INCLUDE_DIRECTORIES.
```
2021-06-22 13:11:48 -07:00
Sean Silva 6b293b695d Use new "MLIR_ENABLE_BINDINGS_PYTHON" in the CI. 2021-06-10 18:06:46 -07:00
Bairen Yi 19b9398aee Revert "Skip torchvision 0.9.0 as it is incompatible with torch nightly"
This reverts commit e7b96ebefc.
2021-03-16 19:37:45 -07:00
Bairen Yi e7b96ebefc Skip torchvision 0.9.0 as it is incompatible with torch nightly
torchvision nightly has not bump to 0.10.0 alpha, so pip installs
torchvision==0.9.0 even with the --pre flag.

Signed-off-by: Bairen Yi <yibairen.byron@bytedance.com>
2021-03-15 17:58:08 -07:00
Bairen Yi 8f9d4f917d Add LLVM_LINK_LLVM_DYLIB=ON and remove LLVM_ENABLE_LLD=ON when building LLVM in GitHub CI
So CI build options are closer to those in `build_tools/install_mlir.sh`.

Also append hash of CI spec file to LLVM commit hash when caching builds.

Signed-off-by: Bairen Yi <yibairen.byron@bytedance.com>
2021-03-10 11:01:16 -08:00
powderluv cecf1fbba5
Add a CI builder with latest pytorch CPU nightly. Also add AArch64 to the build (#166) 2021-02-21 13:36:06 -08:00
Stella Laurenzo b0623b7793 Bump LLVM version to 4f5355ee73626f8b8fe6bf0dd6d167fea7628a2c.
* Incorporates changes around LLVM StringRef.
* Ports fix in upstream pybind11 detection.
* Disables CI hack due to broken pybind detection.
2020-11-24 13:12:04 -08:00
Stella Laurenzo 2021d3609e
Make CMAKE_PREFIX_PATH explicit for now (#125)
* Installs numpy as well.
2020-11-22 16:23:36 -08:00
Stella Laurenzo 31d80064a9 Update CI to be verbose about pybind11 detection logic. 2020-11-22 13:42:44 -08:00
Stella Laurenzo f03225b1f1 Bump llvm-project to f4f8a67aaf13bc66a2b7d55561b14a3724a5e0de.
* Incorporates source fixes.
* Uses upstream pybind11 detection logic.
* Patches CI.
* This may break the CI, which will need to be fixed manually in a followup.
2020-11-22 13:14:44 -08:00
Marius Brehler 54c0a3a1e9 Replace deprecated add-path in GitHub Action
The add-path command is deprecated and should be replaced as stated in
https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
2020-10-16 09:40:37 -07:00
Stella Laurenzo 86df4cabeb Enable MLIR python bindings in CI. 2020-10-12 21:49:39 -07:00
Stella Laurenzo 83342e8715 Add another config var to the CI for shared lib builds.
Missed this one in the previous change.
2020-10-09 16:57:00 -07:00
Stella Laurenzo d9dc16a9be Enable libMLIR.so in CI. 2020-10-09 13:57:01 -07:00
stephenneuendorffer 14f614396d
Move precommit to 20.04 (#15) 2020-08-07 10:32:02 -07:00
stephenneuendorffer 5beaf4cc01
Fix build again (#14)
The RuntimeShlib.so now lives in /lib.
2020-08-07 08:36:03 -07:00
stephenneuendorffer a5f3b16f92
Fix precommit workflow (#13) 2020-08-06 23:51:05 -07:00
stephenneuendorffer b6313d9c64
Update buildAndTest.yml
Fix path to LLVM/MLIR
2020-08-04 22:12:54 -07:00
stephenneuendorffer 539697c1c6
Update buildAndTest.yml
Fix relative path to llvm/mlir
2020-08-04 21:59:12 -07:00
stephenneuendorffer e1a077aa9f
Update buildAndTest.yml 2020-08-04 19:34:42 -07:00
stephenneuendorffer ca440ec514
update precommit for correct LLVM path (#9) 2020-08-04 19:19:26 -07:00
stephenneuendorffer 0269e991d8
Add github precommit tests with cached LLVM (#8) 2020-08-04 18:57:59 -07:00