1
Fork 0

Dynamically detect AVX512 in CI

We would like to check for errors with AVX512,
but we don't pick our CPU. So, detect available features.
This variance in checks stochastically reveals issues.
Nondeterminism is acceptable as our goal is protecting downstream.
This commit is contained in:
Jubilee Young 2021-11-09 23:49:16 -08:00 committed by Jubilee
parent 949f71c0dc
commit 7d91357875

View file

@ -228,14 +228,14 @@ jobs:
run: cross test --verbose --target=${{ matrix.target }} --release run: cross test --verbose --target=${{ matrix.target }} --release
features: features:
name: "Check cargo features (${{ matrix.features }} ${{ matrix.rustflags }})" name: "Check cargo features (${{ matrix.simd }} × ${{ matrix.features }})"
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
rustflags: simd:
- "" - ""
- "-Ctarget-feature=+avx512f" # AVX-512 uses packed bit masks, so enable it to test more code paths - "avx512"
features: features:
- "" - ""
- "--features std" - "--features std"
@ -248,7 +248,13 @@ jobs:
run: | run: |
rustup update nightly --no-self-update rustup update nightly --no-self-update
rustup default nightly rustup default nightly
- name: Detect AVX512
run: echo "CPU_FEATURE=$(lscpu | grep -o avx512[a-z]* | sed s/avx/+avx/ | tr '\n' ',' )" >> $GITHUB_ENV
- name: Check build - name: Check build
run: cargo check --all-targets --no-default-features ${{ matrix.features }} if: ${{ matrix.simd == '' }}
env: run: RUSTFLAGS="-Dwarnings" cargo check --all-targets --no-default-features ${{ matrix.features }}
RUSTFLAGS: -Dwarnings ${{ matrix.rustflags }} - name: Check AVX
if: ${{ matrix.simd == 'avx512' && contains(env.CPU_FEATURE, 'avx512') }}
run: |
echo "Found AVX features: $CPU_FEATURE"
RUSTFLAGS="-Dwarnings -Ctarget-feature=$CPU_FEATURE" cargo check --all-targets --no-default-features ${{ matrix.features }}