One work packet, landed as 10 commits (262093ec48..8e4bfa28b4 on archive/development-linear-2026-10-28), in order: * Describe each driver deviation's route as the code takes it now The DriverDeviation, VkProperty and driver-table docs still named the exact emulations the native-arithmetic change sets deleted (Metal's libm, division, denormal flushing, NaN selection, min/max picks, the emulated sampler, the color, storage and Depth16 write roundings, the depth stand-in). Each variant's doc now says what a profile that takes it gets and what one without it gets: the device's own answer with the precision note recorded, or, where a capability hangs on the answer, its emulation or refusal. - error/mod.rs: DriverDeviation's header and the float-function, NaN, sampler, color-write, FMA, denormal, quantize, min/max, half arithmetic, storage-write, texel-write and Depth16 variants. - device/requirements.rs: the matching VkProperty docs; MetalColorWrites says no module requires it (compile.rs never adds it), and MetalHalfQuantize drops the clamp claim the code does not make. - device/driver_facts.rs: the table preambles and measurement paragraphs (docs and citations only, no row or variant changed); the deleted resolve_rounding::color_resolves_against_metals_rules citation now names the_device_resolve_rounds_as_announced, which holds the row. - runtime_lane/heap_textures.rs: heap_depth_textures_keep_their_bytes, renamed from ..._with_their_twins (no twin exists), with the two driver_facts.rs citations updated. - lower/texture/mod.rs and pipeline/compile.rs: the storage_properties doc and comment list the four properties select_write relies on, dropping the 0x7fc00000 store. Verified by reading each route in lower/ (narrow, fma, denormal, nan, arith, sampler, stage_io/color_write, texture) and pipeline/compile.rs, and by git grep for every cited test and item. * Describe the pixel samplers, routines and color-write inputs as they run now Translator docs that still described the deleted emulated sampler, the cube face fold routine, the compiler-word-bound fit and the shader's own color-write rounding: - pipeline/artifact.rs: PixelSamplerScaling no longer names a linear sample's emulation or a MetalSampler condition; a runtime word's linear pixel sample snaps onto its footprint cell on every device (position::plan plans SnapKind::WordCell with no device test), a word of mixed filters is the device's. ArgumentPixelSamplerScaling says it is recorded on every device for any access but a 2D gather and a sample without a comparison, as select.rs pixel_note does. - lower/sampler/select.rs (pixel_note) and lower/sampler/mod.rs (RuntimeSlot::cells, ::texels): the cell snap holds on every device; the slot's word filter fields are read for a half texel's conversion alone, on a MetalSampler device (half_converts requires !device_texels). - device/profile.rs: FunctionsInlinedAtEveryCall lists the routines that exist (wide-integer divisions, precise fmod, texel conversions, filter sums, sampling routines; no face fold); takes_driver_deviation names the route a deviation's docs give for a driver without it. - error/mod.rs: RuntimeInput::ColorWrites says what the color-write map decides (the conversion that records a note, and NearestEven's half rounding), not a rounding of every output. - bind/color_resolve.rs and its tests: drop the citation of resolve_rounding's cost test, which is deleted. - device/mechanism.rs: drop the trailing comment on the deleted ExactFormsOverCompilerLimit fact. Verified by reading position::plan, select.rs pixel_note and the half_converts branch, spirv/builder/module.rs's routine kinds and every mb.routine site, pipeline/color_writes.rs, and git grep for each cited item. * Describe texel conversion, YCbCr filtering and depth comparison as the device's Translator docs still named the deleted linear-filter emulation, the shader's own depth comparison and the depth twin: - lower/texture/half.rs: off MetalSampler devices the device's sampler filters and the half is its float texel rounded to nearest even (device_texels), not this routine's; the only fetch-computed filter that skips the routine is the in-place YCbCr one. - lower/texture/mod.rs (half_texels): drop the example of a runtime sampler's sRGB raw-code emulation for the `arm` clauses. - metal/format/mod.rs: a two-plane YCbCr texture's linear sample is the device's filter, noted, but where its planes are read in place. - pipeline/artifact.rs (RestrictedDepthRange) and lower/texture/slot.rs (depth_comparison): every comparison is the device's; no shader-made comparison is left to exclude. - lower/sampler/select.rs: a depth comparison reads the texture's own depth image (no twin). - lower/sampler/mod.rs (Sampling::words): list the terms plain_words sums; no linear emulation, level grid or shader comparison term exists. Verified by reading device_texels, half_texels and both its callers, linear.rs filter_note and metal_filtered_ycbcr, depth_comparison's one caller, in_place.rs, and plain_words. * Describe the runtime's YCbCr filter notice and variant kinds as they fire now - degradation.rs: YCbCrFilterNotExact fires on a device that samples through Metal's own sampler alone (linear.rs metal_filtered_ycbcr is None elsewhere), where the stage records HalfSampleFilter or FloatSampleFilter for any two-plane YCbCr format bound; a native sampler announces device-sampling. The module doc drops the exact forms dropped to fit a compiler word bound, whose kind and fit are deleted. - ycbcr.rs: linear filtering of the converted texels is the device sampler's (Metal's own on MoltenVK, announced ycbcr-filter-not-exact); only planes read in place are Metal's filter exactly. Verified by reading lower/sampler/linear.rs, in_place.rs and the runtime's Kinds::of and degrade_bound_formats. * Describe the lanes' and cases' native forms where they named deleted emulations Docs and comments only; no expectation changed. - validation runtime_lane/driver_deviations.rs: the half quantize, min/max, half arithmetic and half widening bullets say what the module does off the deviation (the device's own conversion or quantize, the same NMin/NMax/NClamp noted native-min-max, narrow::from_bits' decode), not the deleted integer rounding, operand picks and exact_answers decode. - validation observation_contract/comparison.rs: HalfSampleFilter and FloatSampleFilter are a YCbCr texture through Metal's own sampler. - validation runtime_lane/pixel_samplers.rs, conformance cases/pixel_samplers.rs: the pixel coordinates reach Metal's texels through the translator's snaps, filtered by the device's sampler. - conformance cases/snorm_tile_store.rs: no exact tile store and no FAST-PATHS row; only extended-range, padded and bfloat attachments take a load pass. Verified by reading the lanes' assertions, select.rs pixel_note, position::plan and narrow.rs. * State the native forms in the doc pages where they promised exact switches - README.md: the promise that every speed-for-accuracy choice has an opt-in exact switch was false for the device's maths, rounding, conversions and sampler, which have none; it now says those are the device's, recorded, and the runtime's choices keep their switches. - docs/API.md: exact_answers selects the runtime's five switches (as policy.rs's exact_answers sets them), not exact forms of the native arithmetic; an unmeasured driver takes each deviation's documented route, not a conservative one; half widening's NaN and denormal are the device's under its own conversion or the float controls; Depth32Float texels are the depth image's, announced where it clamps or flushes; the catalogue intro names the native forms. - docs/ARCHITECTURE.md: the native forms are the device's on every device with no policy choice; the policy's accuracy switches are the runtime's. - docs/FAST-PATHS.md (after the opening section): a YCbCr texture's image form holds Metal's texels exactly and its linear sample is the device's filter; only the in-place form is Metal's filter. Verified against device/policy.rs, lower/arith/narrow.rs, the depth twin's deletion (c11e653acd) and lower/sampler/linear.rs. * Drop the exact golden table from VALIDATION.md's emitter-stability contract 4bf2c22aad deleted golden_hashes_exact.tsv and its table in golden_hashes.rs; VALIDATION.md still described a second table of every sampling fixture under exact_answers. The contract now names the one table. Verified: crates/metal2vulkan/tests/ holds golden_hashes.tsv alone, and golden_hashes.rs names no exact table. * Re-pin the runtime sources after the doc audit The audit's commits edit doc comments and comments only in files the runtime guard hashes (degradation.rs, ycbcr.rs, and translator files the build lists); no run's behaviour changes, so RUNTIME_VERSION stays. Verified: the_runtime_sources_are_the_committed_ones failed with 81ebd500 committed against 8bc0e06b computed, and passes after this pin. * Drop the 0x7fc00000 hand-off from half_write_nans_converted's doc a6e97e7f93 deleted the NaN canonicalization before storage writes (StorageImageClass::SmallFloatQuietNan among it): a half write to a packed small float hands the device the half widened, as to a 16-bit float channel. The doc still said such a write hands it 0x7fc00000, and tied MetalHalfTexelWrites to both kinds, where it states the 16-bit float store alone (lower/texture/mod.rs half_write_nans). Verified by reading half_write_nans and the write emission (lower/texture/emit.rs), which canonicalizes no small-float NaN. * Re-pin the runtime sources after the half-write NaN doc fix metal/format/mod.rs is a runtime guard input; the preceding commit edits a doc comment there alone, so no run's behaviour changes and RUNTIME_VERSION stays. Verified: the_runtime_sources_are_the_committed_ones failed with 8bc0e06b committed against 279b25d4 computed, and passes after this pin.
25 KiB
Validation
How to check that the translator and the runtime give Metal's answers. Two contracts are kept apart:
- Emitter stability: the SPIR-V the translator emits for owned fixtures does not change unless the change means it to (the golden output hashes).
- Semantic correctness: an authored case gives the same observations on Vulkan as on Metal.
A valid SPIR-V module proves neither. Choose the smallest route that proves the claim:
| Claim | Starting point |
|---|---|
| An ordinary code change | The gate below |
| A behavior-preserving translator change | The gate, and unchanged golden output hashes |
| An intentional change of output | A synthetic regression test, the reviewed golden drift (and a SEMANTICS_VERSION bump), and the affected authored cases rerun on Metal and Vulkan |
| A corpus-wide support or performance claim | A resumable indexed corpus-triage audit, with its completion, read and time summaries |
Validation lives in the unpublished crate crates/metal2vulkan-validation. Paths below are
relative to it unless they start with crates/, docs/ or scripts/. Each tool's --help lists
every option.
The gate
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo nextest run -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-runtime -p metal2vulkan-devtools --all-features
cargo nextest run -p metal2vulkan-validation --all-features
cargo test --workspace --all-features --doc
None of these opens a device. They use the repository's own synthetic fixtures; private AIR and GPU runs are optional and explicit.
Device tests and GPU safety
A shader that never terminates keeps a GPU busy after its process is killed, and a wedged GPU can hang the host. So everything that opens a device is explicit, bounded and refusable.
Device tests compile only under a cfg (not a feature, since the gate builds with
--all-features):
| cfg | Adds | Device | Run |
|---|---|---|---|
| none | GPU-free tests only | none | the gate |
--cfg m2v_cpu_icd |
Vulkan execution tests | a CPU ICD only (lavapipe, SwiftShader) | Linux CI, with LP_NUM_THREADS=1 |
--cfg m2v_gpu |
Vulkan and Metal execution tests | a real GPU | explicitly, on a host with a GPU |
The two are mutually exclusive. Lint the gated code without running it, in its own target directory:
CARGO_TARGET_DIR=target/gpucfg RUSTFLAGS='-Dwarnings --cfg m2v_gpu' \
cargo clippy -p metal2vulkan-validation --all-targets --all-features -- -D warnings
A site that stops announcing, or any other failing assertion, still compiles: the lint sees none of it, and only a run does.
- Device selection is an argument. Every device-opening binary takes
--device-type cpu|gpu, with no default.cpumatches only a CPU device and never falls back to a GPU;gputakes the loader's first GPU.corpus-metaltakes onlygpu. - Waits are bounded. Every host wait on device work goes through
src/gpu/wait.rs(10 seconds by default;--gpu-wait-timeout SECONDSraises it for one command). A test fails if an unbounded wait appears elsewhere. - The hang tripwire. When a wait times out, or a submission ends with a device fault, the
process writes
~/.cache/m2v-gpu/hang(JSON: what ran, on what, when), frees nothing and exits with status 86. While the file exists every GPU open is refused; a CPU device never checks it. - If a hang is suspected (the tripwire, a device-lost, a display blink, an unresponsive UI):
stop launching GPU work; read the tripwire; check for other GPU users on the host
(
pgrep -fl '[c]argo'), since another workload may fault the GPU on purpose; check the system log for GPU restarts; reproduce the suspect module on a CPU ICD only, where a stuck shader is an ordinary killable process; add a deterministic regression; then a person removes the tripwire.
The whole device lane in one command
The device lane is what --cfg m2v_gpu adds: the delta between the workspace's test list with the
cfg and without it. scripts/device-lane/device-lane derives that delta from two
cargo nextest list runs, shards it by area, runs the shards one after another, and holds the run
to the lane.
scripts/device-lane/device-lane --profile debug # the whole lane
scripts/device-lane/device-lane --profile release --list-only # derive and prove, no device
scripts/device-lane/device-lane --profile release \
--filter 'test(/^runtime_lane::degrade_notices::/)' # a slice of it
--profile debug|releaseis required, and the report records it. Debug keeps the product'sdebug_asserts, release is what a timing-sensitive test needs, and neither profile's result stands for the other.--list-onlyopens no device.--filter EXPRintersects a nextest filterset with the lane, and the report then says the coverage is of that slice alone, never of the lane. An expression that leaves the whole lane selected narrowed nothing, and stops the run.--wrap 'CMD ARG...'prefixes each shard run. On a host whose GPU is shared, give it that host's GPU lock and a resident-memory cap: macOS does not enforceulimit -v, and a device test has no worker boundary of its own. Every build and every listing stays outside it. Each shard is compiled by its owncargo nextest run --no-runpass first, so the wrapped half has nothing to compile: a lock held across a compile is the form that has wedged this one before, and a sibling cargo on the same target directory can invalidate it between two shards.- The cfg and plain legs keep separate target directories (
--cfg-target,--plain-target), sinceRUSTFLAGSis part of a build's fingerprint.--helplists every option.
The shard set is derived on every run and never stored: a stored set grows no term for a test added later, and would skip it in silence. A shard names its tests one by one, because a module holds GPU-free tests beside device ones and a module prefix would reach past the lane.
The report ($OUT/report.txt, beside each shard's log, the two listings and shards.tsv) says:
| Line | What it means |
|---|---|
| the census | how many tests each build lists, the lane between them, how many of the lane are #[ignore]d, and the lane per test binary |
PROOF HOLDS |
every selected test is in exactly one shard, no shard reaches a test outside the selection, and the cfg build lists every test the plain build does. PROOF FAILED names what is adrift and stops the run before a device opens |
| a shard line | its exit status, the tests nextest ran, the tests it had to run, the seconds its build took outside the wrap, and the seconds the wrapped half took |
| the two cost lines | what the wrapped halves took in all and over how many turns, which is their turn in the host's queue and their run together and no finer, since the wrap does the waiting; then nextest's own figure for the tests, and what building cost outside the wrap |
COVERAGE HOLDS |
every shard ran exactly the runnable tests it holds, by nextest's own count and not the script's. nextest's skipped figure says nothing here: it counts every test of the shard's binary the filterset left out as well as the #[ignore]d ones |
VERDICT |
the line to read: every shard passed and the run covered the selection, or which of the two did not hold |
The lane's #[ignore]d tests are no part of a run of it: the cost and timing measurements, the
recorders (parity::lane::metal_recording) and the child halves of the tests that fork. The lane
lists them and runs none, so what each shard had to run is its tests but those; one of them runs
when a person asks for it by name.
The run exits 0 only when the proof holds, the coverage adds up and every shard passed. It is no part of a gate: it opens a device, and takes the host's GPU a shard at a time for the length of the lane. The lint above is what a pre-landing check can see of the cfg; an assertion needs this run.
The runtime lane (runtime_lane:: tests) runs the runtime on a device under
VK_LAYER_KHRONOS_validation. METAL2VULKAN_LANE_VALIDATION=sync (or load-store) adds the
layer's synchronization checks to every lane device and prints each failing message as a
LANE-VALIDATION <test>: ... line:
METAL2VULKAN_LANE_VALIDATION=sync RUSTFLAGS='--cfg m2v_cpu_icd' cargo nextest run \
-p metal2vulkan-validation --all-features --no-fail-fast -E 'test(/^runtime_lane::/)'
A lane device opens whether or not the loader can provide the layer it asks for: the runtime drops
a layer the loader answers VK_ERROR_LAYER_NOT_PRESENT for and says so as the device is made. A
claim of what the layer reported therefore states what it holds, against the layers the instance
enabled and nothing else: where the layer was dropped the claim is not exercised, and the test
prints LANE-LAYER-ABSENT <test>: ... and a count per message list instead of passing on an empty
list. Three forms state it, and no lane test reads a message list for emptiness any other way:
| Form | The claim |
|---|---|
layer_reported_nothing_at_all(&messages) |
The widest claim, and the one the lane states oftenest: whatever the layer checked of the work so far, it reported nothing of it |
layer_reported_nothing(&messages, claim) |
The same, of the narrower claim the test names, which leads the failure and the LANE-LAYER-ABSENT line |
nothing_reported_without_the_layer(&messages, claim) |
A device the test made without the validation layer, to time something: the claim is the driver's own messages and the runtime's, so the layer's absence takes nothing from it. It fails where such a device did ask for the layer after all |
| filename (which the loader looks for on the system library search path) provides no layer at all, | |
| and a lane run there is evidence for everything but the layer's checks. The executor's own Vulkan | |
context refuses to open without the layer instead (candidate::platform::device). |
Seeded differential sequences (parity::sequences): 64 seeded, race-free Metal programs of
render passes, blits, dispatches, indirect commands, fences and events over buffers, heaps and
textures, run on the runtime and compared with committed Metal results
(corpus/observations/parity/sequences.jsonl) and with a CPU model. A failing seed is shrunk and
printed. Metal's results are recorded on a Mac by the ignored test
parity::sequences::lane::metal_recording::record_metal, each seed in a child process of its
own. A seed whose child Metal's driver crashes is recorded as a Metal-side gap, with the crash's
signature (the call, the faulting frame and the command); the lane then has nothing of Metal's to
compare that seed with, runs it on the runtime all the same (it must complete with no refusal and
no validation message), and names it in its output. Under METAL2VULKAN_LANE_VALIDATION=sync the
lane reads each hazard the layer reports against the sequence: the layer takes a shader's buffer
as accessed over its whole descriptor (the bytes the shader reaches widened to 16-byte granules,
or from the bound offset to the end where it indexes the buffer), so a hazard between two
commands that share no byte of its memory changes no answer, and prints as a SEQUENCE-SYNC line
naming what Metal orders between them (nothing, for untracked memory between encoders or a
concurrent encoder's dispatches). The lane matches the commands by the Vulkan command the layer
names and by the command buffers it may have checked since the lane last took its messages
(after each commit). A hazard between commands that share a byte (the generator orders those, so
the runtime must), on a buffer no command of the sequence bound, or of another shape fails the
seed. So does one the layer's words fit both to such a pair and to pairs whose bytes are apart;
the minimized sequence then tells them apart: when it still needs a command of an apart pair,
the pair sharing bytes alone raised no hazard. Two seeds fail so today (7 and 50, on lavapipe,
the RTX 3090 and RADV), each settled that way: the hazard is between untracked commands in two
encoders, which Metal leaves unordered and whose bytes are apart, and the layer's ranges meet
because a texel kernel's or a draw's buffer binds from its offset to the buffer's end, as Metal's
does.
Generated-program fuzzers (metal2vulkan_devtools::fuzz: structured, irreducible, inline,
access, workgroup, pointer select) run device-free in the translator's tests
(crates/metal2vulkan/src/tests/fuzz_interp.rs) on its SPIR-V interpreter, at every subgroup
width, against each generator's reference model. A longer soak:
METAL2VULKAN_TEST_FUZZ_SOAK='--seeds N [--first S] [--profile P] [--threads 32|64] [--jobs J]' \
cargo nextest run --release -p metal2vulkan --all-features --run-ignored only fuzz_soak
Their device variants run under --cfg m2v_gpu:
RUSTFLAGS='-Dwarnings --cfg m2v_gpu' cargo nextest run --release -p metal2vulkan-validation \
--all-features -j 1 -E 'test(/_fuzz::.*_on_the_device/)'
The Linux gate in a container
scripts/linux-gate runs CI's Linux job, or any command, in a container: Ubuntu 26.04 pinned by
digest with CI's packages, plus SwiftShader and VK_LAYER_KHRONOS_profiles built from pinned
commits. It is where CPU-ICD execution runs; the container never sees a host GPU.
scripts/linux-gate --cpus N [--slot NAME] [--platform amd64|arm64] # ci.yml's Linux job
scripts/linux-gate --cpus N [--slot NAME] [--platform amd64|arm64] \
[--icd lavapipe|swiftshader] [--profile P] \
[--private-corpus DIR] [--scratch DIR] -- <command> ... # any command
- The container gets 4 GiB of memory per CPU. Each
--slotkeeps its own target volume; remove a slot's volumes when you are done with it. - The default command,
scripts/linux-gate-ci, runs every Linux step ofci.ymlin order: change the two together. scripts/qualify-public-cases(also run by CI) runs the public cases on lavapipe in both robustness legs against their committed Metal rows, and fails on anything but a match.- lavapipe's vector width follows the host (128 bits on arm64, 256 on x86 with AVX2);
LP_NATIVE_VECTOR_WIDTH=256forces the wider one.
The private corpus
Optional, local and never committed: AIR harvested from metallibs on a Mac, kept as JSONL shards
under corpus/local/, with a disposable SQLite index (corpus/.index.sqlite) of identities, byte
locations and cached facts. corpus/README.md
describes the formats.
cargo run -p metal2vulkan-validation --release --bin corpus-harvest # macOS
cargo run -p metal2vulkan-validation --bin corpus-index
cargo run -p metal2vulkan-validation --bin corpus-status
- Harvest merges new rows only into the shards they belong to, and creates no obligations.
A row is one entry point of one module; library modules that only supply linked functions are
kept apart (
corpus/local/library-modules). - Indexing is incremental: an unchanged shard is never opened, and a warm index reads no
source bytes.
--rebuildis for recovery only;--checkverifies the index against the shards. - Sweeps that write into the index run under
lockf /tmp/m2v-index.lock <command>. - Tools built in a worktree default their corpus root to that worktree; pass
--corpus DIRto use another checkout's.
Audits
Every audit is a corpus-triage --audit ... run over indexed rows, each attempt in a killable
worker under the 20-second and 500-MiB ceilings, resumable in bounded batches (--limit N,
--after HASH), with --jobs defaulting to the host's logical CPU count.
| Audit | What it answers |
|---|---|
authoring-capabilities [--reclassify-all] |
For every indexed AIR identity, whether a case can express and both executors can run its structure (ToolingRequirements). Closed only when classified == total, remaining == 0 and unresolved == 0; a warm rerun reads no source shard |
translation --profile P... |
Each row translated for each committed profile, recorded as a typed outcome class under the current product fingerprint (--current-fingerprint, --retry-failures, --hash-file PATH select rows). A fragment function of more colors than the profile draws at once is translated as its render pipeline's color groups, one module a group, each checked by L3. It fails when a row breaks a ceiling |
budgets --profile P... |
The budget gates from recorded rows: no row above 20 s or 500 MiB, no stopped worker, and each row's ledger peak at least 0.7 of its allocator peak |
specialization --profile P... |
Rows translated under planned function-constant value sets and the pipeline inputs their AIR states, not only with none |
authored-compile [--bless | --bless-additions | --case ID] |
Every committed authored case compiled, with the requests its executor builds, on each profile and leg of corpus/authored-compile.tsv; it fails on any changed cell. The table is re-blessed on development |
bitcode-reader |
The bitcode reader's decode compared with llvm-dis, and the intrinsic census |
focused audits (rasterization-rate-maps, sample-rate, ulong-textures, fragment-varyings, linked-functions, tile-functions, mesh-draws) |
One structural family, selected by current facts, translated in batches |
cargo run -p metal2vulkan-validation --release --bin corpus-triage -- \
--audit authoring-capabilities --limit 100000
lockf /tmp/m2v-index.lock cargo run --release -p metal2vulkan-validation --bin corpus-triage -- \
--audit translation --profile vk12-floor --profile moltenvk-m3 --current-fingerprint --limit 500 --summary-only
cargo run --release -p metal2vulkan-validation --bin corpus-triage -- \
--audit budgets --profile vk12-floor --profile moltenvk-m3 --summary-only
Other corpus tools:
corpus-pipeline --device-type cpu|gpu --profile Pasks a Vulkan driver to create each translated pipeline, without dispatching anything (driver acceptance).--profiles-layer P(oncorpus-vulkanandcorpus-pipeline) runs every context throughVK_LAYER_KHRONOS_profilesrestricted to a committed profile, to test a profile on a device that exceeds it.
Authored cases
A case is a JSON manifest that names one AIR (by hash) and every resource, initial byte, function
constant, dispatch or draw, output region and comparison rule. Runners do not infer, seed, resize,
repair or reinterpret anything. Cases live in corpus/cases/, Metal and Vulkan observations in
corpus/observations/, keyed by the case's semantic ID. The schema and its resource kinds are in
the crate's README; they include out-of-bounds
targets for containment checks (out_of_bounds), sparse textures (sparse), fragment, vertex,
tessellation and tile cases, object and mesh cases (mesh_draw),
argument buffers and indirect command buffers.
cargo run -p metal2vulkan-validation --bin corpus-index
# Read an indexed AIR function and write one manifest for it.
cargo run -p metal2vulkan-validation --bin corpus-case-check -- --manifest /path/to/case.json --install
cargo run -p metal2vulkan-validation --bin corpus-index
cargo run -p metal2vulkan-validation --bin corpus-status
- Editing a manifest replaces its
(air_sha256, name)slot; observations of the old identity are removed. - After a change to the AIR layer, reflection, the descriptor ABI or the case schema, re-check every
installed case:
corpus-case-check --recheck-all(needs the private sources). CI re-checks the cases over public fixtures.
Contract 1: emitter stability
crates/metal2vulkan/src/tests/golden_hashes.rs pins a hash of the final SPIR-V (or the refusal
class) of every public fixture entry point on every committed profile. A behavior-preserving
change keeps every cell; a change that moves one bumps SEMANTICS_VERSION and re-blesses
(CONTRIBUTING.md). The fixture
inventory (crates/metal2vulkan/tests/public_fixture_expectations_engine.tsv) pins which
fixtures compile or refuse on which profile. Over the private corpus, the translation audit records
outcomes, not bytes.
Contract 2: semantic correctness
Each case runs first on Metal, then on Vulkan, and the observations are compared.
cargo run -p metal2vulkan-validation --release --bin corpus-metal -- \
--case-id CASE --environment-id METAL_ENV --device-type gpu
cargo run -p metal2vulkan-validation --release --bin corpus-vulkan -- \
--case-id CASE --environment-id VENUE --device-type cpu|gpu
cargo run -p metal2vulkan-validation --release --bin corpus-moltenvk -- \
--case-id CASE --environment-id VENUE --device-type gpu # macOS
- Metal qualification (
corpus-metal) runs the case three times through Metal and records its observation for the environment.--prepare-onlydoes the CPU side and stops before a device opens, to screen cases. - The Vulkan candidate (
corpus-vulkanon Linux,corpus-moltenvkon macOS) translates the case through the public API in a killable compile worker, executes exactly what the binder plans, and compares the observations with Metal's. Every context runs under the validation layer, in a robustness leg: the stated leg enables every robustness feature the device states, and therobustness-offleg none, so both containment encodings run. - Batches.
--batch --out OUTruns every selected case, one process per case, each killed whole after--run-timeout, resuming fromOUT/done.tsv;--batch-reportand--batch-install STOREread and install the results. A batch starts no GPU run while the tripwire exists. - What counts. An observation is current only for the product, executor and runtime versions
it was made with: a row records the product fingerprint, the executor ABI and
RUNTIME_VERSION, and a change of any makes it stale until it is rerun. A stored observation, a valid module or a manifest alone is not evidence. - No-effect declarations and reference gaps. A case may declare that an output equals its authored bytes, and a Metal pipeline creation that fails naming one feature is recorded as a reference gap rather than a pass.
- What it cost. Every row records what its case cost in time: how many executions the figure covers, what they took in all, and the least one of them took, in microseconds. A Metal row's figure is its three executions, a candidate row's its one run on the device, and a refusal's the attempt it refused on, each read by the clock the pipeline-creation ceiling is checked against. The store refuses a row or a refusal that records none, so the figure is there for every case either side runs, whether it produced output or a typed refusal. It is not semantics: no verdict, digest, fingerprint or census key reads it, two rows that differ only in their figures are one row, and a row recorded before the figure existed carries none.
Venues
cutover/c3-venues.json lists the venues the cases must pass on: each is one translation key under
one driver, with its environment ID, committed profile, devices and the legs it records. Today:
MoltenVK on Apple's M3 Max, lavapipe on arm64 and x86, the AMD Radeon 780M under RADV, Intel's
Raptor Lake Xe graphics under ANV, and the NVIDIA GeForce RTX 5080 Laptop GPU.
cutover/c3-references.json names the Metal environment that is the reference (the Apple M3 Max),
with its declared identity; each case is judged against its row.
corpus-status --c3 judges every venue's slot of every case, in both legs: match, reviewed,
device_gap, out_of_scope_ray_tracing, reference_gap, mismatch, refused, stale or
missing. A row recorded on a device or driver its venue does not allow is rejected. A change that
moves a venue's profile fingerprint without changing any artifact is handled by rekeying its
records (corpus-status --venue-keys, then --rekey-venues); a change that moves artifacts needs a
re-record on that venue.
Draw A/B and command replay
corpus-draw-abdraws a logged render pipeline's fragment function through the runtime on seeded inputs and records what it writes and how long it takes;corpus-draw-ab compare --base DIR --change DIR --draws FILE --runs Ncompares two builds. A draw skipped in both legs is not compared, and fails the comparison unless named in--expected-skips.command-replayruns one recorded stretch of Metal commands through the runtime from a manifest that names every object and byte.format-scoutdrives every Metal pixel format through the runtime's public API, one use at a time, and records what each use did.
The product bug loop
- Say whether the SPIR-V should change, and name the structural feature.
- Reproduce with one AIR or an owned synthetic fixture.
- Add a synthetic regression test where practical.
- Fix the product, without names or environment gates.
- Run the gate's format, clippy and the narrow tests.
- Check the golden drift: only the intended cells move.
- Where cases cover the change, rerun them on Metal (only if the Metal side changed) and on the affected venues.
What stays private
The published crates exclude validation, docs, scripts and every capture. Committed validation
data is owned synthetic fixtures, authored manifests and hash-identified observations. Never commit
corpus/local/, the index, metallibs, AIR, SPIR-V dumps, third-party shader bodies, or anything
derived from a consumer's guest shaders.