-
-
Notifications
You must be signed in to change notification settings - Fork 0
323 lines (304 loc) · 13.8 KB
/
Copy pathbuild_push.yml
File metadata and controls
323 lines (304 loc) · 13.8 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
name: Build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'master'
- '!ci_test_*'
tags-ignore:
- '*'
pull_request:
branches:
- 'master'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: rustup target add aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu i686-unknown-linux-gnu powerpc-unknown-linux-gnu riscv64gc-unknown-linux-gnu wasm32-unknown-unknown
- run: RUSTFLAGS="-C target-feature=+neon,-fp16" cargo build --target aarch64-unknown-linux-gnu
- run: RUSTFLAGS="-C target-feature=+neon,+fp16" cargo +nightly build --target aarch64-unknown-linux-gnu --features nightly_f16,nightly_i8mm
- run: RUSTFLAGS="-C target-feature=+sse4.1" cargo build --target i686-unknown-linux-gnu
- run: cargo build --target powerpc-unknown-linux-gnu
- run: cargo build --target riscv64gc-unknown-linux-gnu
- run: RUSTFLAGS="-C target-feature=+sse4.1" cargo build --target x86_64-unknown-linux-gnu
- run: RUSTFLAGS="-C target-feature=+sse4.1,+f16c" cargo +nightly build --features nightly_f16 --target x86_64-unknown-linux-gnu
- run: RUSTFLAGS="-C target-feature=+avx2,+f16c" cargo +nightly build --features nightly_f16 --target x86_64-unknown-linux-gnu
- run: RUSTFLAGS="-C target-feature=+avx2" cargo build --target x86_64-unknown-linux-gnu
- run: RUSTFLAGS="-C target-feature=+simd128" cargo build --target wasm32-unknown-unknown
clippy:
name: Clippy
strategy:
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- run: rustup component add clippy
- run: cargo clippy -- -D warnings
clippy_nightly:
name: Clippy Nightly
strategy:
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: rustup component add clippy
- run: rustup target add wasm32-unknown-unknown
- run: cargo clippy --all-features -- -D warnings
- run: RUSTFLAGS="-C target-feature=+simd128" cargo clippy --all-features --target wasm32-unknown-unknown -- -D warnings
tests_x86:
name: Testing x86
strategy:
matrix:
feature: [ avx, sse, "", nightly_f16 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: cargo +nightly test --features "${{ matrix.feature }}"
tests_aarch64_neon_no_rdm_no_i8mm:
name: Testing AArch64 NEON (no RDM, no I8MM)
runs-on: ubuntu-24.04-arm
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: |
sudo apt-get update
sudo apt-get install -y qemu-user
- run: rustup target add aarch64-unknown-linux-gnu
- name: Run tests
run: |
failed=0
tests=$(cargo +nightly test --features "neon,nightly_f16,nightly_i8mm,rdm" --lib -- --list 2>/dev/null | grep ': test' | sed 's/: test//')
while read -r test; do
rc=0
echo "Running: $test"
output=$(RUSTFLAGS="-C target-feature=+neon,-rdm" \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -cpu cortex-a53" \
cargo +nightly test --target aarch64-unknown-linux-gnu --lib \
--features "neon,nightly_f16,nightly_i8mm,rdm" -- "$test" --exact 2>&1) || rc=$?
echo "$output" | grep -E "FAILED|ok|signal 4"
if [ "${rc:-0}" -ne 0 ]; then
echo "❌ Test failed: $test"
echo "$output"
failed=1
else
echo "$output" | grep -E "ok|signal 4"
fi
done <<< "$tests"
exit $failed
tests_aarch64_neon_rdm_no_i8mm:
name: Testing AArch64 NEON (RDM, no I8MM)
runs-on: ubuntu-24.04-arm
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: |
sudo apt-get update
sudo apt-get install -y qemu-user
- run: rustup target add aarch64-unknown-linux-gnu
- name: Run tests
run: |
failed=0
tests=$(cargo +nightly test --features "neon,nightly_f16,nightly_i8mm,rdm" --lib -- --list 2>/dev/null | grep ': test' | sed 's/: test//')
while read -r test; do
rc=0
echo "Running: $test"
output=$(RUSTFLAGS="-C target-feature=+neon,-rdm" \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -cpu cortex-a72" \
cargo +nightly test --target aarch64-unknown-linux-gnu --lib \
--features "neon,nightly_f16,nightly_i8mm,rdm" -- "$test" --exact 2>&1) || rc=$?
echo "$output" | grep -E "FAILED|ok|signal 4"
if [ "${rc:-0}" -ne 0 ]; then
echo "❌ Test failed: $test"
echo "$output"
failed=1
else
echo "$output" | grep -E "ok|signal 4"
fi
done <<< "$tests"
exit $failed
tests_x86_sse_isolated:
name: Testing x86 SSE isolated
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: |
sudo apt-get update
sudo apt-get install -y qemu-user
- run: |
failed=0
tests=$(cargo +nightly test --lib --features "avx,sse,nightly_f16" -- --list 2>/dev/null | grep ': test' | sed 's/: test//')
while read -r test; do
rc=0
echo "Running: $test"
output=$(RUSTFLAGS="-C target-feature=+sse4.1,-avx,-avx2,-fma" \
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="qemu-x86_64 -cpu Nehalem" \
cargo +nightly test --lib --features "avx,sse,nightly_f16" -- "$test" --exact 2>&1) || rc=$?
echo "$output" | grep -E "FAILED|ok|signal 4"
if [ "${rc:-0}" -ne 0 ]; then
echo "❌ Test failed: $test"
echo "$output"
failed=1
else
echo "$output" | grep -E "ok|signal 4"
fi
done <<< "$tests"
exit $failed
tests_x86_avx2_isolated:
name: Testing x86 AVX2 isolated (no FMA)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: |
sudo apt-get update
sudo apt-get install -y qemu-user
- run: |
failed=0
tests=$(cargo +nightly test --features "avx,nightly_f16" --lib -- --list 2>/dev/null | grep ': test' | sed 's/: test//')
while read -r test; do
rc=0
echo "Running: $test"
output=$(RUSTFLAGS="-C target-feature=+avx2,-fma" \
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="qemu-x86_64 -cpu Haswell-noTSX,avx2=on,fma=off" \
cargo +nightly test --lib --features "avx,nightly_f16" --target x86_64-unknown-linux-gnu -- "$test" --exact 2>&1) || rc=$?
echo "$output" | grep -E "FAILED|ok|signal 4"
if [ "${rc:-0}" -ne 0 ]; then
echo "❌ Test failed: $test"
echo "$output"
failed=1
else
echo "$output" | grep -E "ok|signal 4"
fi
done <<< "$tests"
exit $failed
tests_arm:
name: Testing ARM
runs-on: ubuntu-24.04-arm
strategy:
matrix:
feature: [ "", "neon", "neon,rdm,nightly_i8mm,nightly_f16", "sve" ]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: cargo +nightly test --features "${{ matrix.feature }}"
fuzz_rgba_8bit:
name: Fuzzing 8bit
runs-on: ubuntu-24.04-arm
if: github.event_name == 'pull_request'
strategy:
matrix:
feature: [ "rdm,nightly_f16", "neon,nightly_f16" ]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-fuzz
- run: cargo fuzz run resize_rgba --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgb --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_cbcr8 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_plane --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgba_u16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgba_f16 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_rgb_u16 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_rgb_f16 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_cbcr16 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_cbcr_f16 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_plane_u16 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_rgba_f32 -- -max_total_time=10
- run: cargo fuzz run resize_rgb_f32 -- -max_total_time=10
- run: cargo fuzz run resize_cbcr_f32 -- -max_total_time=10
- run: cargo fuzz run resize_plane_f32 -- -max_total_time=10
fuzz_nightly_arm:
name: Fuzzing 8bit I8MM
runs-on: ubuntu-24.04-arm
if: github.event_name == 'pull_request'
strategy:
matrix:
feature: [ nightly_i8mm ]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-fuzz
- run: cargo fuzz run resize_rgba --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_rgb --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_cbcr8 --features ${{ matrix.feature }} -- -max_total_time=10
fuzz_nightly_arm_sve:
name: Fuzzing SVE2
runs-on: ubuntu-24.04-arm
if: github.event_name == 'pull_request'
strategy:
matrix:
feature: [ sve ]
steps:
- uses: actions/checkout@v6
- name: Verify SVE2 available
run: |
python3 ./assets/sve_vl.py
grep -m1 "sve2" /proc/cpuinfo || (echo "SVE2 not available on this runner" && exit 1)
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-fuzz
- run: cargo fuzz run resize_rgba --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_rgb --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_cbcr8 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_rgb_u16 --features ${{ matrix.feature }} -- -max_total_time=10
- run: cargo fuzz run resize_rgba_u16 --features ${{ matrix.feature }} -- -max_total_time=10
fuzz_avx_sse:
name: Fuzzing AVX,SSE
if: github.event_name == 'pull_request'
strategy:
matrix:
feature: [ "sse,nightly_f16", "avx,nightly_f16", "" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-fuzz
- run: cargo fuzz run resize_rgba --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgb --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_cbcr8 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_plane --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run colorspaces --features colorspaces -- -max_total_time=10
- run: cargo fuzz run resize_rgba_u16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgba_f16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgb_u16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgb_f16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_cbcr16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_cbcr_f16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_plane_u16 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgba_f32 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_rgb_f32 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_cbcr_f32 --features "${{ matrix.feature }}" -- -max_total_time=10
- run: cargo fuzz run resize_plane_f32 --features "${{ matrix.feature }}" -- -max_total_time=10
python_bindings:
name: Python bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Create venv and install dependencies
run: |
python -m venv pic-scale-py/.venv
pic-scale-py/.venv/bin/pip install --upgrade pip
pic-scale-py/.venv/bin/pip install maturin pytest numpy Pillow
- name: Build and install zaft
working-directory: pic-scale-py
run: .venv/bin/maturin develop --release
- name: Run Python tests
working-directory: pic-scale-py
run: .venv/bin/pytest tests/test_pic_scale.py -v