open-standards/.github/workflows/wai-quantum-metal.yml
Transaction Science 6517401f01 CI: the gate that decides whether a workflow runs was queued behind the work it gates
Every path-gated workflow begins with one small job -- `does this change touch
it`, or `which workspaces this change touches` for the standards build -- that
all of its real jobs declare in `needs`. All 55 of those gate jobs ran on
`linux-arm64`.

That is the one label the fleet cannot spare. Sampled while 267 runs were
queued, every waiting run had the same shape:

    [waiting]  linux-arm64    does this change touch it
    [blocked]  linux          member · dataflow device, simulated
    [blocked]  macos          member · dataflow device absent

237 runs, each holding a gate in the longest queue, and every real job blocked
behind it. Not only `linux` jobs: `macos`, `linux-hw`, `linux-arm64-hw` and
`macos-m3-ultra` jobs were blocked too. The measured effect was `linux-arm64`
263 deep against `linux` **zero**, with jetson-hub's 20 cores taking no job for
a full hour -- starved not for want of work but because the work could not be
unblocked. A gate waiting on the resource it is rationing is head-of-line
blocking, and it makes every other runner in the fleet idle on its behalf.

The gates move to `linux`. Nothing else changes: the diff is 55 `runs-on` lines
and no others, and every touched file still parses.

Why `linux` and not elsewhere. The gate is not free -- it compares
`BASE...HEAD`, which needs the merge base, so `fetch-depth: 0` is a full clone
rather than a ten-second script. `macos` is served by hosts on a Mac Studio
sitting at load 185; `linux` is a separate 20-core box that was measurably
empty. This moves a serialisation point to the least contended label; it does
not remove it, and the gate is still a single point of failure for its
workflow. The structural fix is an early-exit first step inside each job, which
costs one checkout per leg and is a larger change.

Follow-up, deliberately not bundled: jetson-hub runs at capacity 2 with 15 GB of
RAM, so 55 clones still serialise two at a time. Raising capacity helps gates
and hurts the heavy emulated-architecture jobs that share the label, so it wants
measuring on its own.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-11-03 15:19:13 -05:00

157 lines
9 KiB
YAML

