about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2021-11-09 23:49:16 -0800
committerJubilee <46493976+workingjubilee@users.noreply.github.com>2021-11-10 14:40:32 -0800
commit7d91357875da59d52284d506dcb457f7f88bf6bf (patch)
treeaf197c8cf59e6a1e6e80f1038ee71f4109bee511
parent949f71c0dc8716e285c164eae225db2d18333f0d (diff)
downloadrust-7d91357875da59d52284d506dcb457f7f88bf6bf.tar.gz
rust-7d91357875da59d52284d506dcb457f7f88bf6bf.zip
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.
-rw-r--r--.github/workflows/ci.yml18
1 files changed, 12 insertions, 6 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 90007a2f8f6..d50dfa1be4c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -228,14 +228,14 @@ jobs:
         run: cross test --verbose --target=${{ matrix.target }} --release
 
   features:
-    name: "Check cargo features (${{ matrix.features }} ${{ matrix.rustflags }})"
+    name: "Check cargo features (${{ matrix.simd }} × ${{ matrix.features }})"
     runs-on: ubuntu-latest
     strategy:
       fail-fast: false
       matrix:
-        rustflags:
+        simd:
           - ""
-          - "-Ctarget-feature=+avx512f" # AVX-512 uses packed bit masks, so enable it to test more code paths
+          - "avx512"
         features:
           - ""
           - "--features std"
@@ -248,7 +248,13 @@ jobs:
         run: |
           rustup update nightly --no-self-update
           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
-        run: cargo check --all-targets --no-default-features ${{ matrix.features }}
-        env:
-            RUSTFLAGS: -Dwarnings ${{ matrix.rustflags }}
+        if: ${{ matrix.simd == '' }}
+        run: RUSTFLAGS="-Dwarnings" cargo check --all-targets --no-default-features ${{ matrix.features }}
+      - 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 }}