-
Notifications
You must be signed in to change notification settings - Fork 71
145 lines (125 loc) · 4.07 KB
/
ci-mlir.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This workflow will install MLIR, Python dependencies, run tests and lint with a single version of Python
name: CI - MLIR-based Testing
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
env:
LLVM_SYMBOLIZER_PATH: /usr/lib/llvm-11/bin/llvm-symbolizer
MLIR-Version: d401987fe349a87c53fe25829215b080b70c0c1a
steps:
- uses: actions/checkout@v4
with:
path: xdsl
fetch-depth: 2
- name: Install native dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: mesa-vulkan-drivers
version: 1.0
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
cache-dependency-path: |
setup.py
requirements.txt
- name: Upgrade pip
run: |
pip install --upgrade pip
- name: Install the package locally and nbval
run: |
# Change directory so that xdsl-opt can be found during installation.
cd xdsl
pip install -r requirements.txt
- name: Cache binaries
id: cache-binary
uses: actions/cache@v4
with:
path: llvm-project/build
key: binaries-${{ runner.os }}-${{ env.MLIR-Version }}
restore-keys: binaries-${{ runner.os }}-${{ env.MLIR-Version }}
- name: Checkout MLIR
if: steps.cache-binary.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: llvm/llvm-project.git
path: llvm-project
ref: ${{ env.MLIR-Version }}
- name: Clang Setup
if: steps.cache-binary.outputs.cache-hit != 'true'
uses: egor-tensin/setup-clang@v1
- name: Ninja Setup
if: steps.cache-binary.outputs.cache-hit != 'true'
uses: lukka/get-cmake@9e431acfe656e5db66cd4930386328fce59cfaba
- name: MLIR Build Setup
if: steps.cache-binary.outputs.cache-hit != 'true'
run: |
mkdir llvm-project/build
cd llvm-project/build
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DLLVM_ENABLE_LLD=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON
- name: MLIR Build
if: steps.cache-binary.outputs.cache-hit != 'true'
run: |
cd llvm-project/build
cmake --build . --target mlir-opt mlir-cpu-runner
- name: Test with pytest and generate code coverage
run: |
cd xdsl
pytest -W error --cov --cov-config=.coveragerc .
- name: Execute lit tests
run: |
cd xdsl
# Add mlir-opt to the path
export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/
lit -v tests/filecheck/ -DCOVERAGE
lit -v docs/Toy/examples/ -DCOVERAGE
- name: Test MLIR dependent examples/tutorials
run: |
cd xdsl
# Add mlir-opt to the path
export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/
pytest --nbval docs/mlir_interoperation.ipynb --maxfail 1 -vv
- name: Test ONNX-dependent marimo notebooks
run: |
cd xdsl
# Add mlir-opt to the path
export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/
make tests-marimo-onnx
- name: Combine coverage data
run: |
cd xdsl
coverage combine --append
coverage report
coverage xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: Wandalen/wretry.action@v1
with:
action: codecov/codecov-action@v4
attempt_delay: 10000
attempt_limit: 10
with: |
fail_ci_if_error: true
verbose: true
root_dir: xdsl
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}