name: wai-quantum Metal member
# The fabric's Metal member: the gate kernels in the Metal shading language,
# compiled at run time by the operating system's own compiler for the device,
# and certified bit-exact against the CPU reference's pinned corpus digests.
#
# - metal-hw (the macOS runner's GPU): the device tests must find exactly the
# declared device, agree with the CPU on the arithmetic probe and on random
# states (out-of-range runs included), reproduce all four pinned certificates
# (two gatesets, random-v1 and fabric-v1), and catch every kernel mutant; and
# the matrix kernel, every product formed by the GPU's SIMD-group matrix
# multiply from 8-bit limbs, must do all of the same under its own
# implementation id, with its own mutants caught; and so must the
# tensor-operation kernel, every product formed by the shading language's
# tensor operation from offset-binary 8-bit limbs.
# - metal-absent (a container with no Metal): the same build finds no member
# and says why, rather than failing; the device tests run over no member with
# the declaration `none`.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths:
- 'wai/wai-quantum/**'
- 'rust-toolchain.toml'
- '.github/workflows/wai-quantum-metal.yml'
schedule:
- cron: '56 7 * * *'
jobs:
relevant:
name: does this change touch it
runs-on: linux
outputs:
run: ${{ steps.gate.outputs.run }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- id: gate
run: |
set -euo pipefail
r=$(python3 scripts/pr-touches-paths.py .github/workflows/wai-quantum-metal.yml \
"${{ github.event.pull_request.base.sha }}" \
"${{ github.event.pull_request.head.sha }}")
echo "this change touches wai-quantum-metal: $r"
echo "run=$r" >> "$GITHUB_OUTPUT"
metal-hw:
name: member · Metal (macos)
needs: relevant
if: needs.relevant.outputs.run == 'true'
# The pins are the Mac Studio's GPU (gpu-msl-1009). The fleet's other macOS runners
# (an M4 Max and an M5 Max) have other GPUs, so this member runs on the Studio by its
# own label; a member for theirs is declared from a run on them.
runs-on: macos-m3-ultra
timeout-minutes: 90
env:
WAI_QUANTUM_METAL_EXPECT: gpu-msl-1009
steps:
- uses: actions/checkout@v5
# launchd's PATH omits cargo on the macOS host runner.
- name: Put cargo on PATH
shell: bash
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: The member's unit tests
shell: bash
working-directory: wai/wai-quantum
run: |
set -euo pipefail
nice -n 10 cargo test --locked --features quantum_fabric_metal --lib -- quantum_fabric_metal:: quantum_fabric::metal:: 2>&1 | tee "$RUNNER_TEMP/unit.log"
grep -qE '^test result: ok\. [1-9][0-9]* passed; 0 failed' "$RUNNER_TEMP/unit.log" || { echo "::error::no unit test ran"; exit 1; }
- name: The member's device tests
shell: bash
working-directory: wai/wai-quantum
run: |
set -euo pipefail
report="$RUNNER_TEMP/metal-report.txt"; : > "$report"
WAI_QUANTUM_METAL_REPORT="$report" nice -n 10 \
cargo test --locked --release --features quantum_fabric_metal --test metal_member -- --test-threads=1 2>&1 | tee "$RUNNER_TEMP/device.log"
grep -qE '^test result: ok\. 9 passed; 0 failed' "$RUNNER_TEMP/device.log" || { echo "::error::not every device test ran and passed"; exit 1; }
cat "$report"
key="$WAI_QUANTUM_METAL_EXPECT"
grep -qx "metal devices: as declared ($key)" "$report" || { echo "::error::the devices found are not the declared ones"; exit 1; }
n="$(grep -c "^metal certified: key=$key .* implementation=metal-lanes64/[0-9a-f]\{16\} parity=bit-exact " "$report")"
[ "$n" = 4 ] || { echo "::error::$n of 4 certificates were earned"; exit 1; }
grep -qx "metal mutants: key=$key killed 6 of 6" "$report" || { echo "::error::a kernel mutant survived"; exit 1; }
- name: The matrix kernel, every product by the SIMD-group matrix multiply
shell: bash
working-directory: wai/wai-quantum
run: |
set -euo pipefail
report="$RUNNER_TEMP/metal-matrix-report.txt"; : > "$report"
WAI_QUANTUM_METAL_REPORT="$report" nice -n 10 \
cargo test --locked --release --features quantum_fabric_metal --test metal_matrix -- --test-threads=1 2>&1 | tee "$RUNNER_TEMP/matrix.log"
grep -qE '^test result: ok\. 9 passed; 0 failed' "$RUNNER_TEMP/matrix.log" || { echo "::error::not every matrix test ran and passed"; exit 1; }
cat "$report"
key="$WAI_QUANTUM_METAL_EXPECT"
grep -qx "metal matrix devices: as declared ($key)" "$report" || { echo "::error::the devices found are not the declared ones"; exit 1; }
grep -q "^metal matrix member: key=$key .* implementation=metal-matrix-limbs8/[0-9a-f]\{16\} " "$report" || { echo "::error::the device ran no matrix member"; exit 1; }
n="$(grep -c "^metal matrix certified: key=$key .* implementation=metal-matrix-limbs8/[0-9a-f]\{16\} parity=bit-exact " "$report")"
[ "$n" = 4 ] || { echo "::error::$n of 4 matrix certificates were earned"; exit 1; }
grep -qx "metal matrix mutants: key=$key killed 7 of 7" "$report" || { echo "::error::a matrix mutant survived"; exit 1; }
- name: The tensor-operation kernel, every product by the tensor operation
shell: bash
working-directory: wai/wai-quantum
run: |
set -euo pipefail
report="$RUNNER_TEMP/metal-tensor-ops-report.txt"; : > "$report"
WAI_QUANTUM_METAL_REPORT="$report" nice -n 10 \
cargo test --locked --release --features quantum_fabric_metal --test metal_tensor_ops -- --test-threads=1 2>&1 | tee "$RUNNER_TEMP/tensor-ops.log"
grep -qE '^test result: ok\. 9 passed; 0 failed' "$RUNNER_TEMP/tensor-ops.log" || { echo "::error::not every tensor-operation test ran and passed"; exit 1; }
cat "$report"
key="$WAI_QUANTUM_METAL_EXPECT"
grep -qx "metal tensor-ops devices: as declared ($key)" "$report" || { echo "::error::the devices found are not the declared ones"; exit 1; }
grep -q "^metal tensor-ops member: key=$key .* implementation=metal-tensor-ops-limbs8/[0-9a-f]\{16\} " "$report" || { echo "::error::the device ran no tensor-operation member"; exit 1; }
n="$(grep -c "^metal tensor-ops certified: key=$key .* implementation=metal-tensor-ops-limbs8/[0-9a-f]\{16\} parity=bit-exact " "$report")"
[ "$n" = 4 ] || { echo "::error::$n of 4 tensor-operation certificates were earned"; exit 1; }
grep -qx "metal tensor-ops mutants: key=$key killed 8 of 8" "$report" || { echo "::error::a tensor-operation mutant survived"; exit 1; }
metal-absent:
name: member · Metal absent (linux)
needs: relevant
if: needs.relevant.outputs.run == 'true'
runs-on: linux
timeout-minutes: 60
env:
WAI_QUANTUM_METAL_EXPECT: none
steps:
- uses: actions/checkout@v5
- name: Install Rust 1.98.0
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
command -v rustup >/dev/null 2>&1 || \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.98.0
rustup toolchain install 1.98.0 --profile minimal
rustup default 1.98.0
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: No Metal here, and the member says so
shell: bash
working-directory: wai/wai-quantum
run: |
set -euo pipefail
cargo test --locked --features quantum_fabric_metal --lib -- quantum_fabric_metal:: quantum_fabric::metal:: 2>&1 | tee "$RUNNER_TEMP/unit.log"
grep -qE '^test quantum_fabric_metal::tests::off_macos_nothing_is_found_and_discovery_says_why \.\.\. ok$' "$RUNNER_TEMP/unit.log" || { echo "::error::the off-platform discovery test did not run"; exit 1; }
report="$RUNNER_TEMP/metal-report.txt"; : > "$report"
for t in metal_member metal_matrix metal_tensor_ops; do
WAI_QUANTUM_METAL_REPORT="$report" cargo test --locked --features quantum_fabric_metal --test "$t" -- --test-threads=1 2>&1 | tee "$RUNNER_TEMP/$t.log"
grep -qE '^test result: ok\. 9 passed; 0 failed' "$RUNNER_TEMP/$t.log" || { echo "::error::$t did not run over no device"; exit 1; }
done
grep -qx 'metal devices: as declared (none)' "$report" || { echo "::error::the absent case was not established"; exit 1; }
grep -qx 'metal matrix devices: as declared (none)' "$report" || { echo "::error::the matrix absent case was not established"; exit 1; }
grep -qx 'metal tensor-ops devices: as declared (none)' "$report" || { echo "::error::the tensor-operation absent case was not established"; exit 1; }