From 3505fe352207eb22883294b8bdaa8bc29cd2624f Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Oct 2026 04:59:17 +0000 Subject: [PATCH 1/4] ci: key the native-target caches to the runner's CPU .cargo/config.toml builds with target-cpu=native, and cargo fingerprints the flag text, not the CPU. dir-sim-persist.yml and identity.yml set no RUSTFLAGS and restore target/ from Swatinem/rust-cache, so an artifact built on a runner with AVX-512 was reused on one without: the lance-graph-contract build script died with SIGILL (dir-sim log in Lance, red on main since 10325b35). Both workflows now hash /proc/cpuinfo's flags into the cache key. Also corrects the config comment that claimed every workflow overrides native with RUSTFLAGS; only build, rust-test and style do. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh --- .cargo/config.toml | 10 +++++++--- .github/workflows/dir-sim-persist.yml | 8 ++++++++ .github/workflows/identity.yml | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 8fdd89a22..7f8a0b32f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -35,9 +35,13 @@ # portable baseline (AVX2): cargo build --config .cargo/config-v3.toml ... # AVX-512 (v4): cargo build --config .cargo/config-avx512.toml ... # -# CI is unaffected: every workflow sets `RUSTFLAGS` with an explicit -# `-C target-cpu=x86-64-v3`, and a RUSTFLAGS env REPLACES every cargo-config -# rustflags entry. Everything else that ships pins x86_64 to v3 without +# CI: build.yml, rust-test.yml and style.yml set `RUSTFLAGS` with an explicit +# `-C target-cpu=x86-64-v3` (a RUSTFLAGS env REPLACES every cargo-config +# rustflags entry). Every other workflow builds with `native`. Cargo +# fingerprints the flag TEXT, not the CPU, so a workflow that caches `target/` +# must key the cache to the runner's CPU flags (dir-sim-persist.yml and +# identity.yml do); without that, an artifact built on a runner with AVX-512 +# is reused on one without and dies with SIGILL. Everything else that ships pins x86_64 to v3 without # touching other architectures: the Dockerfiles that copy this tree replace # this file with config-v3.toml (x86_64-only), the thinking-engine images set # CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS, and `make publish` in diff --git a/.github/workflows/dir-sim-persist.yml b/.github/workflows/dir-sim-persist.yml index 77300aed4..fae13e688 100644 --- a/.github/workflows/dir-sim-persist.yml +++ b/.github/workflows/dir-sim-persist.yml @@ -62,8 +62,16 @@ jobs: run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libprotobuf-dev - name: Setup rust toolchain (pinned by rust-toolchain.toml) run: rustup show + # `.cargo/config.toml` builds with target-cpu=native, and cargo's + # fingerprint sees the flag text, not the CPU: a cached artifact built + # on a runner with AVX-512 would be reused on one without and die with + # SIGILL. Key the cache to this runner's CPU feature flags. + - name: Key the cache to this runner's CPU + id: cpu + run: echo "flags=$(grep -m1 '^flags' /proc/cpuinfo | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" - uses: Swatinem/rust-cache@v2 with: + key: cpu-${{ steps.cpu.outputs.flags }} workspaces: lance-graph/crates/lance-graph-dir-sim-lance - name: clippy run: cargo clippy --manifest-path crates/lance-graph-dir-sim-lance/Cargo.toml --all-targets -- -D warnings diff --git a/.github/workflows/identity.yml b/.github/workflows/identity.yml index 93fd412f1..90dada256 100644 --- a/.github/workflows/identity.yml +++ b/.github/workflows/identity.yml @@ -73,8 +73,16 @@ jobs: persist-credentials: false - name: Setup rust toolchain (pinned by rust-toolchain.toml) run: rustup show + # `.cargo/config.toml` builds with target-cpu=native, and cargo's + # fingerprint sees the flag text, not the CPU: a cached artifact built + # on a runner with AVX-512 would be reused on one without and die with + # SIGILL. Key the cache to this runner's CPU feature flags. + - name: Key the cache to this runner's CPU + id: cpu + run: echo "flags=$(grep -m1 '^flags' /proc/cpuinfo | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" - uses: Swatinem/rust-cache@v2 with: + key: cpu-${{ steps.cpu.outputs.flags }} workspaces: lance-graph/crates/lance-graph-dir-sim - name: Run the simulator's tests run: cargo test --manifest-path crates/lance-graph-dir-sim/Cargo.toml @@ -213,8 +221,16 @@ jobs: persist-credentials: false - name: Setup rust toolchain (pinned by rust-toolchain.toml) run: rustup show + # `.cargo/config.toml` builds with target-cpu=native, and cargo's + # fingerprint sees the flag text, not the CPU: a cached artifact built + # on a runner with AVX-512 would be reused on one without and die with + # SIGILL. Key the cache to this runner's CPU feature flags. + - name: Key the cache to this runner's CPU + id: cpu + run: echo "flags=$(grep -m1 '^flags' /proc/cpuinfo | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" - uses: Swatinem/rust-cache@v2 with: + key: cpu-${{ steps.cpu.outputs.flags }} workspaces: lance-graph/crates/lance-graph-rbac - name: Run the IAM tests run: cargo test --manifest-path crates/lance-graph-rbac/Cargo.toml From 59e124018926a61c143f1da32741c05158ef788a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Oct 2026 05:05:44 +0000 Subject: [PATCH 2/4] ci: resolve target-cpu=native to this runner's CPU before building A step resolves native to the CPU name and exact target-feature list (.github/scripts/resolve-native-rustflags.sh) and sets RUSTFLAGS. Cargo then sees different flag text on a different CPU and recompiles by itself instead of reusing an artifact that dies with SIGILL. The cache key is derived from the same flags, replacing the /proc/cpuinfo hash. Checked locally: the resolved flags give the same cfg as native; the same CPU rebuilds nothing; another CPU's flags rebuild 16 crates of lance-graph-contract; clippy -D warnings passes with them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh --- .cargo/config.toml | 8 +++--- .github/scripts/resolve-native-rustflags.sh | 22 +++++++++++++++ .github/workflows/dir-sim-persist.yml | 15 +++++++---- .github/workflows/identity.yml | 30 ++++++++++++++------- 4 files changed, 57 insertions(+), 18 deletions(-) create mode 100755 .github/scripts/resolve-native-rustflags.sh diff --git a/.cargo/config.toml b/.cargo/config.toml index 7f8a0b32f..00a0c4af5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -39,9 +39,11 @@ # `-C target-cpu=x86-64-v3` (a RUSTFLAGS env REPLACES every cargo-config # rustflags entry). Every other workflow builds with `native`. Cargo # fingerprints the flag TEXT, not the CPU, so a workflow that caches `target/` -# must key the cache to the runner's CPU flags (dir-sim-persist.yml and -# identity.yml do); without that, an artifact built on a runner with AVX-512 -# is reused on one without and dies with SIGILL. Everything else that ships pins x86_64 to v3 without +# resolves `native` to the runner's CPU name and feature list first +# (.github/scripts/resolve-native-rustflags.sh, used by dir-sim-persist.yml and +# identity.yml) and keys the cache to those flags; without that, an artifact +# built on a runner with AVX-512 is reused on one without and dies with SIGILL. +# The same script works locally: RUSTFLAGS="$(.github/scripts/resolve-native-rustflags.sh)". Everything else that ships pins x86_64 to v3 without # touching other architectures: the Dockerfiles that copy this tree replace # this file with config-v3.toml (x86_64-only), the thinking-engine images set # CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS, and `make publish` in diff --git a/.github/scripts/resolve-native-rustflags.sh b/.github/scripts/resolve-native-rustflags.sh new file mode 100755 index 000000000..97bcb5104 --- /dev/null +++ b/.github/scripts/resolve-native-rustflags.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Print RUSTFLAGS equivalent to `.cargo/config.toml`'s `-Ctarget-cpu=native`, +# with `native` resolved to this machine's CPU name and exact feature list. +# +# Why: cargo fingerprints the flag TEXT. `-Ctarget-cpu=native` reads the same +# on every machine, so an artifact built on a CPU with AVX-512 is reused on one +# without and dies with SIGILL. Resolved, the text names the actual features: +# a different CPU gives different flags, and cargo recompiles by itself. +# +# The feature list, not just the CPU name, is what matters: a hypervisor can +# hide features from a CPU that still reports the same model name. +# +# RUSTFLAGS replaces every rustflags entry in .cargo/config.toml. That file +# sets only target-cpu, so nothing else is lost; extra flags given as +# arguments are appended. +set -euo pipefail +cpu=$(rustc --print target-cpus | sed -n 's/.*native.*(currently \([^)]*\)).*/\1/p') +[ -n "$cpu" ] || { echo "resolve-native-rustflags: rustc did not report the native CPU" >&2; exit 1; } +features=$(rustc --print cfg -C target-cpu=native \ + | sed -n 's/^target_feature="\(.*\)"$/+\1/p' | sort | paste -sd, -) +[ -n "$features" ] || { echo "resolve-native-rustflags: no target features reported" >&2; exit 1; } +echo "-Ctarget-cpu=$cpu -Ctarget-feature=$features${*:+ $*}" diff --git a/.github/workflows/dir-sim-persist.yml b/.github/workflows/dir-sim-persist.yml index fae13e688..b9d17da5f 100644 --- a/.github/workflows/dir-sim-persist.yml +++ b/.github/workflows/dir-sim-persist.yml @@ -63,12 +63,17 @@ jobs: - name: Setup rust toolchain (pinned by rust-toolchain.toml) run: rustup show # `.cargo/config.toml` builds with target-cpu=native, and cargo's - # fingerprint sees the flag text, not the CPU: a cached artifact built - # on a runner with AVX-512 would be reused on one without and die with - # SIGILL. Key the cache to this runner's CPU feature flags. - - name: Key the cache to this runner's CPU + # fingerprint sees the flag text, not the CPU: an artifact built on a + # runner with AVX-512 would be reused on one without and die with + # SIGILL. Resolve `native` to this runner's CPU name and feature list: + # a different CPU then gives different flags, cargo recompiles by itself, + # and the cache is keyed to the same flags. + - name: Resolve target-cpu=native for this runner id: cpu - run: echo "flags=$(grep -m1 '^flags' /proc/cpuinfo | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" + run: | + flags=$(.github/scripts/resolve-native-rustflags.sh) + echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" + echo "flags=$(printf %s "$flags" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} diff --git a/.github/workflows/identity.yml b/.github/workflows/identity.yml index 90dada256..6d0cee0a2 100644 --- a/.github/workflows/identity.yml +++ b/.github/workflows/identity.yml @@ -74,12 +74,17 @@ jobs: - name: Setup rust toolchain (pinned by rust-toolchain.toml) run: rustup show # `.cargo/config.toml` builds with target-cpu=native, and cargo's - # fingerprint sees the flag text, not the CPU: a cached artifact built - # on a runner with AVX-512 would be reused on one without and die with - # SIGILL. Key the cache to this runner's CPU feature flags. - - name: Key the cache to this runner's CPU + # fingerprint sees the flag text, not the CPU: an artifact built on a + # runner with AVX-512 would be reused on one without and die with + # SIGILL. Resolve `native` to this runner's CPU name and feature list: + # a different CPU then gives different flags, cargo recompiles by itself, + # and the cache is keyed to the same flags. + - name: Resolve target-cpu=native for this runner id: cpu - run: echo "flags=$(grep -m1 '^flags' /proc/cpuinfo | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" + run: | + flags=$(.github/scripts/resolve-native-rustflags.sh) + echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" + echo "flags=$(printf %s "$flags" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} @@ -222,12 +227,17 @@ jobs: - name: Setup rust toolchain (pinned by rust-toolchain.toml) run: rustup show # `.cargo/config.toml` builds with target-cpu=native, and cargo's - # fingerprint sees the flag text, not the CPU: a cached artifact built - # on a runner with AVX-512 would be reused on one without and die with - # SIGILL. Key the cache to this runner's CPU feature flags. - - name: Key the cache to this runner's CPU + # fingerprint sees the flag text, not the CPU: an artifact built on a + # runner with AVX-512 would be reused on one without and die with + # SIGILL. Resolve `native` to this runner's CPU name and feature list: + # a different CPU then gives different flags, cargo recompiles by itself, + # and the cache is keyed to the same flags. + - name: Resolve target-cpu=native for this runner id: cpu - run: echo "flags=$(grep -m1 '^flags' /proc/cpuinfo | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" + run: | + flags=$(.github/scripts/resolve-native-rustflags.sh) + echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" + echo "flags=$(printf %s "$flags" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} From d30832a99c3273f04644751378f9f32395515328 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Oct 2026 05:10:58 +0000 Subject: [PATCH 3/4] ci: report the resolved CPU in the job summary Each resolve step writes the CPU name and feature hash it resolved native to into $GITHUB_STEP_SUMMARY, so every run shows which runner CPU the job landed on without a tracked list. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh --- .github/workflows/dir-sim-persist.yml | 4 +++- .github/workflows/identity.yml | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dir-sim-persist.yml b/.github/workflows/dir-sim-persist.yml index b9d17da5f..ea4e7e19f 100644 --- a/.github/workflows/dir-sim-persist.yml +++ b/.github/workflows/dir-sim-persist.yml @@ -73,7 +73,9 @@ jobs: run: | flags=$(.github/scripts/resolve-native-rustflags.sh) echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" - echo "flags=$(printf %s "$flags" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" + hash=$(printf %s "$flags" | sha256sum | cut -c1-16) + echo "flags=$hash" >> "$GITHUB_OUTPUT" + echo "native resolved to \`${flags%% *}\` (features $hash) for job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} diff --git a/.github/workflows/identity.yml b/.github/workflows/identity.yml index 6d0cee0a2..c6220f716 100644 --- a/.github/workflows/identity.yml +++ b/.github/workflows/identity.yml @@ -84,7 +84,9 @@ jobs: run: | flags=$(.github/scripts/resolve-native-rustflags.sh) echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" - echo "flags=$(printf %s "$flags" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" + hash=$(printf %s "$flags" | sha256sum | cut -c1-16) + echo "flags=$hash" >> "$GITHUB_OUTPUT" + echo "native resolved to \`${flags%% *}\` (features $hash) for job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} @@ -237,7 +239,9 @@ jobs: run: | flags=$(.github/scripts/resolve-native-rustflags.sh) echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" - echo "flags=$(printf %s "$flags" | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" + hash=$(printf %s "$flags" | sha256sum | cut -c1-16) + echo "flags=$hash" >> "$GITHUB_OUTPUT" + echo "native resolved to \`${flags%% *}\` (features $hash) for job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} From 8342c9fb3511034b5e9152787444fd212f969eb1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Oct 2026 05:23:08 +0000 Subject: [PATCH 4/4] ci: spell native out as a feature list, without a CPU name A named target-cpu enables its model's default features, and a +feature list cannot take them back: rustc --print cfg -Ctarget-cpu=skylake-avx512 -Ctarget-feature=+sse2 still reports avx512f. On a VM that hides AVX-512 from a CPU that keeps its model name, the resolved flags compiled AVX-512 back in, the SIGILL this script exists to prevent. The flags are now the target's baseline CPU plus the exact native feature list, and the script checks that rustc --print cfg under those flags equals the native set, failing otherwise. Disable run: with the CPU name put back (sapphirerapids on this cascadelake host) the check fails and lists the 16 features the name adds. --cpu prints the native CPU name for the job summary. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh --- .cargo/config.toml | 2 +- .github/scripts/resolve-native-rustflags.sh | 46 +++++++++++++++------ .github/workflows/dir-sim-persist.yml | 4 +- .github/workflows/identity.yml | 8 ++-- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 00a0c4af5..ba4523219 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -39,7 +39,7 @@ # `-C target-cpu=x86-64-v3` (a RUSTFLAGS env REPLACES every cargo-config # rustflags entry). Every other workflow builds with `native`. Cargo # fingerprints the flag TEXT, not the CPU, so a workflow that caches `target/` -# resolves `native` to the runner's CPU name and feature list first +# spells `native` out as the runner's exact feature list first # (.github/scripts/resolve-native-rustflags.sh, used by dir-sim-persist.yml and # identity.yml) and keys the cache to those flags; without that, an artifact # built on a runner with AVX-512 is reused on one without and dies with SIGILL. diff --git a/.github/scripts/resolve-native-rustflags.sh b/.github/scripts/resolve-native-rustflags.sh index 97bcb5104..a665ae3c8 100755 --- a/.github/scripts/resolve-native-rustflags.sh +++ b/.github/scripts/resolve-native-rustflags.sh @@ -1,22 +1,44 @@ #!/usr/bin/env bash -# Print RUSTFLAGS equivalent to `.cargo/config.toml`'s `-Ctarget-cpu=native`, -# with `native` resolved to this machine's CPU name and exact feature list. +# Print RUSTFLAGS whose target features equal `.cargo/config.toml`'s +# `-Ctarget-cpu=native` on this machine, spelled out as an explicit list. +# With --cpu, print the name rustc resolves `native` to instead (for logs). # # Why: cargo fingerprints the flag TEXT. `-Ctarget-cpu=native` reads the same # on every machine, so an artifact built on a CPU with AVX-512 is reused on one -# without and dies with SIGILL. Resolved, the text names the actual features: -# a different CPU gives different flags, and cargo recompiles by itself. +# without and dies with SIGILL. Spelled out, the text names the actual +# features: a different CPU gives different flags, and cargo recompiles. # -# The feature list, not just the CPU name, is what matters: a hypervisor can -# hide features from a CPU that still reports the same model name. +# No `-Ctarget-cpu=`: a named CPU enables its model's default features, +# and a `+feature` list cannot take them back. On a VM that hides AVX-512 from +# a CPU still reporting a Skylake-server model, `-Ctarget-cpu=skylake-avx512` +# would compile AVX-512 back in. The target's baseline CPU plus the exact +# native list has no hidden defaults; the cost is tuning, not correctness. +# Features rustc hides on stable (amx, avx10) are not in the list, so they are +# never enabled; native could have enabled them, this cannot. # # RUSTFLAGS replaces every rustflags entry in .cargo/config.toml. That file # sets only target-cpu, so nothing else is lost; extra flags given as # arguments are appended. set -euo pipefail -cpu=$(rustc --print target-cpus | sed -n 's/.*native.*(currently \([^)]*\)).*/\1/p') -[ -n "$cpu" ] || { echo "resolve-native-rustflags: rustc did not report the native CPU" >&2; exit 1; } -features=$(rustc --print cfg -C target-cpu=native \ - | sed -n 's/^target_feature="\(.*\)"$/+\1/p' | sort | paste -sd, -) -[ -n "$features" ] || { echo "resolve-native-rustflags: no target features reported" >&2; exit 1; } -echo "-Ctarget-cpu=$cpu -Ctarget-feature=$features${*:+ $*}" +die() { echo "resolve-native-rustflags: $*" >&2; exit 1; } + +if [ "${1:-}" = "--cpu" ]; then + cpu=$(rustc --print target-cpus | sed -n 's/.*native.*(currently \([^)]*\)).*/\1/p') + [ -n "$cpu" ] || die "rustc did not report the native CPU" + echo "$cpu" + exit 0 +fi + +target_features() { rustc --print cfg "$@" | sed -n 's/^target_feature="\(.*\)"$/\1/p' | sort; } + +native=$(target_features -C target-cpu=native) +[ -n "$native" ] || die "no target features reported" +flags="-Ctarget-feature=$(printf '%s\n' "$native" | sed 's/^/+/' | paste -sd, -)" + +# The point of the script: these flags must enable exactly what native does. +# shellcheck disable=SC2086 +resolved=$(target_features $flags) +[ "$resolved" = "$native" ] || die "flags do not reproduce native: +$(diff <(printf '%s\n' "$native") <(printf '%s\n' "$resolved") || true)" + +echo "$flags${*:+ $*}" diff --git a/.github/workflows/dir-sim-persist.yml b/.github/workflows/dir-sim-persist.yml index ea4e7e19f..89c682181 100644 --- a/.github/workflows/dir-sim-persist.yml +++ b/.github/workflows/dir-sim-persist.yml @@ -65,7 +65,7 @@ jobs: # `.cargo/config.toml` builds with target-cpu=native, and cargo's # fingerprint sees the flag text, not the CPU: an artifact built on a # runner with AVX-512 would be reused on one without and die with - # SIGILL. Resolve `native` to this runner's CPU name and feature list: + # SIGILL. Spell `native` out as this runner's exact feature list: # a different CPU then gives different flags, cargo recompiles by itself, # and the cache is keyed to the same flags. - name: Resolve target-cpu=native for this runner @@ -75,7 +75,7 @@ jobs: echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" hash=$(printf %s "$flags" | sha256sum | cut -c1-16) echo "flags=$hash" >> "$GITHUB_OUTPUT" - echo "native resolved to \`${flags%% *}\` (features $hash) for job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" + echo "native is \`$(.github/scripts/resolve-native-rustflags.sh --cpu)\`, features $hash, job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} diff --git a/.github/workflows/identity.yml b/.github/workflows/identity.yml index c6220f716..04a9465e7 100644 --- a/.github/workflows/identity.yml +++ b/.github/workflows/identity.yml @@ -76,7 +76,7 @@ jobs: # `.cargo/config.toml` builds with target-cpu=native, and cargo's # fingerprint sees the flag text, not the CPU: an artifact built on a # runner with AVX-512 would be reused on one without and die with - # SIGILL. Resolve `native` to this runner's CPU name and feature list: + # SIGILL. Spell `native` out as this runner's exact feature list: # a different CPU then gives different flags, cargo recompiles by itself, # and the cache is keyed to the same flags. - name: Resolve target-cpu=native for this runner @@ -86,7 +86,7 @@ jobs: echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" hash=$(printf %s "$flags" | sha256sum | cut -c1-16) echo "flags=$hash" >> "$GITHUB_OUTPUT" - echo "native resolved to \`${flags%% *}\` (features $hash) for job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" + echo "native is \`$(.github/scripts/resolve-native-rustflags.sh --cpu)\`, features $hash, job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }} @@ -231,7 +231,7 @@ jobs: # `.cargo/config.toml` builds with target-cpu=native, and cargo's # fingerprint sees the flag text, not the CPU: an artifact built on a # runner with AVX-512 would be reused on one without and die with - # SIGILL. Resolve `native` to this runner's CPU name and feature list: + # SIGILL. Spell `native` out as this runner's exact feature list: # a different CPU then gives different flags, cargo recompiles by itself, # and the cache is keyed to the same flags. - name: Resolve target-cpu=native for this runner @@ -241,7 +241,7 @@ jobs: echo "RUSTFLAGS=$flags" >> "$GITHUB_ENV" hash=$(printf %s "$flags" | sha256sum | cut -c1-16) echo "flags=$hash" >> "$GITHUB_OUTPUT" - echo "native resolved to \`${flags%% *}\` (features $hash) for job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" + echo "native is \`$(.github/scripts/resolve-native-rustflags.sh --cpu)\`, features $hash, job \`$GITHUB_JOB\`" >> "$GITHUB_STEP_SUMMARY" - uses: Swatinem/rust-cache@v2 with: key: cpu-${{ steps.cpu.outputs.flags }}