mirror of https://github.com/llvm/torch-mlir
Enable bazel LIT tests in CI (#1596)
Bazel LIT test support was added in https://github.com/llvm/torch-mlir/pull/1585. This PR enables the tests in CI. ``` INFO: Build completed successfully, 254 total actions @torch-mlir//test/Conversion:TorchToArith/basic.mlir.test PASSED in 0.3s @torch-mlir//test/Conversion:TorchToLinalg/basic.mlir.test PASSED in 0.5s @torch-mlir//test/Conversion:TorchToLinalg/elementwise.mlir.test PASSED in 0.3s @torch-mlir//test/Conversion:TorchToLinalg/flatten.mlir.test PASSED in 0.3s @torch-mlir//test/Conversion:TorchToLinalg/pooling.mlir.test PASSED in 0.3s @torch-mlir//test/Conversion:TorchToLinalg/unsqueeze.mlir.test PASSED in 0.2s @torch-mlir//test/Conversion:TorchToLinalg/view.mlir.test PASSED in 0.3s @torch-mlir//test/Conversion:TorchToMhlo/basic.mlir.test PASSED in 0.5s @torch-mlir//test/Conversion:TorchToMhlo/elementwise.mlir.test PASSED in 0.9s @torch-mlir//test/Conversion:TorchToMhlo/gather.mlir.test PASSED in 0.3s @torch-mlir//test/Conversion:TorchToMhlo/linear.mlir.test PASSED in 0.6s @torch-mlir//test/Conversion:TorchToMhlo/pooling.mlir.test PASSED in 0.3s @torch-mlir//test/Conversion:TorchToMhlo/reduction.mlir.test PASSED in 0.4s @torch-mlir//test/Conversion:TorchToMhlo/view_like.mlir.test PASSED in 0.6s @torch-mlir//test/Conversion:TorchToSCF/basic.mlir.test PASSED in 0.2s @torch-mlir//test/Conversion:TorchToTosa/basic.mlir.test PASSED in 1.1s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/basic.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/error.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/free-functions.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/initializers.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/methods.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/module-uses-error.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/module-uses.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/multiple-instances-error.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/multiple-instances-multiple-module-args.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/multiple-instances.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/submodules.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:Torch/GlobalizeObjectGraph/visibility.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/adjust-calling-conventions.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/canonicalize.mlir.test PASSED in 0.4s @torch-mlir//test/Dialect:Torch/decompose-complex-ops-legal.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/decompose-complex-ops.mlir.test PASSED in 0.9s @torch-mlir//test/Dialect:Torch/drop-shape-calculations.mlir.test PASSED in 0.4s @torch-mlir//test/Dialect:Torch/erase-module-initializer.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/inline-global-slots-analysis.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:Torch/inline-global-slots-transform.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/invalid.mlir.test PASSED in 0.4s @torch-mlir//test/Dialect:Torch/lower-to-backend-contract-error.mlir.test PASSED in 17.3s @torch-mlir//test/Dialect:Torch/maximize-value-semantics.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:Torch/ops.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:Torch/prepare-for-globalize-object-graph.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/promote-types.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:Torch/reduce-op-variants-error.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/reduce-op-variants.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/refine-public-return.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:Torch/refine-types-branch.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:Torch/refine-types-ops.mlir.test PASSED in 0.6s @torch-mlir//test/Dialect:Torch/refine-types.mlir.test PASSED in 0.4s @torch-mlir//test/Dialect:Torch/reify-shape-calculations.mlir.test PASSED in 2.9s @torch-mlir//test/Dialect:Torch/simplify-shape-calculations.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:Torch/torch-function-to-torch-backend-pipeline.mlir.test PASSED in 0.6s @torch-mlir//test/Dialect:TorchConversion/canonicalize.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:TorchConversion/finalizing-backend-type-conversion.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:TorchConversion/func-backend-type-conversion.mlir.test PASSED in 0.2s @torch-mlir//test/Dialect:TorchConversion/ops.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:TorchConversion/verify-linalg-on-tensors-backend-contract.mlir.test PASSED in 0.3s @torch-mlir//test/Dialect:TorchConversion/verify-tosa-backend-contract.mlir.test PASSED in 0.2s @torch-mlir//test/RefBackend:insert-rng-globals.mlir.test PASSED in 0.2s INFO: Build completed successfully, 2[54](https://github.com/sjain-stanford/torch-mlir/actions/runs/3476816449/jobs/5812368489#step:7:55) total actions @torch-mlir//test/RefBackend:munge-calling-conventions.mlir.test PASSED in 0.2s Executed [59](https://github.com/sjain-stanford/torch-mlir/actions/runs/3476816449/jobs/5812368489#step:7:60) out of 59 tests: 59 tests pass. ``` GHA workflow: https://github.com/sjain-stanford/torch-mlir/actions/runs/3476816449/jobs/5812368489pull/1603/head
parent
3695ca83e6
commit
ba5b90ee27
|
@ -25,13 +25,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
|
|
||||||
|
# Continually update cache even if there's a "hit" during
|
||||||
|
# restore to avoid the cache going stale over time
|
||||||
|
# https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
|
||||||
- name: Setup cache for bazel
|
- name: Setup cache for bazel
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/bazel
|
path: ~/.cache/bazel
|
||||||
# Continually update cache even if there's a "hit" during
|
|
||||||
# restore to avoid the cache going stale over time
|
|
||||||
# https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
|
|
||||||
key: torch_mlir-bazel-build-cache-${{ runner.os }}-${{ github.sha }}
|
key: torch_mlir-bazel-build-cache-${{ runner.os }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
torch_mlir-bazel-build-cache-${{ runner.os }}
|
torch_mlir-bazel-build-cache-${{ runner.os }}
|
||||||
|
@ -60,6 +60,14 @@ jobs:
|
||||||
torch-mlir:ci \
|
torch-mlir:ci \
|
||||||
bazel build @torch-mlir//:torch-mlir-opt
|
bazel build @torch-mlir//:torch-mlir-opt
|
||||||
|
|
||||||
|
- name: Bazel test torch-mlir (lit tests)
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
-v "$(pwd)":"/opt/src/torch-mlir" \
|
||||||
|
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
||||||
|
torch-mlir:ci \
|
||||||
|
bazel test @torch-mlir//test/...
|
||||||
|
|
||||||
# Switch back bazel cache directory to user ownership
|
# Switch back bazel cache directory to user ownership
|
||||||
# to allow GHA post-cache step to save cache without
|
# to allow GHA post-cache step to save cache without
|
||||||
# permissions issue.
|
# permissions issue.
|
||||||
|
|
|
@ -178,11 +178,17 @@ Torch-MLIR can also be built using Bazel (apart from the official CMake build) f
|
||||||
```shell
|
```shell
|
||||||
./utils/bazel/docker/run_docker.sh
|
./utils/bazel/docker/run_docker.sh
|
||||||
```
|
```
|
||||||
2. Build torch-mlir using bazel (from container):
|
|
||||||
|
2. Build torch-mlir:
|
||||||
```shell
|
```shell
|
||||||
bazel build @torch-mlir//:torch-mlir-opt
|
bazel build @torch-mlir//:torch-mlir-opt
|
||||||
```
|
```
|
||||||
3. Find the built binary at `bazel-bin/external/torch-mlir/torch-mlir-opt`.
|
The built binary should be at `bazel-bin/external/torch-mlir/torch-mlir-opt`.
|
||||||
|
|
||||||
|
3. Test torch-mlir (lit test only):
|
||||||
|
```shell
|
||||||
|
bazel test @torch-mlir//test/...
|
||||||
|
```
|
||||||
|
|
||||||
We welcome patches to torch-mlir's Bazel build. If you do contribute,
|
We welcome patches to torch-mlir's Bazel build. If you do contribute,
|
||||||
please complete your PR with an invocation of buildifier to ensure
|
please complete your PR with an invocation of buildifier to ensure
|
||||||
|
|
Loading…
Reference in New Issue