From c562b369b928810db4ddee6db3cf4a16d7bfb395 Mon Sep 17 00:00:00 2001 From: Dan Draper Date: Sat, 2 May 2026 13:57:59 +1000 Subject: [PATCH] ci(bench): guard on SSE4.1 + SSSE3 + AVX2 availability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bench job's whole point is to compare scalar vs SIMD on the same silicon. Without the right CPU features the crate's runtime feature gate would silently route to the scalar fallback, turning the benchmark into apples-to-apples scalar — a misleading "speedup: 1.00×" with no signal that anything went wrong. Add a fail-fast step that greps `/proc/cpuinfo` for the required features and aborts before `cargo bench` runs. GitHub annotation syntax (`::error::`) surfaces the failure clearly in the Actions UI. Required features: - sse4.1 + ssse3 — needed for the existing SSE encode/decode path. - avx2 — needed for the upcoming AVX2 fast path. All three have been universal on x86 server hardware since ~2013 and are present on the current GitHub-hosted Ubuntu runner fleet (Azure Standard_D4ads_v5 / AMD EPYC 7763 / Zen 3). --- .github/workflows/bench.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 70ce797..e69f9e2 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -42,6 +42,28 @@ jobs: | sort -u | tr '\n' ' ' echo + # Guard: the bench numbers from this workflow are the only x86 perf + # data we have until we get dedicated metal. If GitHub ever rotates + # the runner fleet to hardware without SSE4.1/SSSE3/AVX2 (extremely + # unlikely — those have been universal x86 server features since + # ~2013), the SIMD path would silently fall back to scalar inside + # the crate's runtime feature gate and the comparison would + # become apples-to-apples scalar vs scalar. Fail loudly instead. + - name: Require SSE4.1 + SSSE3 + AVX2 + run: | + missing=() + for feat in sse4_1 ssse3 avx2; do + if ! grep -q "\b${feat}\b" /proc/cpuinfo; then + missing+=("${feat}") + fi + done + if [ ${#missing[@]} -ne 0 ]; then + echo "::error::Required CPU features missing on this runner: ${missing[*]}." + echo "::error::Bench would silently fall back to scalar; aborting." + exit 1 + fi + echo "All required features present." + - name: Install Rust stable uses: dtolnay/rust-toolchain@stable