Repository navigation
162 lines (122 loc) · 4.04 KB
/
Copy pathci.yml
File metadata and controls
162 lines (122 loc) · 4.04 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: CI
on:
push:
branches: [main]
# all PRs, so stacked PRs (based on another branch) get checked too
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: cargo build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: cargo build
run: cargo build --release
lint:
name: cargo fmt / clippy
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: cargo fmt --check
run: cargo fmt --check
- name: cargo clippy
run: cargo clippy --release --all-targets -- -D warnings
python-tests:
name: python tests (maturin)
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Create virtualenv
run: python -m venv .venv
- name: Install Python deps
run: .venv/bin/pip install maturin numpy onnx onnxruntime
- name: Build extension
run: source .venv/bin/activate && maturin develop --release
- name: Generate test fixtures
run: .venv/bin/python tests/make_test_model.py
- name: Run tensor bridge tests
run: .venv/bin/python tests/test_bridge.py
- name: Run ORT comparison tests
run: .venv/bin/python tests/compare_ort.py
- name: Run op edge-case tests
run: .venv/bin/python tests/test_ops.py
resnet18-e2e:
name: resnet18 end-to-end
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
# Model Zoo downloads, torch exports and torchvision weights (~200 MB total)
- name: Cache models
uses: actions/cache@v4
with:
path: |
tests/models
~/.cache/torch
key: resnet18-models-v1
- name: Create virtualenv
run: python -m venv .venv
- name: Install Python deps
run: |
.venv/bin/pip install maturin numpy onnx onnxruntime onnxscript
.venv/bin/pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- name: Build extension
run: source .venv/bin/activate && maturin develop --release
- name: Run ResNet-18 tests
run: .venv/bin/python tests/test_resnet.py --bench
wgpu-tests:
name: wgpu tests (software Vulkan)
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
# no GPU on hosted runners: lavapipe is Mesa's CPU implementation of Vulkan,
# enough to check the GPU code path end to end (not its speed)
- name: Install lavapipe
run: sudo apt-get update && sudo apt-get install -y mesa-vulkan-drivers
- name: Create virtualenv
run: python -m venv .venv
- name: Install Python deps
run: .venv/bin/pip install maturin numpy onnx onnxruntime
- name: Build extension
run: source .venv/bin/activate && maturin develop --release
- name: Run op edge-case tests on wgpu
run: BURN_BACKEND=wgpu .venv/bin/python tests/test_ops.py