Files
Anees Iqbal ed55748644 Docs: the runtime README, API.md, REPLAY-STREAM.md and VALIDATION.md state each measurement by its card and driver, not by our job id
The planner widened the job-id rule from the published crates' rustdoc to the four prose docs a
reader takes measurements from. Each lab job id (m3-max-NNNN, and the bare job numbers beside
them) and each commit sha comes out; the ids stay in the commit messages that already carry them.
A measurement keeps the card, driver and OS its sentence names. Where an id was the only basis a
sentence named, the sentence now says what was measured and on what:

- the runtime README's identity-domains paragraph cited five plays of recorded streams; it now
  states what the states-only plays of the 26 kept replay streams on lavapipe show: each makes
  every pipeline state its stream makes, and none of their render or compute states is refused,
  a refusal under the identity domains among them (the plays of jobs m3-max-83458, -83494, -83695,
  -83889 and -83954, each printing refused 0);
- the probe lists name the cards ("probes on the RTX 3090, the Iris Xe, lavapipe and the RX 7900
  XTX"; "probes on a Radeon Pro 5300M and a UHD Graphics 630, both macOS 26.7.1");
- sentences that compared runs by id compare them by order ("failed in one run and passed in two
  others"), and "the same job" is "the same run";
- "rt at <sha>" and "players built from <sha>" become what that build was ("a build of the runtime
  that copied a texture over any import"), or go where the card and driver already say it;
- VALIDATION.md's harness count reads "the harness on lavapipe".

Two README tables lose their Job column (the import-cost table and the guest-buffers table). The
edited paragraphs are rewrapped at 100 columns; a token diff against the parent shows only the
ids, the shas, the two columns and the rewordings above.

submit.rs's three citations of two probe commits (06860a3848 and b15b306d2f) become "measured
with a probe build of the runtime" (and, for the split probe, "that timed each command buffer");
the IN_FLIGHT and infos comments are rewrapped at 100 columns.

So it does not grow back, scripts/api-docs first fails when the four docs name a job id
(`m3-max-NNNN`, or `job NNNN`); CONTRIBUTING.md, API.md's description of the script and ci.yml's
comment on its step say so.

docs/CONFORMANCE-COVERAGE.md is unchanged: its generator has no job column. Its 1772 lines with an
id are all in its last section, The ledger, which quotes the last field of known-gaps-rt.tsv; the
ids are in the ledger's own sentences, which the ruling keeps out.

Not widened, per the ruling: the ledger, known-gaps-rt.tsv, results.py, test comments and the
unpublished crates. The OS is not added to measurements whose sentence named a card and driver
but no OS.

Verified on the CPU with no device, job m3-max-84430 at this commit's tree: cargo fmt --check 0;
the workspace's rustdoc with -D warnings 0; scripts/api-docs 0, and 1 with a job id planted in
docs/VALIDATION.md, naming the planted line (the tree clean after its restore); the refusal
surface's --check 0; the 13 tests that read these docs passed (feature_enables, the floor, the
accepted differences, the precision-note catalogue, the consumer's objects and the guide's
example). Before the commit, no line of the four docs matched the check's pattern, and rustfmt
--check passed on submit.rs.
2026-12-03 09:10:35 -08:00

333 lines
18 KiB
YAML

name: CI
on:
push:
branches: [main, master]
pull_request:
env:
CARGO_TERM_COLOR: always
# Fail the job on any rustc warning (unused imports, dead_code, etc.).
RUSTFLAGS: -Dwarnings
jobs:
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Pin major OS images (not *-latest). Labels from actions/runner-images:
# ubuntu-26.04 — Ubuntu 26.04 LTS
# macos-26 — macOS 26 (arm64 GitHub-hosted runner)
os: [ubuntu-26.04, macos-26]
steps:
- uses: actions/checkout@v4
- name: Install Rust
# The dated nightly and components rust-toolchain.toml names.
run: rustup toolchain install
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Install LLVM + SPIR-V tools (Ubuntu)
if: runner.os == 'Linux'
run: |
set -euo pipefail
sudo apt-get update
# llvm: llvm-dis; spirv-tools: spirv-val + the product passthrough path's spirv-as.
# libvulkan1 is the loader alone: this host has no Vulkan driver, and the steps that run
# on one (lavapipe) run in the lavapipe image below.
sudo apt-get install -y llvm spirv-tools libvulkan1
command -v llvm-dis
command -v spirv-val
command -v spirv-as
# Ubuntu's llvm is the oldest LLVM the committed `.ll` fixtures are written for:
# here the validation test that each assembles with it must run, not skip.
echo "METAL2VULKAN_TEST_REQUIRE_PINNED_LLVM=1" >> "$GITHUB_ENV"
- name: Install LLVM + SPIR-V tools (macOS)
if: runner.os == 'macOS'
run: |
set -euo pipefail
brew install llvm spirv-tools
# llvm is keg-only: not linked into /opt/homebrew/bin. GITHUB_PATH only
# affects *later* steps, so export PATH here before command -v probes.
export PATH="/opt/homebrew/opt/llvm/bin:/usr/local/opt/llvm/bin:${PATH}"
echo "/opt/homebrew/opt/llvm/bin" >> "$GITHUB_PATH"
echo "/usr/local/opt/llvm/bin" >> "$GITHUB_PATH"
echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
command -v llvm-dis
command -v spirv-val
command -v spirv-as
- name: Format
run: cargo fmt --all -- --check
# clippy --all-targets --all-features typechecks the workspace INCLUDING the
# `cli` and `serde` cfgs the shipped CLI is built with; without it, the binary and the code
# and tests behind `#[cfg(feature = "serde")]` are never compiled by any gate.
- name: Clippy (warnings denied)
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
# The product with no feature and with each feature alone, as a consumer of the published crate
# may build it. `--all-features` compiles every gated item, but an import or item that only
# another feature (or only a test) uses is unused, or missing, without it; `--workspace`
# cannot check that either, since the validation member enables most features for every
# build. Feature gates combine with platform cfgs, so both hosts run it.
- name: Clippy under each feature alone (warnings denied)
run: |
set -euo pipefail
for features in "" serde ash cli; do
echo "::group::features=${features:-none}"
cargo clippy -p metal2vulkan --all-targets --no-default-features --features "$features" -- -D warnings
echo "::endgroup::"
done
# The AIR front end's crate as a consumer of `metal2vulkan-air` builds it
# alone, with no feature and with `serde`, so nothing the translator or
# validation enables in a workspace build hides an unused import or a missing item.
for features in "" serde; do
echo "::group::metal2vulkan-air features=${features:-none}"
cargo clippy -p metal2vulkan-air --all-targets --no-default-features --features "$features" -- -D warnings
echo "::endgroup::"
done
# Validation's device tests, and the helpers only they call, compile only under `--cfg m2v_gpu`
# or `--cfg m2v_cpu_icd` (docs/VALIDATION.md). Clippy under `m2v_gpu` checks that code on each
# host without opening a device: on macOS with the Metal tests, and on Linux without them,
# where a helper compiled without its callers is dead code. Its own target directory keeps the
# ordinary build's warm.
- name: Clippy under --cfg m2v_gpu (warnings denied)
env:
RUSTFLAGS: -Dwarnings --cfg m2v_gpu
CARGO_TARGET_DIR: target/gpucfg
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
# The published crates (and devtools, which their tests use) and the conformance suite, which
# the Windows host replays, for Windows, checked from Linux: clippy links nothing, so neither
# target needs a Windows SDK or linker. gnullvm is the primary Windows target, msvc the second.
- name: Clippy for Windows (warnings denied, Linux)
if: runner.os == 'Linux'
run: |
set -euo pipefail
rustup target add x86_64-pc-windows-gnullvm x86_64-pc-windows-msvc
for target in x86_64-pc-windows-gnullvm x86_64-pc-windows-msvc; do
echo "::group::$target"
cargo clippy --target "$target" -p metal2vulkan-air -p metal2vulkan -p metal2vulkan-runtime -p metal2vulkan-devtools -p metal2vulkan-conformance --all-targets --all-features -- -D warnings
echo "::endgroup::"
done
# rt's documentation for both Windows targets, from Linux as above: a doc link to an item
# only one host has (a Unix host's dma-buf import, Windows' Direct3D 11 import) is
# unresolved on the other host.
- name: Build rt's documentation for Windows (warnings denied, Linux)
if: runner.os == 'Linux'
env:
RUSTDOCFLAGS: -Dwarnings
run: |
set -euo pipefail
for target in x86_64-pc-windows-gnullvm x86_64-pc-windows-msvc; do
echo "::group::$target"
cargo doc --target "$target" -p metal2vulkan-runtime --all-features --no-deps
echo "::endgroup::"
done
- name: Build public documentation (warnings denied)
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --workspace --all-features --no-deps
# The consumer reference of the new API's frozen surface: the library's
# rustdoc build, warnings denied, and no link to a hidden item; first, no lab
# job id in the prose docs.
- name: Build the new API's consumer reference (warnings denied)
run: scripts/api-docs
# A doc comment on a private item, and a link to a private path, are rendered only when
# rustdoc documents private items, which the documentation steps above never do: each
# renders the public surface alone. Their intra-doc links are therefore checked nowhere else
# here, and a broken one has only ever surfaced when someone passed
# `--document-private-items` by hand. This
# step runs that pass over each crate and holds the crate to the number of diagnostics it
# still carries, so a newly broken private link is red here instead. Each number is a
# backlog to drive to zero, never a budget: a commit that fixes some lowers its crate's
# number in the same commit, and a crate that reaches 0 stays at 0.
- name: Private intra-doc links (no new breakage)
env:
RUSTDOCFLAGS: -Dwarnings
# The count below reads lines that begin `error: `. Under the workflow's
# CARGO_TERM_COLOR=always each one begins with a colour code instead, so it counted none.
CARGO_TERM_COLOR: never
run: |
set -euo pipefail
log="$RUNNER_TEMP/private-doc-links.log"
status=0
for row in \
metal2vulkan=0 \
metal2vulkan-air=0 \
metal2vulkan-runtime=0 \
metal2vulkan-validation=0 \
metal2vulkan-conformance=0 \
metal2vulkan-devtools=0 \
metal2vulkan-harness=0
do
crate=${row%=*}
ceiling=${row#*=}
cargo doc -p "$crate" --all-features --no-deps --document-private-items \
> "$log" 2>&1 || true
# Under `-Dwarnings` each diagnostic is an `error: ` line, and the last one is
# rustdoc's own "could not document <crate>" summary rather than a diagnostic.
lines=$(grep -c '^error: ' "$log" || true)
summary=$(grep -c '^error: could not document' "$log" || true)
n=$((lines - summary))
echo "$crate: $n (ceiling $ceiling)"
if [ "$n" -gt "$ceiling" ]; then
cat "$log"
echo "::error::$crate reports $n private intra-doc link diagnostics, over its ceiling of $ceiling"
status=1
elif [ "$n" -lt "$ceiling" ]; then
echo "::notice::$crate reports $n, under its ceiling of $ceiling: lower it in this file"
fi
done
rm -f "$log"
exit "$status"
# The published crates as crates.io takes them: each packages, and its package
# builds alone against the others' packages, so none reads a file outside its own directory.
# Validation and the dev-tools crate are not published.
- name: Package the published crates
run: cargo package --workspace --exclude metal2vulkan-validation --exclude metal2vulkan-conformance --exclude metal2vulkan-devtools --exclude metal2vulkan-harness
# With the AIR front end's crate's own tests, and the dev-tools crate's:
# its tool runner and L3 checks. Every suite here runs to its end (--no-fail-fast), so one
# red test does not hide the tests after it; the step's verdict is the same.
- name: Test metal2vulkan
run: cargo nextest run --no-fail-fast -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-runtime -p metal2vulkan-devtools -p metal2vulkan-harness --all-features
# GPU-free on every host: tests that open a device compile only under `--cfg m2v_gpu` or
# `--cfg m2v_cpu_icd`, and no device-opening code runs without one of them.
- name: Test validation suite
run: cargo nextest run --no-fail-fast -p metal2vulkan-validation --all-features
# The conformance suite's own machinery, with no device: a stub side stands in for a GPU, so
# the transcript, the comparison, the justification rule, the verdicts, the recordings'
# staleness and the report are all checked on every host.
- name: Test the conformance suite
run: cargo nextest run --no-fail-fast -p metal2vulkan-conformance --all-features
# nextest does not run doctests.
- name: Doc tests
run: cargo test --workspace --all-features --doc
# The steps below that execute on a device run on lavapipe in the lavapipe image, and
# nowhere else: Arch Linux's packages of one Arch Linux Archive date, which
# scripts/lavapipe-image/pin pins with the bootstrap tarball's sha256, carrying the Mesa and
# LLVM the conformance ledger's llvmpipe rows hold on (its `# llvmpipe:` line). The image's
# downloads are cached keyed on the pin (its tarball's sha256, its date and its packages'
# versions), and saved as soon as the build has them, so a run whose pin has not moved
# downloads nothing, whatever the later steps answer.
- name: Restore the lavapipe image's downloads (Linux)
if: runner.os == 'Linux'
id: lavapipe-downloads
uses: actions/cache/restore@v4
with:
path: ~/.cache/m2v-lavapipe-image
key: lavapipe-image-${{ hashFiles('scripts/lavapipe-image/pin') }}
# Prints the image's pin, its packages, its device's name and driver, and whether its
# containers get /dev/udmabuf, and fails where the image differs from the pin or from the
# ledger's `# llvmpipe:` line. A fetch that fails ends this step with the URL it failed on,
# before any test runs. The limit fits a cold fetch at the slowest rate measured from the
# archive, one connection at 57 KB/s: the 127 MB tarball and 135 MB of databases and
# packages, 262 MB, take 77 minutes there.
- name: Build the lavapipe image (Linux)
if: runner.os == 'Linux'
timeout-minutes: 90
run: scripts/lavapipe-image/lavapipe-image ensure
- name: Save the lavapipe image's downloads (Linux)
if: runner.os == 'Linux' && steps.lavapipe-downloads.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/.cache/m2v-lavapipe-image
key: lavapipe-image-${{ hashFiles('scripts/lavapipe-image/pin') }}
# The device tests of validation and the runtime, and the runtime's floor check, on lavapipe.
# They are the tests the `--cfg m2v_cpu_icd` build holds and the plain builds above do not: a
# test that opens a device compiles only under that cfg. The plain builds' tests ran on this
# host above, the `.ll` fixtures' test with Ubuntu's LLVM among them. The tests are built
# here, on the host, and only run in the image. Where its containers get no /dev/udmabuf,
# the tests scripts/lavapipe-image/needs-udmabuf names are skipped, each named in the log. `DeviceType::Cpu` matches only a CPU physical
# device, and the runtime's device tests under `m2v_cpu_icd` check only CPU devices. macOS CI
# runs no device tests.
- name: Test validation suite and the runtime on the CPU Vulkan ICD (Linux)
if: runner.os == 'Linux'
run: |
set -euo pipefail
out=$RUNNER_TEMP/cpu-icd
mkdir -p "$out"
cargo nextest list -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-runtime -p metal2vulkan-devtools -p metal2vulkan-harness --all-features --message-format json > "$out/plain-1.json"
cargo nextest list -p metal2vulkan-validation --all-features --message-format json > "$out/plain-2.json"
export RUSTFLAGS='-Dwarnings --cfg m2v_cpu_icd'
cargo nextest list -p metal2vulkan-validation -p metal2vulkan-runtime --all-features --message-format json > "$out/cpu-icd.json"
cargo nextest archive -p metal2vulkan-validation -p metal2vulkan-runtime --all-features --archive-file "$out/cpu-icd.tar.zst"
python3 -I scripts/lavapipe-image/only_in.py "$out/cpu-icd.json" "$out/plain-1.json" "$out/plain-2.json" > "$out/device-tests"
echo "$(wc -l < "$out/device-tests") device tests"
scripts/lavapipe-image/lavapipe-image nextest "$out/cpu-icd.tar.zst" "$out/device-tests" --no-fail-fast
# The runtime's device tests again, the step above's archive, with llvmpipe at 128-bit vectors
# (LP_NATIVE_VECTOR_WIDTH=128): the width arm64 lavapipe runs at, where a fragment or compute
# subgroup is 4 lanes. The leg's Mesa shader cache is a directory of its own in the workspace:
# llvmpipe keys its disk cache without the vector width (Mesa 26.2.4), so a cache it shared
# with a 256-bit run would hand a 128-bit shader a 256-bit texture function. vulkaninfo's
# device name and subgroup sizes are printed first, and the step fails unless they show 128
# bits and subgroups of 4.
- name: Test the runtime on the CPU Vulkan ICD at 128-bit vectors (Linux)
if: runner.os == 'Linux'
run: |
set -euo pipefail
out=$RUNNER_TEMP/cpu-icd
cache=$PWD/target/mesa-shader-cache-128
mkdir -p "$cache"
scripts/lavapipe-image/lavapipe-image run --env LP_NATIVE_VECTOR_WIDTH=128 -- vulkaninfo > "$out/vulkaninfo-128.txt"
grep -E 'deviceName|subgroupSize|minSubgroupSize|maxSubgroupSize' "$out/vulkaninfo-128.txt" | sort -u
grep -q 'deviceName *= llvmpipe .*128 bits' "$out/vulkaninfo-128.txt"
grep -Eq 'maxSubgroupSize *= 4$' "$out/vulkaninfo-128.txt"
grep '^binary_id(=metal2vulkan-runtime[):]' "$out/device-tests" > "$out/device-tests-runtime"
echo "$(wc -l < "$out/device-tests-runtime") runtime device tests at 128-bit vectors"
scripts/lavapipe-image/lavapipe-image nextest --write "$cache" --env LP_NATIVE_VECTOR_WIDTH=128 \
--env MESA_SHADER_CACHE_DIR="$cache" "$out/cpu-icd.tar.zst" "$out/device-tests-runtime" --no-fail-fast
# The conformance suite's replay leg on lavapipe, in the image: it reads the committed
# recordings, runs the runtime side and compares, with no Metal present. Its exit status is 0
# only where the run holds no surprise: no unrecorded case, no stale recording, and exactly
# the gaps crates/metal2vulkan-conformance/known-gaps-rt.tsv expects on this venue. A refusal
# or a divergence that ledger does not list fails here, and so does a row it lists that the
# run no longer holds, so closing a gap forces the ledger edit. A venue that lacks a feature
# a case needs does not spoil it. Where the image's containers get no /dev/udmabuf, the
# cases scripts/lavapipe-image/needs-udmabuf names are left out, each named in the log.
- name: Replay the conformance suite on the CPU Vulkan ICD (Linux)
if: runner.os == 'Linux'
run: |
set -euo pipefail
cargo build -p metal2vulkan-conformance --bin conformance
scripts/lavapipe-image/lavapipe-image replay target/debug/conformance
# Machine-specific semantic qualification remains explicit. On lavapipe in the image, it
# executes the owned public cases with the engine, in both robustness legs, against their
# exact committed Metal observations without a physical GPU. Rows written here (in the
# corpus, the one directory the image may write) are ephemeral CI evidence, not committed
# environment slots (see the script's header).
- name: Qualify public cases on native Vulkan (Linux)
if: runner.os == 'Linux'
run: |
set -euo pipefail
cargo build -p metal2vulkan-validation --bins
scripts/lavapipe-image/lavapipe-image run --write crates/metal2vulkan-validation/corpus -- bash scripts/qualify-public-cases target/debug