Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

features/bladedisc rebase 20220830 #20

Closed
wants to merge 200 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
247dd64
Change to notifyMatchFailure (#1073)
jpienaar Jul 18, 2022
4c25878
[MLIR][TORCH] Add canonicalization pattern for prim.ListUnpack op
vivekkhandelwal1 Jul 15, 2022
df0b1e7
[MLIR][TORCH] Add negative dim support for aten.cat and aten.slice op
vivekkhandelwal1 Jul 15, 2022
7f08169
bump llvm tag to 3580daa (#1078)
ashay Jul 18, 2022
c73a39e
Add support for index.Tensor on dimensions other than the first
qedawkins Jul 15, 2022
21f905a
Emit underscore version of aten.sqrt (#1072)
kkiningh Jul 19, 2022
e06ee08
torch: [nfc] use `WalkResult::isInterrupted()` instead of booleans (#…
ashay Jul 19, 2022
647e75e
Allow expanding and collapsing in aten::view (#1082)
qedawkins Jul 20, 2022
c61c99e
[MHLO] Init MHLO integration. (#1083)
ZihengJiang Jul 20, 2022
ad283c1
python: trim registration and loading of dialects and passes (#1084)
ashay Jul 21, 2022
72dd04c
Revert "python: trim registration and loading of dialects and passes"…
ashay Jul 21, 2022
c0ef192
Improve error message
silvasean Jul 21, 2022
31fd812
Add linux and macOS source builds in CI (#1070)
powderluv Jul 21, 2022
f271e6a
Add verifiers for ToBuiltinTensorOp and FromBuiltinTensorOp (#1089)
ramiro050 Jul 21, 2022
a02dbb2
[MHLO] Init MHLO slice like op patterns (#1091)
Jul 22, 2022
b80ce79
[MHLO] Init MHLO view like op patterns (#1090)
Jul 22, 2022
f424930
Add option to expose custom PyTorch repo/branch (#1103)
powderluv Jul 25, 2022
f50d701
[MHLO] Add [un]squeeze op patterns (#1099)
Jul 25, 2022
44ead68
[MHLO] Init MHLO gather op patterns (#1104)
Jul 25, 2022
e8f327c
Add lowering to linalg for softplus and log1p
kkiningh Jul 17, 2022
e23fbc8
Update development.md with source builds (#1105)
powderluv Jul 25, 2022
052d2f8
[MHLO] Init MHLO basic op conversion (#1092)
Vremold Jul 27, 2022
3c9addf
Add e2e support for aten.expm1
qedawkins Jul 27, 2022
b36a17c
README: Add op office hours
silvasean Jul 28, 2022
11a8901
[MLIR][TORCH] Add support for multiple indexing tensors for aten.inde…
qedawkins Jul 28, 2022
7247c6a
[MLIR][TORCH] Add E2E support for aten.ge.int op
vivekkhandelwal1 Jul 22, 2022
d386b8f
[MLIR][TORCH] Add decomposition for aten.var.correction op
vivekkhandelwal1 Jul 22, 2022
c681c34
[MLIR][TORCH} Fix empty dim cases for the .dim ops
vivekkhandelwal1 Jul 28, 2022
b389053
Add mhlo to bazel build (#1120)
asaadaldien Jul 29, 2022
9a1203c
Fix CI failure due to upstream PyTorch change in aten.mean.dim op
vivekkhandelwal1 Jul 29, 2022
db4a699
buildAndTest.yml for matrix builds (#1098)
powderluv Jul 29, 2022
8b5631d
[MLIR][TORCH] Add decomposition for aten.std.dim Op
PhaneeshB Jul 26, 2022
2f22e2e
Add initial LTC backend (#610)
antoniojkim Feb 18, 2022
58338f7
Torch-MLIR LTC Backend Lowering Codegen (#621)
antoniojkim Feb 26, 2022
c3b20e4
Got LTC working until compile (#689)
antoniojkim Mar 24, 2022
65cf146
Fix Torch-MLIR LTC Backend based off latest PyTorch master (#723)
antoniojkim Apr 13, 2022
3e9b1cb
Added JIT to MLIR lowering (#724)
henrytwo Apr 14, 2022
a605fe2
Add example Torch MLIR LTC Backend (#725)
henrytwo Apr 14, 2022
615ff1d
Generate MLIR with shape information via LTC frontend (#742)
antoniojkim May 26, 2022
cca9fe1
Enable support for LTC Input/Output Mapping (#764)
henrytwo Apr 27, 2022
1bde00c
Fix LTC Decoupling (#815)
antoniojkim May 3, 2022
406d1e7
Use JIT GraphExecutor for execution in example backend (#830)
henrytwo May 5, 2022
de5b380
Bert example and relevant shape inference functions (#831)
henrytwo May 10, 2022
0c35e60
Add static shape for scalar tensors (#833)
henrytwo May 12, 2022
d9aee0d
E2E HuggingFace Bert using LTC Backend (#912)
antoniojkim Jun 7, 2022
8312fa5
Refactor Node Lowering (#914)
antoniojkim Jun 9, 2022
dfcc265
Added e2e LTC tests (#916)
henrytwo Jun 9, 2022
a62d608
Refactor autogen (#925)
antoniojkim Jun 10, 2022
0cee0dc
Only import the LTC backend that's used (#939)
henrytwo Jun 14, 2022
1510eae
Upstream native_batch_norm and native_batch_norm_backward shape infer…
henrytwo Jun 24, 2022
fb21c9e
Integrate Functionalization Pass (#998)
antoniojkim Jun 30, 2022
a3244b6
Update README.md to reflect LTC landing in main branch (#1000)
henrytwo Jun 30, 2022
61db88c
LTC Documentation (#1021)
henrytwo Jul 7, 2022
9de06f3
Update Torch MLIR readme
henrytwo Jul 7, 2022
f5acad8
Prune xfail e2e LTC tests & fix bugs from functionalization pass (#1044)
henrytwo Jul 12, 2022
47bb38d
Reference Lazy Backend (#1045)
henrytwo Jul 12, 2022
cec74b8
Blacklist _convolution op (#1048)
henrytwo Jul 13, 2022
de6c135
Fix LTC autogen for CI with nightly PyTorch
antoniojkim Jul 19, 2022
e37891b
Default Device Ordinal API (#1079)
antoniojkim Jul 19, 2022
0d16a91
Add support for lift_fresh op (#1101)
antoniojkim Jul 25, 2022
70395de
Resolve CI testing failure for Lazy Tensor Core (#1088)
henrytwo Jul 25, 2022
3689632
Export LTC Headers (#1108)
antoniojkim Jul 27, 2022
4253622
Clean up Autogen (#1112)
antoniojkim Jul 27, 2022
2c3b360
Resolve remaining LTC CI failures (#1110)
henrytwo Jul 30, 2022
55bbbec
llvm: update tag to 02b3a35 (#1124)
ashay Jul 31, 2022
30017af
Disable LTC on Release builds (#1125)
powderluv Aug 1, 2022
554570f
Implemented a decomposition of aten::narrow
JakopinA Aug 1, 2022
ed13ebf
E2E support for AtenEmbeddingBagPaddingIdxOp SUM Mode (#1066)
vidsinghal Aug 1, 2022
fe3c9f5
Add embedding Bag e2e case in xfail set (#1130)
vidsinghal Aug 1, 2022
3772e0b
[NFC][MHLO] move util funcs to MhloLegalizeUtils.h/cpp (#1128)
Aug 2, 2022
76c9766
[MHLO] Support for dynamic shape in basic op conversion by introducin…
Vremold Aug 2, 2022
704efdc
[MHLO] add aten::gelu op pattern (#1127)
Yancey1989 Aug 2, 2022
38d8498
add e2e support for aten.atan2 (#1117)
qedawkins Aug 2, 2022
a7af1fd
Add support for `dim=None` to `AtenMeanDimOp` (#1129)
ramiro050 Aug 2, 2022
82af44d
Fix mhlo bazel rule name (#1136)
asaadaldien Aug 2, 2022
0b23af2
[MHLO] support non-constant torch scalar in BasicOps (#1134)
Aug 3, 2022
636f5ac
[MHLO] Init MHLO reduce-like op conversion (#1133)
Vremold Aug 3, 2022
f2a0e32
[MLIR][TORCH] Fix CI failure
vivekkhandelwal1 Aug 3, 2022
0d25b6f
Fix cache-suffix name bug (#1138)
powderluv Aug 3, 2022
37a229c
Update buildAndTest.yml (#1145)
powderluv Aug 3, 2022
48ec300
[Fix bazel] Add recently added torch->mhlo conversion pass to bazel (…
asaadaldien Aug 3, 2022
f0a24f5
[MHLO] Init MHLO linear op patterns (#1132)
Aug 4, 2022
d030591
[MHLO] Init MHLO pooling-like op conversion (#1141)
Vremold Aug 4, 2022
08fc2d8
Add non-unit groups support to aten.convolution (#858)
gpetters94 Aug 4, 2022
c94431f
[MHLO] Add convolution op pattern (#1152)
Vremold Aug 4, 2022
6484776
Make numerical stability test more perverse
silvasean Aug 3, 2022
31727f8
torch_mlir.compile: Allow ignoring traced shapes
silvasean Aug 3, 2022
c129a6d
[MLIR][TORCH] Add support for dim=None to Aten[Var|Std]DimOp
vivekkhandelwal1 Aug 5, 2022
8ce5d3f
E2E framework: Report tensor dtype in summary
silvasean Aug 3, 2022
e322f6a
Update LTC CMake hack documentation (#1155)
henrytwo Aug 5, 2022
1fdaf2f
development.md: How to enable ASan
silvasean Aug 5, 2022
5618890
development.md: Avoid name collisions with PYTORCH_ variables
silvasean Aug 5, 2022
1ee8659
[MHLO] fix tensor mode aten.div op pattern (#1160)
Aug 6, 2022
290d775
importer: add initial support for loading Float16 tensors (#1169)
Aug 8, 2022
f85ae9c
Reenable LTC in out-of-tree build (#1177)
henrytwo Aug 8, 2022
b70548e
Add decomposition and E2E support for Aten_EmbeddingBag (#1137)
vidsinghal Aug 8, 2022
34e207e
E2E support for AtenRemainderScalarOp (#1119)
vidsinghal Aug 9, 2022
504de5e
Rework how global slot initializers work.
silvasean Jul 13, 2022
351f154
[MHLO] Add transposed convolution conversion pattern (#1171)
Vremold Aug 9, 2022
3e97a33
Revert "Reenable LTC in out-of-tree build (#1177)" (#1183)
henrytwo Aug 9, 2022
bb47c16
llvm: update tag to 061e0189 (#1180)
ashay Aug 9, 2022
e55fc4d
Revert "E2E support for AtenRemainderScalarOp (#1119)" (#1190)
powderluv Aug 9, 2022
f83a905
[MHLO]fix lowering failed on reduction op with i32 shape (#1185)
Yancey1989 Aug 9, 2022
202076c
Add CMake dep to Func dialect (#1196)
marbre Aug 9, 2022
7473561
Don't set MLIR_TABLEGEN_EXE (#1197)
marbre Aug 9, 2022
e75c7c5
Flip to C++17 (#1198)
jpienaar Aug 9, 2022
b696362
Enable OOT builds in CI (#1188)
sjain-stanford Aug 9, 2022
d41c7be
[Bazel] Allow workflow_dispatch manual trigger on bazel workflow (#1203)
sjain-stanford Aug 9, 2022
072c2b5
[Bazel] Add EraseModuleInitializer to TorchMLIRTorchPasses library (#…
sjain-stanford Aug 9, 2022
9cf0b6e
Disable out-of-tree and PyTorch binary (#1206)
powderluv Aug 10, 2022
8756277
[MHLO] Add AtenCatOp conversion pattern to MHLO (#1208)
Vremold Aug 10, 2022
2342456
mac m1 cross compile (#1204)
powderluv Aug 10, 2022
738f4fe
Rename TorchToStd pass as TorchToArith (#1163)
Aug 10, 2022
71c240a
Add note about MLIR compiled outputs in dev docs (#1195)
rengolin Aug 10, 2022
b8d51a7
Update TorchToStd to TorchtoArith in bazel files too. (#1210)
Aug 10, 2022
79b9cf9
Add lowering for aten.to.device (#1107)
gpetters94 Aug 10, 2022
dd2da5a
E2E support for AtenRemainderScalarOp (#1200)
vidsinghal Aug 11, 2022
d96ec64
remove torch dialect from legal list (#1192)
Yancey1989 Aug 11, 2022
b1a5066
Add decomposition of `aten.masked.tensor` op.
Aug 8, 2022
51bfe25
Add PyYaml to requirements.txt (#1174)
rengolin Aug 11, 2022
f00ca91
Simplify matrix configuration for CI workflows (#1213)
sjain-stanford Aug 11, 2022
b8bd0a4
use pytorch binary for macos-arm64 builds (#1215)
sjain-stanford Aug 12, 2022
aed0ec3
Merge matrix runs to fail fast globally (#1216)
sjain-stanford Aug 12, 2022
1581d6a
build: fix typo in path (#1218)
ashay Aug 12, 2022
34478ab
[Build] Add concurrency groups to address long queue times (#1219)
sjain-stanford Aug 13, 2022
606f4d2
build: streamline options for enabling LTC and MHLO (#1221)
ashay Aug 13, 2022
41aa562
s/external/externals/g (#1222)
sjain-stanford Aug 13, 2022
c935795
add native_dropout and related ops pattern (#1211)
Yancey1989 Aug 15, 2022
9d6ee48
Fix unused-variables warnings about EmbeddingBag ops (#1220)
ramiro050 Aug 15, 2022
3b3cb99
Generalize canonicalization pattern for more aten.sub/div/mul/add op …
Vremold Aug 16, 2022
84d345c
build: update llvm tag to 2dde4ba6 (#1229)
ashay Aug 16, 2022
0af5578
Propagate device data names (#1157)
antoniojkim Aug 16, 2022
fde390c
Re-enable custom op support
nithinsubbiah Aug 2, 2022
11a5b5a
[MHLO] Add AtenRSubScalarOp conversion pattern to MHLO (#1233)
Vremold Aug 17, 2022
85f383c
Bump the shape lib to match the upstream functions currently in PyTor…
qedawkins Aug 17, 2022
9be8997
Revert "add native_dropout and related ops pattern (#1211)" (#1230)
Yancey1989 Aug 17, 2022
9c8b962
Dockerize and Cache Bazel {Local, CI} Builds (#1240)
sjain-stanford Aug 17, 2022
57681f7
Iteratively run the main simplification pipeline.
silvasean Aug 4, 2022
114f48e
[Bazel] Check cache directory exists before changing owners (#1241)
sjain-stanford Aug 18, 2022
7d4a0d0
[Bazel] Add LowerToBackendContract.cpp to TorchMLIRTorchPasses bazel …
sjain-stanford Aug 18, 2022
f07f7d2
Clean up shape functions that use `sum_mean_dim` (#1217)
ramiro050 Aug 18, 2022
283e0f1
Add a concept of "backend legal ops".
silvasean Aug 17, 2022
1a7fc39
[docs] Add architecture doc.
silvasean Aug 5, 2022
9bc606c
Add support for returning more than one copy of the same tensor (#1228)
ramiro050 Aug 18, 2022
f601435
Add white background to diagram.
silvasean Aug 18, 2022
0d1aa43
Drop Python 3.7x from the nightly binary builds (#1246)
powderluv Aug 18, 2022
7bd173a
[MHLO] Eliminate explicit dynamic output shape generating in converti…
Vremold Aug 19, 2022
1e1759c
[Bazel] Run buildifier (#1250)
sjain-stanford Aug 19, 2022
65d811e
[MLIR][TORCH] Fix dynamic cases for aten.index.Tensor
vivekkhandelwal1 Aug 16, 2022
ba17a4d
Reenable LTC in out-of-tree build (for real this time) (#1205)
henrytwo Aug 19, 2022
99fb4c8
Add folder for ToF64Op and FromF64Op (#1257)
Vremold Aug 22, 2022
c38308f
Add lowering for _convolution.deprecated (#1259)
alextsao1999 Aug 22, 2022
3815cfa
[MLIR][TORCH] Fix CI failure due to failing tests
vivekkhandelwal1 Aug 22, 2022
1f1abda
Don't explicitly set MLIR_PDLL_TABLEGEN_EXE (#1262)
marbre Aug 22, 2022
ef89dad
Update Torch-MLIR Architecture Diagram (#1254)
powderluv Aug 22, 2022
01290d1
Add a way for backends to control which ops are legal for them.
silvasean Aug 19, 2022
9176b5e
Add decomposition for aten.flatten.using_ints (#1161)
Aug 23, 2022
8cad02f
[MLIR][TORCH] Add torch.Device type to backend contract scalar types
vivekkhandelwal1 Aug 19, 2022
2374098
[MHLO] Init end to end unit tests (#1223)
Aug 23, 2022
1106b9a
[MHLO] bert-tiny and resnet18 example from torchscript to mhlo (#1266)
Vremold Aug 23, 2022
3d0e18b
Add decomposition for aten.roll (#1170)
Aug 24, 2022
d7d6797
[cleanup] Change OutputType enum values to strings
silvasean Aug 19, 2022
f012279
Add transposed case for at::convolution (#917)
gpetters94 Aug 24, 2022
e2f862c
Fix LTC build warnings (#1272)
henrytwo Aug 24, 2022
1d9d925
mlir: fix replacement of `OpaqueElementsAttr` (#1274)
ashay Aug 24, 2022
233fd12
doc: fix instructions for LLVM and MHLO updates (#1273)
ashay Aug 24, 2022
a1ace06
Revert updating mlir_native_functions.cpp signature (#1281)
henrytwo Aug 25, 2022
e869e68
Fix LTC lib_torch_mlir_ltc.so import error (#1283)
henrytwo Aug 25, 2022
e153694
Add TestUtils.randint + replace torch.randint with tu.randint (#1276)
ramiro050 Aug 26, 2022
b1fa7a2
Fix a few build warnings
silvasean Aug 25, 2022
0e3ddba
Remove VerifyInvariantsBeforeBackendLowering
silvasean Aug 25, 2022
8e880a2
Fix symint related functionalization ops (#1289)
antoniojkim Aug 26, 2022
883c6b4
Add LTC architecture diagram (#1291)
henrytwo Aug 26, 2022
493f45f
Add documentation for adding E2E tests (#1269)
ramiro050 Aug 26, 2022
a507ae4
Avoid cascading failures when compiler crashes
silvasean Aug 25, 2022
f245613
Add reference to slides and presentation.
Aug 25, 2022
c0630da
Disable LTC by default until upstream revert relands (#1303)
powderluv Aug 29, 2022
2623185
Rename an outdated class name
silvasean Aug 27, 2022
bcccf41
Add CI for generated files.
silvasean Aug 25, 2022
15fca6e
Update MHLO xfails.
silvasean Aug 26, 2022
f402eb2
Move development.md to docs/ for consistency
silvasean Aug 27, 2022
e16b43e
Remove "torchscript" association from the e2e framework.
silvasean Aug 29, 2022
079bff3
Sort tests before anything else.
silvasean Aug 29, 2022
0f40d98
Ensure that tests have unique names
silvasean Aug 29, 2022
9f061ea
Dockerize CI + Release builds (#1234)
powderluv Aug 30, 2022
51ef1b1
Add some missing dependencies.
silvasean Aug 27, 2022
e52e886
build: update llvm tag to 00d648bd (#1307)
ashay Aug 30, 2022
928c815
Add shapelib and Torch ODS gen tests (#1318)
powderluv Aug 31, 2022
3704363
Use pre-compiled headers for PyTorch Source builds (#1327)
powderluv Aug 31, 2022
7769eb8
Set ccache logging to verbose temporarily (#1326)
powderluv Aug 31, 2022
29cafdb
[MHLO] refactor pass configurations (#1315)
Sep 1, 2022
a924de3
Slightly tweak generated file checks
silvasean Aug 31, 2022
f5a8a93
aicompiler rebase 20220830
Aug 12, 2022
1465814
To comply with the old pytorch versions
Jun 11, 2022
5d5504d
add relu6 op
Yancey1989 Jun 21, 2022
5d6b854
Add decomposition for aten::native_layer_norm (#13)
Jul 20, 2022
3bc47c3
Add native_dropout_backward & native_layer_norm_backward decompositio…
Aug 8, 2022
c1b556a
add native_dropout and related ops pattern (#1211)
Yancey1989 Aug 15, 2022
207c7ad
Fix dot product result type setting (#19)
Sep 20, 2022
8f29de9
fix BatchNormInference
Sep 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,29 @@ inputs:

runs:
using: "composite"

steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install MLIR Python depends
run: |
python -m pip install -r $GITHUB_WORKSPACE/externals/llvm-project/mlir/python/requirements.txt
shell: bash

- name: Install PyTorch nightly depends
run: |
python -m pip install -r requirements.txt
shell: bash

- name: Install Ninja
uses: llvm/actions/install-ninja@55d844821959226fab4911f96f37071c1d4c3268
- name: Get Submodule Hash
id: get-submodule-hash
run: echo "::set-output name=hash::$(md5sum $(git submodule status))"
shell: bash

- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }}${{ inputs.cache-suffix }}
key: ${{ runner.os }}-torch_mlir_build_assets-${{ inputs.cache-suffix }}
max-size: 2G
verbose: 2
70 changes: 56 additions & 14 deletions .github/workflows/bazelBuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,68 @@ name: Bazel Build and Test

on:
push:
branches:
- main
branches: [ main ]
workflow_dispatch:

# Ensure that only a single job or workflow using the same
# concurrency group will run at a time. This would cancel
# any in-progress jobs in the same github workflow and github
# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
build:
name: Build and Test (Release Asserts)
runs-on: ubuntu-20.04
ubuntu-build:
name: ubuntu-x86_64
runs-on: ubuntu-22.04

steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Get torch-mlir
uses: actions/checkout@v2
- name: Checkout torch-mlir
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Build with bazel

- name: Setup cache for bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ubuntu_x86_64_torch_mlir_bazel_build_cache

# Change bazel cache directory to root ownership
# to allow writing to it from within the docker container.
# If no cache hits, this directory is not present
# so don't run chown (will error otherwise).
- name: Set bazel cache permissions
run: |
cd $GITHUB_WORKSPACE/utils/bazel
bazel build @torch-mlir//...
if [ -d "${HOME}/.cache/bazel" ]; then
sudo chown -R root:root "${HOME}/.cache/bazel"
fi

- name: Build docker image
run: |
docker build -f utils/bazel/docker/Dockerfile \
-t torch-mlir:ci \
.

- name: Bazel build torch-mlir
run: |
docker run --rm \
-v "$(pwd)":"/opt/src/torch-mlir" \
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
torch-mlir:ci \
./utils/bazel/docker/run_bazel_build.sh

# Switch back bazel cache directory to user ownership
# to allow GHA post-cache step to save cache without
# permissions issue.
- name: Switch bazel cache permissions
run: |
if [ -d "${HOME}/.cache/bazel" ]; then
sudo chown -R "$USER":"$USER" "${HOME}/.cache/bazel"
fi

- name: Send mail
if: failure()
uses: dawidd6/action-send-mail@v3
Expand Down
239 changes: 169 additions & 70 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
@@ -1,102 +1,201 @@
name: Build and Test

on:
push:
branches:
- main
pull_request:
branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:

# Ensure that only a single job or workflow using the same
# concurrency group will run at a time. This would cancel
# any in-progress jobs in the same github workflow and github
# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


# Provisioned Jobs:
# ubuntu - x86_64 - llvm in-tree - pytorch binary - build+test # most used dev flow and fastest signal
# ubuntu - x86_64 - llvm out-of-tree - pytorch source - build+test # most elaborate build
# macos - arm64 - llvm in-tree - pytorch binary - build only # cross compile, can't test arm64
jobs:
build:
name: Build and Test (Release Asserts)
# Changes to the name of this job needs to be synced with releaseSnapshotPackage.yml.
runs-on: ubuntu-20.04
build-test:
strategy:
fail-fast: true
matrix:
os-arch: [ubuntu-x86_64, macos-arm64]
llvm-build: [in-tree, out-of-tree]
torch-binary: [ON, OFF]
exclude:
# Exclude llvm in-tree and pytorch source
- llvm-build: in-tree
torch-binary: OFF
# Exclude llvm out-of-tree and pytorch binary
- llvm-build: out-of-tree
torch-binary: ON
# Exclude macos-arm64 and llvm out-of-tree altogether
- os-arch: macos-arm64
llvm-build: out-of-tree
include:
# Specify OS versions
- os-arch: ubuntu-x86_64
os: ubuntu-22.04
- os-arch: macos-arm64
os: macos-12
runs-on: ${{ matrix.os }}

steps:
- name: Get torch-mlir
- name: Checkout torch-mlir
uses: actions/checkout@v2
with:
submodules: 'true'
- uses: ./.github/actions/setup-build

- name: Setup ccache
uses: ./.github/actions/setup-build
with:
cache-suffix: ''
- name: Build and Test torch-mlir (Assert)
cache-suffix: ${{ matrix.os-arch }}-${{ matrix.llvm-build }}-${{ matrix.torch-binary }}

- name: Configure os-arch='ubuntu-x86_64' llvm-build='in-tree' torch-binary='${{ matrix.torch-binary }}'
# Fastest build, most used dev flow
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }}
run: |
cd $GITHUB_WORKSPACE
mkdir build
cd build
cmake $GITHUB_WORKSPACE/externals/llvm-project/llvm -GNinja \
cmake -GNinja -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LINKER=lld \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DPython3_EXECUTABLE=$(which python) \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$GITHUB_WORKSPACE" \
-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="${GITHUB_WORKSPACE}/external/llvm-external-projects/torch-mlir-dialects" \
-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="${GITHUB_WORKSPACE}/externals/llvm-external-projects/torch-mlir-dialects" \
-DLLVM_TARGETS_TO_BUILD=host \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DLLVM_TARGETS_TO_BUILD=host
ninja check-torch-mlir-all
- name: RefBackend - TorchScript end-to-end tests
run: |
cd $GITHUB_WORKSPACE
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
python -m e2e_testing.torchscript.main --config=refbackend -v
- name: EagerMode - TorchScript end-to-end tests
run: |
cd $GITHUB_WORKSPACE
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
python -m e2e_testing.torchscript.main --config=eager_mode -v
- name: TOSA backend - TorchScript end-to-end tests
run: |
cd $GITHUB_WORKSPACE
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
python -m e2e_testing.torchscript.main --config=tosa -v
-DTORCH_MLIR_USE_INSTALLED_PYTORCH="${{ matrix.torch-binary }}" \
-DPython3_EXECUTABLE="$(which python)" \
$GITHUB_WORKSPACE/externals/llvm-project/llvm

build-out-of-tree:
name: Build out-of-tree (Release Asserts)
runs-on: ubuntu-20.04
steps:
- name: Get torch-mlir
uses: actions/checkout@v2
with:
submodules: 'true'
- uses: ./.github/actions/setup-build
with:
cache-suffix: '-out-of-tree'
- name: Build LLVM (standalone)
# This build takes a while but is expected to almost always be cached.
# A cache invalidation occurs when the committed LLVM version is changed.
- name: Configure os-arch='ubuntu-x86_64' llvm-build='out-of-tree' torch-binary='${{ matrix.torch-binary }}'
# Most elaborate build, but cached
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'out-of-tree' }}
run: |
cd $GITHUB_WORKSPACE
cmake -Bllvm-build -GNinja \
cmake -GNinja -Bllvm-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LINKER=lld \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DPython3_EXECUTABLE=$(which python) \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS=mlir \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DLLVM_TARGETS_TO_BUILD=host \
externals/llvm-project/llvm
ninja -Cllvm-build
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DPython3_EXECUTABLE="$(which python)" \
$GITHUB_WORKSPACE/externals/llvm-project/llvm
cmake --build llvm-build

- name: Build and test torch-mlir (out-of-tree)
run: |
cd $GITHUB_WORKSPACE
cmake -GNinja -Bbuild \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LINKER=lld \
-DLLVM_DIR="$GITHUB_WORKSPACE/llvm-build/lib/cmake/llvm/" \
-DMLIR_DIR="$GITHUB_WORKSPACE/llvm-build/lib/cmake/mlir/" \
-DMLIR_ENABLE_BINDINGS_PYTHON=OFF \
-DTORCH_MLIR_USE_INSTALLED_PYTORCH="${{ matrix.torch-binary }}" \
-DPython3_EXECUTABLE="$(which python)" \
$GITHUB_WORKSPACE

- name: Configure os-arch='macos-arm64' llvm-build='in-tree' torch-binary='${{ matrix.torch-binary }}'
# cross compile, can't test arm64
if: ${{ matrix.os-arch == 'macos-arm64' && matrix.llvm-build == 'in-tree' }}
run: |
# TODO: Reenable LTC after build on macOS-arm64 is fixed (https://github.com/llvm/torch-mlir/issues/1253)
cmake -GNinja -Bbuild_arm64 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LINKER=lld \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DMLIR_DIR="$(pwd)/llvm-build/lib/cmake/mlir/" \
-DLLVM_DIR="$(pwd)/llvm-build/lib/cmake/llvm/" \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" \
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$GITHUB_WORKSPACE" \
-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR="${GITHUB_WORKSPACE}/externals/llvm-external-projects/torch-mlir-dialects" \
-DLLVM_TARGETS_TO_BUILD=AArch64 \
-DLLVM_USE_HOST_TOOLS=ON \
-DLLVM_ENABLE_ZSTD=OFF \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DPython3_EXECUTABLE=$(which python) \
.
ninja -Cbuild check-torch-mlir-all
-DTORCH_MLIR_ENABLE_MHLO=OFF \
-DTORCH_MLIR_ENABLE_LTC=OFF \
-DTORCH_MLIR_USE_INSTALLED_PYTORCH="${{ matrix.torch-binary }}" \
-DMACOSX_DEPLOYMENT_TARGET=12.0 \
-DPython3_EXECUTABLE="$(which python)" \
$GITHUB_WORKSPACE/externals/llvm-project/llvm

- name: Build torch-mlir
if: ${{ matrix.os-arch == 'ubuntu-x86_64' }}
run: |
cmake --build build

- name: Build torch-mlir (cross-compile)
if: ${{ matrix.os-arch == 'macos-arm64' }}
run: |
cmake --build build_arm64

- name: Run torch-mlir unit tests
if: ${{ matrix.os-arch == 'ubuntu-x86_64' }}
run: |
cmake --build build --target check-torch-mlir-all

- name: Ensure generated files are up to date
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }}
run: |
./build_tools/update_torch_ods.sh
./build_tools/update_shape_lib.sh
if ! git diff --quiet; then
echo "#######################################################"
echo "Generated files are not up to date (see diff below)"
echo ">>> Please run ./build_tools/update_torch_ods.sh and ./build_tools/update_shape_lib.sh <<<"
echo "#######################################################"
git diff --color=always
exit 1
fi

- name: Run refbackend e2e integration tests
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }}
run: |
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
python -m e2e_testing.main --config=refbackend -v

# Don't run python tests, as check-torch-mlir-all already checks
# what we want.
- name: Run eager_mode e2e integration tests
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }}
run: |
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
python -m e2e_testing.main --config=eager_mode -v

- name: Run mhlo e2e integration tests
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }}
run: |
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
python -m e2e_testing.main --config=mhlo -v

- name: Run tosa e2e integration tests
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }}
run: |
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
python -m e2e_testing.main --config=tosa -v

- name: Run lazy_tensor_core e2e integration tests
if: ${{ matrix.os-arch == 'ubuntu-x86_64' && matrix.llvm-build == 'in-tree' }}
run: |
export PYTHONPATH="$GITHUB_WORKSPACE/build/tools/torch-mlir/python_packages/torch_mlir"
echo "LTC tests disabled temporarily. https://github.com/llvm/torch-mlir/pull/1292"
# python -m e2e_testing.main --config=lazy_tensor_core -v
2 changes: 1 addition & 1 deletion .github/workflows/buildRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

build_macos:
name: MacOS Build
runs-on: macos-latest
runs-on: macos-12
steps:
- name: Get torch-mlir
uses: actions/checkout@v2
Expand Down
Loading