Commit Graph

29 Commits (ba5b90ee27792e40f2478aa198639b5fa808d824)

Author SHA1 Message Date
Sambhav Jain fc4c8d4ed9
Enable torch-mlir LIT tests in Bazel (#1585)
Adds support to run `.mlir` LIT tests in bazel. 

```
bazel test @torch-mlir//test/...
```

Follow-on PR will contain these updates:
- Add tests to GHA CI workflow
- Add `.py` LIT tests to bazel
2022-11-15 14:02:19 -08:00
Sambhav Jain 4032eeca64
Add Bazel buildifier to torch-mlir (#1586)
Formats bazel BUILD and .bzl files with a standard convention. 

Invoke using
```
bazel run @torch-mlir//:buildifier
```
2022-11-15 12:34:27 -08:00
Sambhav Jain b320f7fb77
Simplify Bazel build workflow (#1587)
Remove `run_bazel_build.sh`, simplify docker's entrypoint to start container at `utils/bazel` directory, update docs.
2022-11-15 08:34:43 -08:00
Sambhav Jain dcff5a7150
[Bazel] Update to Ubuntu-22.04 and clang-16 for Bazel build docker (#1523)
* Update Ubuntu and clang in the docker container
* Specifically build just `@torch-mlir//:torch-mlir-opt`


Triggered GHA run:
https://github.com/sjain-stanford/torch-mlir/actions/runs/3317006870/jobs/5479411204
2022-11-10 13:11:06 -08:00
Ahmed S. Taei 8da8d971c8
[Bazel] Use gloab instead of explicit files (#1529) 2022-10-26 13:28:00 -07:00
Ahmed S. Taei d865c1de7a
[Bazel] Use glob instead of explicit files (#1520) 2022-10-25 12:23:24 -07: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
Vivek Khandelwal d4e1867e90 [MLIR] Fix bazel build
Signed-Off By: Vivek Khandelwal<vivek@nod-labs.com>
2022-10-06 23:16:51 +05:30
Sambhav Jain 0765449684
[Bazel] Make pytorch-requirements.txt available within the docker container (#1439)
Updates the bazel Dockerfile to match changes from https://github.com/llvm/torch-mlir/pull/1419. This should get the bazel build back to green.

Also triggered bazel build on GHA here: https://github.com/sjain-stanford/torch-mlir/actions/runs/3154741943. Let's wait for it to complete before landing this.
2022-09-29 16:30:31 -07:00
Sambhav Jain 068eec41cb
[Bazel] Remove MHLO enable flag (#1350)
The `-DTORCH_MLIR_ENABLE_MHLO` flag was recently introduced for `TorchMLIRTorchConversionPassesIncGen` [here](https://sourcegraph.com/github.com/llvm/torch-mlir@99093d0623c3d3e6fb961ad0c8fda5ee9fc264fe/-/blob/utils/bazel/torch-mlir-overlay/BUILD.bazel?L319) in [this recent PR](https://github.com/llvm/torch-mlir/pull/1321) (was already present for `TorchMLIRConversionPassesIncGen` [here](https://sourcegraph.com/github.com/llvm/torch-mlir@99093d0623c3d3e6fb961ad0c8fda5ee9fc264fe/-/blob/utils/bazel/torch-mlir-overlay/BUILD.bazel?L288)). Before this PR, the MHLO sources in TorchConversion were not being built. This indicates a build issue that pre-existed but didn’t trigger until this path was enabled recently. Disabling to get the build green for now, until we can diagnose and fix the build for MHLO sources in TorchConversion.
2022-09-07 13:11:19 -07:00
Tanyo Kwok 57d8ec151f
[MHLO] add VerifyMhloBackendContract (#1321)
* [MHLO] add VerifyMhloBackendContract

* guard with macro
2022-09-01 17:08:17 +08:00
Sean Silva 0e3ddbac91 Remove VerifyInvariantsBeforeBackendLowering
LowerToBackendContract now checks all this consistently.
2022-08-26 10:24:43 -07:00
Sambhav Jain 1e1759c2eb
[Bazel] Run buildifier (#1250)
Lint all Bazel files (BUILD, WORKSPACE, .bzl, or .sky).

Steps followed:
```shell
./utils/bazel/run_docker.sh

# run within container
git clone https://github.com/bazelbuild/buildtools.git
cd buildtools
bazel build //buildifier
# buildifier formatter
./bazel-bin/buildifier/buildifier_/buildifier -r ../utils/bazel/
# buildifier linter
./bazel-bin/buildifier/buildifier_/buildifier --lint=fix -r ../utils/bazel/
```
2022-08-18 22:42:58 -07:00
Sambhav Jain 7d4a0d0e2b
[Bazel] Add LowerToBackendContract.cpp to TorchMLIRTorchPasses bazel target (#1243)
Pass is introduced in [this commit](57681f7947). Including it to the bazel targets to get a green build.
2022-08-17 18:15:23 -07:00
Sean Silva 57681f7947 Iteratively run the main simplification pipeline.
This introduces a new pass LowerToBackendContract (better name very
welcome) which performs the bulk of the simplifications that we do,
such as
- shape refinement
- dtype refinement
- maximizing value semantics
- inlining global slots
- decomposing complex ops

The key difference from before is that it iterates the set of
transformations, which can help to break a number of "catch-22" issues
where one simplification depends on another, the latest example being
here:
https://github.com/llvm/torch-mlir/issues/1131

This also exposed that RefineTypes was sometimes crashing/asserting for
certain inputs. This commit hardens it a bit.
2022-08-17 14:54:33 -07:00
Sambhav Jain 9c8b962720
Dockerize and Cache Bazel {Local, CI} Builds (#1240)
This PR adds:

- A minimal docker wrapper to the bazel GHA workflow to make it reproducible locally
- Bazel cache to speed up GHA workflows (down to ~5 minutes from ~40+minutes)

This is a no-op for non-bazel workflows and an incremental improvement.
2022-08-17 12:46:17 -07:00
Ramana Radhakrishnan b8d51a74d9
Update TorchToStd to TorchtoArith in bazel files too. (#1210)
The CI didn't catch the missing rename of TorchToArith until the
merge had happened. This is following up from #1163
2022-08-10 14:51:13 -07:00
Sambhav Jain 072c2b5aaf
[Bazel] Add EraseModuleInitializer to TorchMLIRTorchPasses library (#1202)
The torch-mlir bazel build is [failing](https://github.com/llvm/torch-mlir/runs/7737425906?check_suite_focus=true) since [this commit](504de5e701) due to a linker failure (undefined symbol: `mlir::torch::Torch::createEraseModuleInitializerPass()`).

```
ERROR: /home/runner/.cache/bazel/_bazel_runner/db599744cd37f8c161e5034d9b9cd520/external/torch-mlir/BUILD.bazel:845:10: Linking external/torch-mlir/torch-mlir-opt failed: (Exit 1): clang failed: error executing command /usr/lib/llvm-11/bin/clang @bazel-out/k8-fastbuild/bin/external/torch-mlir/torch-mlir-opt-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ld.lld: error: undefined symbol: mlir::torch::Torch::createEraseModuleInitializerPass()
>>> referenced by Passes.cpp
>>>               bazel-out/k8-fastbuild/bin/external/torch-mlir/_objs/TorchMLIRTorchPasses/Passes.pic.o:(mlir::torch::Torch::createTorchFunctionToTorchBackendPipeline(mlir::OpPassManager&, mlir::torch::Torch::TorchLoweringPipelineOptions const&))
>>> referenced by Passes.cpp
>>>               bazel-out/k8-fastbuild/bin/external/torch-mlir/_objs/TorchMLIRTorchPasses/Passes.pic.o:((anonymous namespace)::registerEraseModuleInitializerPass()::'lambda'()::operator()() const)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

This PR adds `lib/Dialect/Torch/Transforms/EraseModuleInitializer.cpp` to `TorchMLIRTorchPasses` library.
2022-08-09 13:34:59 -07:00
Jacques Pienaar e75c7c5292
Flip to C++17 (#1198)
LLVM now uses C++17.
2022-08-09 08:38:30 -07:00
武家伟 d030591df9
[MHLO] Init MHLO pooling-like op conversion (#1141)
* [MHLO] Init MHLO pooling-like op conversion and remove 'op' suffix in filenames

Co-authored-by: Bairen Yi <yibairen.byron@bytedance.com>
Co-authored-by: Jiawei Wu <xremold@gmail.com>
Co-authored-by: Tianyou Guo tianyou.gty@alibaba-inc.com
Co-authored-by: Xu Yan <yancey.yx@alibaba-inc.com>
Co-authored-by: Ziheng Jiang <ziheng.jiang@bytedance.com>

See RFC #999
2022-08-04 12:34:22 +08:00
Tanyo Kwok f0a24f59f6
[MHLO] Init MHLO linear op patterns (#1132)
See RFC https://github.com/llvm/torch-mlir/issues/999

Co-authored-by: Bairen Yi yibairen.byron@bytedance.com
Co-authored-by: Jiawei Wu xremold@gmail.com
Co-authored-by: Tianyou Guo tianyou.gty@alibaba-inc.com
Co-authored-by: Xu Yan yancey.yx@alibaba-inc.com
Co-authored-by: Ziheng Jiang ziheng.jiang@bytedance.com
2022-08-03 19:10:54 -07:00
Ahmed S. Taei 48ec300586
[Fix bazel] Add recently added torch->mhlo conversion pass to bazel (#1148) 2022-08-03 14:12:07 -07:00
Ahmed S. Taei 82af44da2f
Fix mhlo bazel rule name (#1136) 2022-08-02 12:28:53 -07:00
Ahmed S. Taei b389053653
Add mhlo to bazel build (#1120) 2022-07-28 23:24:42 -07:00
Ashay Rane 89e0288fdc
build: fix bazel build after adding VerifyConversionToValueSemantics.cpp (#1055)
A previous patch added a new file
("VerifyConversionToValueSemantics.cpp") to the build, but it did not
add it to the list files known to bazel.  This patch fixes the problem.
2022-07-14 10:26:51 -07:00
Maksim Levental e143a34948
Bump LLVM (#966) 2022-06-22 22:50:39 -05:00
Ahmed S. Taei 57a28dfadc
[Bazel][Fix] Add missing dependency (#806) 2022-04-27 23:22:27 -07:00
Ahmed S. Taei 7f2577a848
Fix bazel build post llvm-project bump (#803) 2022-04-26 19:21:52 -07:00
Ahmed S. Taei eaf34fa02b
Add bazel build support (1/N) (#706)
This PR adds rules for building the compiler part with bazel, a followup PRs will build the python bindings.
2022-04-06 11:20:39 -07:00