Commit Graph
30 Commits
Author SHA1 Message Date
Anees Iqbal 3ddbc85f73 Golden table: it records its bless's SEMANTICS_VERSION, and a cell changed under its key at that number is a missing bump
What: golden_hashes.tsv gains a `semantics` line, cache::SEMANTICS_VERSION as it was at the
table's bless (2234, the bless at 3ddca91746). The observed table carries this build's number. A
cell that changed while its fixture source and profile fingerprint did not now fails the check in
one of two named classes: "SEMANTICS bump missing" where this build's SEMANTICS_VERSION is not
above the table's, "bless due" where it is. The bless refuses the first (it used to print the
cells and write the table anyway, although the module doc and CONTRIBUTING.md said it refused).
A table with no semantics line does not parse. Both messages keep "output changed under an
unchanged key: N cell", which scripts/matrix/results.py and the suites check read.

Why: a translation change landed without its SEMANTICS bump: emitted SPIR-V changed at 2205 and
the bump came at the batch's end, so a warm cache served the old modules under the same key. The
table recorded no number, so the check could not tell a missing bump from a bless due, and the
bless wrote the table either way. This is the deterministic check the planner ruled for that bug:
the table records its SEMANTICS, and a changed table under the same number fails. It catches a
missing bump only while no other commit since the table's bless has bumped.

Tests: a_cell_changed_under_its_key_at_the_table_s_own_semantics_is_a_missing_bump (a changed
cell at the table's number is a missing bump, one number above a bless due); the round-trip test
renders and parses the semantics line and refuses a table without one.
2026-11-20 21:38:40 -08:00
Anees Iqbal 9a1c8fe6dc metal2vulkan-rt takes the runtime's name: metal2vulkan-runtime, published
The cutover's last mechanical step. The old runtime is deleted, so its name is free: the crate
moves to crates/metal2vulkan-runtime, its package is metal2vulkan-runtime and its library
metal2vulkan_runtime, and every reference in the tree follows (sources, tests, scripts, CI,
generated tables and docs).

It is now a published crate, as AGENTS.md said it would be once it took the name: version 0.2.0
with the other two, the translator pinned exactly (=0.2.0, as the translator pins the AIR front
end), documentation, keywords and categories, and copies of the repository's four license files,
which the published-crates test now holds equal to the root's for three crates. CI packages it
with the others. Prose that said it was unpublished, or counted two published crates, says three.

AGENTS.md: facts only. The crate table row, the published-crates and version sentences, and the
paragraph on the old runtime, whose name the runtime now carries (listed for the owner).

Made by one script run on this tip. Verified by the job
named in the landing note.
2026-11-20 09:10:02 -08:00
Anees Iqbal aaa3213887 Translator cutover: first trial-compile fixes (imports, the half pair, push tests, removed routes) 2026-11-20 09:08:20 -08:00
Anees Iqbal 4d3daeace8 Docs: the runtime is metal2vulkan-rt; HOWTO's sections on the deleted runtime give way to rt's README
metal2vulkan-runtime is deleted, so the user-facing docs name metal2vulkan-rt as the runtime:
- README.md: the crate table's runtime row is metal2vulkan-rt (not published yet); two published
  crates; the git dependency and both README links name it; the runtime needs a Vulkan 1.3 device
  with its README's floor; the sentence on the deleted runtime's repro bundles goes.
- CONTRIBUTING.md: the layout lists metal2vulkan-rt and metal2vulkan-conformance; the gate drops
  `-p metal2vulkan-runtime` and gains the conformance suite's line, as AGENTS.md's gate has it;
  two published crates for the signatures and the license copies; the refusal check reads the
  runtime's refusal enums (the deleted runtime's `Problem` is gone).
- docs/VALIDATION.md: the gate as CONTRIBUTING's; "the new runtime" is the runtime in the matrix
  rules and the command replay (the record keys and `harness --runtime new` keep their names).
- docs/HOWTO.md: the sections on the deleted runtime's shader cache, host memory (no-copy
  buffers, unmapping, copied host buffers, guest RAM) and exported memory described its API
  alone; each is now a pointer to rt's README (The cache directory, Imported blocks, Exported
  blocks and Exported surfaces), stating only what that README states. Section 4 loses the
  deleted runtime's repro bundles; section 8 loses its pipeline names, its start-up checks, its
  suspend-time measurements of its own calls and its exit-handler probe, keeping the driver facts.
- docs/ARCHITECTURE.md and the CI workflow's comment name the runtime as metal2vulkan-rt.

Left for the translator's commit (part 2): FAST-PATHS.md and the DevicePolicy text in README,
CONTRIBUTING and VALIDATION's golden-table paragraph ("The old runtime's translations do not
move"), which follows the matrix's old-path rule.

Verified: the compile job is named in the hand-off.
2026-11-20 07:58:56 -08:00
Anees Iqbal 0afc54c573 rt tests: every instance runs under the validation layer, its log checked
Every instance rt's device tests open goes through one helper, crate::tests::validation. It
enables VK_LAYER_KHRONOS_validation for its own test process through the loader's and the
layer's own variables (VK_INSTANCE_LAYERS; report flags error,warn, debug action log, one log
file per process). It checks that every device of the cfg's kind lists an active validation
tool (vkGetPhysicalDeviceToolProperties), so a run whose loader found no layer fails. Once the
instance is gone, it reads the log, prints each line with the test's name and fails on any
message. The 41 sites that called Instance::new go through it; the exit-handler test reads its
child's log, since the child's instance never drops. One test makes a deliberately invalid
call (a buffer of size 0, refused by the layer) and checks that its log holds exactly
VUID-VkBufferCreateInfo-size-00912.

The product keeps no layer code and no variable read. Its one change is a visibility:
Instance's shared state is pub(crate), so the helper waits, bounded, on a weak handle of it
until the instance is gone, and only then reads the log.

scripts/validation-layer makes the layer's directory, one version (1.4.363.0) on every leg, as
a carry: Linux's copied from a node whose pacman package is that version and unaltered,
Windows's from MSYS2's clang64 packages checked against the package database's SHA-256, and
macOS's from a Homebrew install at that version. scripts/matrix carries it to every job that
runs rt's device tests (GPU legs, lavapipe, the Windows host), points VK_LAYER_PATH at it, and
puts the layer's version in the leg's note. A job without the layer says so and points the
loader at none. The harness's timing jobs run without it.

Verified: the matrix's unit tests (48, two new ones run the layer's shell for real) and the
layer carry made. Builds and legs follow.
2026-11-18 12:17:31 -08:00
Anees Iqbal b4b22c7b2c matrix: the per-commit matrix runner and the user-space instruction counter (WIP) 2026-11-17 06:19:57 -08:00
Anees Iqbal 374e29a988 metal2vulkan-rt: the floor's shader features, queue family, timestamps and memory types
The floor now also requires what the translator's shaders and the runtime's
core need of every device:

- shaderInt16, shaderInt8, storageBuffer16BitAccess (Vulkan 1.1 features,
  now read and enabled through Features::vulkan11), storageBuffer8BitAccess,
  scalarBlockLayout, vulkanMemoryModel and vulkanMemoryModelDeviceScope. The
  translator emits 8- and 16-bit access only in storage and physical storage
  buffers in practice (uniform views are u32 or uvec4, push fields are 32- or
  64-bit), so the uniform and push-constant 8/16-bit features stay out; it
  does use device scope.
- timestampComputeAndGraphics, and timestampValidBits of at least 36 on the
  first queue family with graphics and compute, which Capabilities names
  (queue_family). A device with no such family is Missing::QueueFamily.
- a host-visible, host-coherent, host-cached memory type (Shared storage)
  and a device-local, host-visible, host-coherent one (the parameter ring),
  each usable by a buffer of BUFFER_USAGE: every Vulkan 1.3 buffer usage plus
  device addresses. Vulkan answers buffer memory types only for a created
  device, so check() finds a type with each set of flags and carries the
  memory properties, and memory_types(device, &capabilities) chooses the
  first usable type of each with vkGetDeviceBufferMemoryRequirements.
  Missing::MemoryType names the flags.

Each shortfall is named in BelowFloor, with a unit case; the README's Floor
section states every item and tests::floor holds it to the code. The device
test now also creates each device with the floor's features and extensions
and chooses its memory types on it.

CI's lavapipe step (ci.yml and scripts/linux-gate-ci) runs the rt crate's
device tests too. refusal_surface.py reads metal2vulkan-rt and writes the
floor's Missing as section 10 of docs/REFUSALS.md; signatures.py pins
metal2vulkan-rt's public surface in api_signatures.tsv.

Verified: see the lane report (compile job, device legs on every lab GPU,
lavapipe and the Windows UHD 630).
2026-11-17 05:33:25 -08:00
Anees Iqbal 017ff31e2f wip harness crate 2026-11-17 05:22:15 -08:00
Anees Iqbal 28b6b0b9df metal2vulkan-rt: the new runtime's crate, and AGENTS.md's rules for one path on every device
What: a new, unpublished workspace crate, crates/metal2vulkan-rt, that will replace
metal2vulkan-runtime and take its name at the cutover. It has no public API yet. Its first test,
tests::one_path, reads the crate's product sources (line comments removed) and fails on:
- a vendor, device or driver identity name (vendor_id, deviceID, DriverId, driver_name ...);
- a GPU vendor's ID as a hex literal (0x1002, 0x10de, 0x8086 ...);
- an environment read (env::var, option_env!);
- a struct or enum named as a policy.
Two more tests prove the scan finds each form and passes prose and unrelated numbers.

AGENTS.md takes the owner's new rules, in priority order:
1. correct for documented Metal, with the device's arithmetic and static notes per operation;
2. one path for every device;
3. native-like speed;
4. small.
It also takes:
- the workaround ladder, the never-list and the thresholds;
- the matrix rules: every check fans out one leg per GPU at once, and the replay matrix runs on
  development after each merge with deterministic metrics and leak gauges;
- the freeze: the old runtime, DevicePolicy switches, driver-fact tables, device checks and
  docs/FAST-PATHS.md get regression fixes only until the cutover deletes them, and nothing new
  of those kinds is added;
- the scope rule: below the floor is a typed refusal, and a Metal feature no replay stream uses is
  a typed refusal until a stream needs it.
The crate table, the doc table, CI's crate lists and the gate commands in AGENTS.md,
CONTRIBUTING.md and docs/VALIDATION.md name the new crate.

Why: the owner's plan replaces the runtime with one that has no per-device code paths. These are
the rules every lane of that work follows from its first commit.

Verified: cargo fmt. Build, clippy and the crate's tests run on development after this lands.
2026-11-17 03:09:06 -08:00
Anees Iqbal cc4c44bd7e Make the GPU hazard tests opt-in under --cfg m2v_gpu_hazards
Owner's rule (11-05): tests that fault a real GPU, hold one for long, or
allocate toward its limits never run in sweeps, lanes, stress loops or
gates; they run only when that feature is tested, on request. On the M3
Max a GPU fault's recovery fails other processes' command buffers in
flight (.config/nextest.toml has the measurement). #[ignore] is not
enough, since lanes run --run-ignored all, so the gate is a cfg: on a
real GPU a hazard compiles only under --cfg m2v_gpu --cfg
m2v_gpu_hazards. Under --cfg m2v_cpu_icd it compiles and runs as
before, so lavapipe CI keeps them.

Gated (each doc comment now says which hazard it is):
- runtime_lane::host_memory::a_gpu_fault_fails_its_command_buffer_and_the_queue_runs_on
  and ::a_lost_device_s_command_buffers_let_go_of_their_pools_after_the_driver_s_completion:
  GPU writes into read-only host pages, real page faults (2 and 3).
- host_memory::a_no_copy_buffer_s_pages_are_imported_when_it_is_made:
  no-copy buffers of 1 to 16 GiB.
- vertex_strides::vertex_fetches_past_4_gib_of_a_buffer_are_refused and
  stage_in_strides::stage_in_fetches_past_4_gib_of_a_buffer_are_refused
  (and their `Large` helper): 4 GiB + 4 KiB buffers.
- heaps::the_largest_heap_lies_in_one_allocation: a heap of the device's
  largest allocation, up to 4 GiB.
- cross_queue_shadows: the three tests whose spin holds one command
  buffer for 1.5 s.
- framebuffer_fetch::storage_forms::a_steady_stream_takes_the_storage_form_at_its_first_lone_commit:
  a single-dispatch spin of up to 1 s that only its cap ends on Apple GPUs.
- detach::table_3_a_detach_waits_for_running_work_then_refuses: single
  dispatches calibrated to 500 ms (up to 2 s loaded), the cap alone ending
  them on the M3 Max, where Metal ended some 0.5 s dispatches as hung.
- runtime tests::detach_lost: one dispatch of 2^25 loads (about 4.5 s on
  the M3 Max) whose word the GPU does not see raised.

Made safe instead of gated:
- mesh_draws::object_grids_run_as_metal_runs_them: on a GPU without the
  hazards cfg, grids past 2^20 object threadgroups are skipped (printed),
  as a CPU ICD already skips them; the 70k to 262k grids and the
  past-the-watchdog discards still run. The 4.6M grid took 12 s in one
  command buffer on the RTX 5080 Laptop GPU.
- detach::a_resident_buffer_no_command_reaches_fails_its_submission_once_detached
  takes the spin kernel without calibrating a cap (`spin_kernel`): its
  word is raised, so the cap never mattered, and the calibration's
  unraised runs are bounded only at 16 x 50 ms.
- cross_queue_shadows::an_encoder_after_a_signal_reads_what_another_queue_wrote_after_it
  no longer calibrates a spin it never ran.

The cfg is declared for unexpected_cfgs in the runtime, validation and
conformance manifests. docs/VALIDATION.md says what a hazard is and how
to run one; CONTRIBUTING.md and .config/nextest.toml mention the cfg.
The device lane is unaffected: its builds set RUSTFLAGS to --cfg
m2v_gpu alone. No product code changed (no RUNTIME_VERSION bump; the
runtime-sources pin skips test modules).

Verified on this Mac (no test run on any GPU): cargo fmt --all; cargo
clippy --workspace --all-targets --all-features -D warnings clean plain,
under --cfg m2v_gpu, --cfg m2v_gpu --cfg m2v_gpu_hazards and --cfg
m2v_cpu_icd. cargo nextest list -p metal2vulkan-runtime -p
metal2vulkan-validation --all-features --run-ignored all: under --cfg
m2v_gpu 5022 tests, under --cfg m2v_gpu --cfg m2v_gpu_hazards 5034, and
the difference is exactly the 12 gated tests; all 12 are listed under
--cfg m2v_cpu_icd (5000 tests).

(cherry picked from commit 7b57d9a87a3dd8275a2ece547fc0bd9b9cb6808c)
2026-11-05 00:43:51 -08:00
Anees Iqbal 7d14d60cad Keep each worktree's target directories inside it, where kache shares incremental state
kache 2.0 imports a crate's incremental state from another worktree's target only when both
targets sit inside their worktrees: a CARGO_TARGET_DIR outside its worktree is attributed to the
target's parent directory instead, and neither gives nor takes. AGENTS.md and CONTRIBUTING.md
now say so: target/ (Cargo's default), and target/gpucfg for --cfg m2v_gpu builds, as CI and
docs/VALIDATION.md already name it.

Verified on the M3 Max at 7dbedfd151 with three lean worktrees building metal2vulkan-air, then
the same comment edit to its lib.rs: the donor's first edit rebuilt from scratch in 3.89 s; a
second worktree with an in-tree target rebuilt it in 1.61 s, which kache explain records as
"automatic worktree seed"; a control with its target outside its worktree took 3.84 s,
recorded as a plain edit rebuild under the target's parent.
2026-11-03 23:57:39 -08:00
Anees Iqbal 64b4e42d75 Build on nightly-2026-11-03 with rustc's parallel front end, kache and incremental builds
The owner asked for a nightly toolchain, -Zthreads, kache 2.0 with its incremental cache, and
Rust's incremental compilation on.

- rust-toolchain.toml pins nightly-2026-11-03 (rustc 1.101.0-nightly 1c3a65069), dated so every
  machine runs one rustc, clippy and rustfmt. The published crates keep rust-version 1.98, which
  this build no longer checks by itself (clippy's incompatible_msrv still flags newer std items).
- .cargo/config.toml passes -Zthreads=0 (a thread per core) through Cargo's profile rustflags,
  which add to RUSTFLAGS instead of being replaced by it, so `--cfg m2v_gpu` lanes and CI's
  -Dwarnings keep it.
- scripts/rustc-wrapper hands each compile to kache where kache is on PATH outside CI, and to
  rustc otherwise; `RUSTC_WRAPPER=` (empty) builds without it.
- CARGO_INCREMENTAL=0 is gone from scripts/device-lane, AGENTS.md and CONTRIBUTING.md.
- CI installs the toolchain the file names; both Dockerfiles take the same nightly.

What the nightly asked of the code:
- Its standard library containers take more trait-solver levels (Box -> BoxRaw, RawVec ->
  PhantomData), so proving a RenderCommandEncoder `Send` from a program's crate ran past the
  default recursion limit (tests/consumer_auto_traits.rs failed, a future-incompat lint that will
  become an error). The encoder now holds its own lowering in `OwnLowering`, whose `Send` impl is
  written out over a compile-time proof that `RenderLowering` is `Send`, as `LoweringSlot` already
  was. The runtime crate's own proofs need recursion_limit 256.
- New clippy lints: needless_range_loop, single_element_loop, new_instead_of_clear (a false
  positive on a moved-from Vec: the part's segments are now taken explicitly),
  needless_borrows_for_generic_args, redundant_closure, unnecessary_lazy_evaluations,
  manual_range_patterns; AtomicU64::fetch_update is deprecated for try_update (present in 1.98).
- Cargo warns that `homepage` equals `repository`: homepage removed from the manifests.
- nightly rustfmt formats ir_id! invocations one argument per line.

Verified on the M3 Max: `cargo clippy --workspace --all-targets --all-features -- -D warnings`
clean on the nightly; `cargo build -v` shows -Zthreads on every rustc invocation and
scripts/rustc-wrapper in front of each.
2026-11-03 23:41:19 -08:00
Anees Iqbal 6fba488835 Drop the exact golden table, a duplicate of the default one
One work packet, landed as 2 commits (4bf2c22aad..9090d9a1b1 on archive/development-linear-2026-10-28), in order:

* Drop the exact golden table, a duplicate of the default one

`DevicePolicy::exact_answers()` now sets only the runtime's switches (heap compression,
completion, batch order, render lowering, host-page textures), none of which a translation reads:
the table's own structural test held its profiles' fingerprints equal to the default table's, so
`golden_hashes_exact.tsv` pinned a subset of `golden_hashes.tsv` cell for cell. The table, its
comparison test, its structural test and the `samples` filter go; the bless writes the one table.

Verified: clippy (workspace, all targets, all features) clean; the golden module's structural
tests, fast_paths and published_crates pass (14 tests).

* State the native-arithmetic rule in AGENTS.md and the ledger

The owner ruled on 2026-10-27: "Just promise the GPU's native arithmetics, no more 'exact'
emulation." Rule 1 now says so: arithmetic and value answers are the device's own native form,
recorded as a precision note where they can differ from Metal's, and no path or switch emulates
Metal's bits where the device has a native form; capability emulation stays; the remaining
speed-for-accuracy switches (outside arithmetic) keep both forms, the fast one the default. The
"Scope is the device's" honesty rule names the native answer as a recorded near-equivalent.
docs/FAST-PATHS.md's opening says the same and what its tables hold.

Verified: tests::fast_paths passes.
2026-10-28 17:24:20 +02:00
Anees Iqbal 78ed264c90 Drop the normalized vertex attribute's exact division (vertex_normalized)
One work packet, landed as 9 commits (9c0bdbe0d2..41066d87d0 on archive/development-linear-2026-10-28), in order:

* Drop the normalized vertex attribute's exact division (vertex_normalized)

The owner's ruling of 2026-10-27: the GPU's native arithmetic is the contract, no exact
emulation. A normalized vertex attribute is now always the device's fixed-function UNORM or
SNORM conversion; the policy-forced pull that divided its codes in the shader goes with
DevicePolicy::vertex_normalized, VertexNormalizedPolicy, its profile field, its ledger row and
its tests. A format pulled for any other reason (a format the device cannot fetch, alignment,
limits, containment, the capture form) still decodes in the shader as before.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings clean; nextest of
engine_vertex_variants, device::tests::profile, fast_paths, catalogue, degradation and
api_surface: 71 passed. api_signatures is re-blessed at the end of the lane.

* Keep the compact decoded twin only (decoded_texels)

The owner's ruling of 2026-10-27: no exact emulation. A carried ASTC LDR texture's decoded
twin now always holds 8-bit codes, and an EAC 11-bit texture's 16-bit normalized codes (its
values in floats only where the device does not take those codes' format, a capability
fallback). DevicePolicy::decoded_texels and DecodedTexelsPolicy go, with their ledger row,
their mentions in the degrade catalogue and the runtime's docs, the policy-keyed fingerprint
test, and the validation lanes' exact twins. decoded-texel-precision is announced as before.
bind::AstcTexels::Float stays: the conformance suite's cross-check decodes Metal's values with
it. RUNTIME_VERSION 1654.

Verified: clippy --workspace --all-targets --all-features -D warnings clean, plain and with
--cfg m2v_gpu; nextest of fast_paths, device profile, degradation and catalogue, image_plan's
decode bands, the conformance ASTC and ETC cases, api_surface: 112 passed.

* Take the device's texel conversion only (texel_conversion)

The owner's ruling of 2026-10-27: no exact emulation. A read, sample or gather with a float
or half result off Apple's GPUs is now always the device's conversion of the texel's codes,
recorded as DeviceTexelConversion or HalfTexelConversion. DevicePolicy::texel_conversion and
TexelConversionPolicy go, with Metal's conversion by the bound format's class:
lower::texture::float_texel (its routine, census entry and tests), the float_texel plan flags of
reads and samples, the slots' float_format and the heap's float class, and the field of
RuntimeFact::ExactFormsOverCompilerLimit that named it (encoded, so ARTIFACT_FORMAT_VERSION
456; SEMANTICS_VERSION 1873). The ledger row goes; DeviceTexelConversion is now documented in
docs/API.md section 9 alone (fast_paths classes it Elsewhere), and the conformance cases cite
the note's bound in place of the row. The half routine on Apple's GPUs is untouched.

Verified: clippy --workspace --all-targets --all-features -D warnings clean, plain and with
--cfg m2v_gpu; nextest of fast_paths, device profile, catalogue, degradation, the fit, mechanism,
codec, the snapshot variant, engine_handles, the extended-range heap tests, the texel-conversion
test (rewritten for the device's form alone), the conformance ETC, BC and border cases and the
runtime's fitted-variant notice: passed (one exact-conversion test deleted).

* Take the device's filter of a two-plane YCbCr texture only (ycbcr_filter)

The owner's ruling: promise the GPU's native arithmetic, no exact emulation.
YCbCrFilterPolicy and its Exact form go: no slot takes a YCbCr variant
(RuntimeFact::YCbCrTexture, VariantKey and LoweringInputs::ycbcr_textures,
ProfileFields::ycbcr_variant, Linear::exact_only and the binder's
ycbcr_variant are gone). A natively sampling device filters such a texture's
texels (device-sampling); on MoltenVK Metal's own sampler filters them,
noted where the bound format is two-plane YCbCr (ycbcr-filter-not-exact).
The planes read in place on a device whose memory is the host's are kept:
that is a capability path, Metal's filter exactly.

The FAST-PATHS row goes; HalfTexelConversion, which only that row named, is
classed Elsewhere (API.md's catalogue states it). The YCbCr tests keep the
default's selection and drop the variant's; the uniform-branch test runs at
the default policy; the validation lane's Exact draw test goes.

Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu, clean. nextest over fast_paths, device::tests,
bind::plan, compile::fit, compile::tests, engine_linear_half, catalogue,
degradation, api_surface, codec, cache: 372 passed, 5 failed. The five are
engine_linear_half tests of the emulated sampler on lavapipe and MoltenVK
under EXACT_SAMPLING (the_emulation_reaches_what_metal_measured,
the_linear_sums_run_one_by_a_branch_and_stay_calls,
swizzled_packed_texels_are_the_unswizzled_swizzled,
a_pipelines_texture_notes_follow_its_bound_format_and_sampler,
a_depth_comparison_through_a_filter_is_a_filtered_float_sample); they go with
the emulated sampler in the next step. api_signatures is re-blessed at the
end of the lane.

* Take the device's sampler only (sampling, unorm8_linear_filter)

The owner's ruling of 2026-10-27: promise the GPU's native arithmetic, no
exact emulation. Metal's sampler emulated by fetches (SamplingPolicy::Exact,
a pipeline per bound sampler state) and the device's 8-bit unorm filter at
Metal's footprint step (Unorm8LinearFilterPolicy) are gone with their
switches: every sample, gather and comparison goes to the device's sampler,
Metal's own on MoltenVK (VkProperty::MetalSampler) and the device's
elsewhere (VkProperty::DeviceSampling, PrecisionNote::DeviceSampling).

Deleted: lower/sampler/compared.rs, native.rs, linear/compare.rs,
linear/cube.rs, the nearest and level snaps, the cube face position and
fold (face::snapped, FaceWrap), the span and cube bicubic routines, the heap
depth class (FLAG_DEPTH_*, HANDLE_DEPTH_*, Lookup::Flagged's depth), the
normalized gather snap and the runtime sampler's anisotropic bias route.
Notes nothing records any more are deleted with their catalogue and codec
entries and the runtime's Degradation kinds: DeviceGatherFootprint,
CubeFaceReciprocal, DeviceDepthComparison, DeviceTexelDenormals,
DeviceUnorm8LinearFilter. The fit drops the sampling field of
ExactFormsOverCompilerLimit and makes every module-growing form native in
one reduction.

Kept as capability: bicubic, extended range, heap raw reads, YCbCr planes
read in place (its tests move to engine_ycbcr_in_place), constexpr pixel
samplers' snaps and fetches, the runtime pixel word's gather and footprint
cell, Metal's cube face at a tie, the anisotropic emulation without
samplerAnisotropy and for an unmeasured cube-gradient route, the
VkSampler level clamp on Metal's grid.

Validation and conformance follow: the lanes judge the device's filter
within two codes where it samples natively, the anisotropic lane runs with
samplerAnisotropy withheld, and the conformance cases drop their
device-texel-denormals declarations. docs/API.md, FAST-PATHS.md,
ARCHITECTURE.md, CONTRIBUTING.md and VALIDATION.md updated.

Verified so far: cargo check of the workspace, all targets and features,
plain and --cfg m2v_gpu; 1000 of 3664 translator lib tests passed before
the run was stopped for the rebase.

* Join the device-sampler deletions with development's half and write removals

The rebase onto development left two joins only a build shows:

- `packed_scales` and `PackedField::small` lost their last readers (the
  float texel conversion this branch deleted and the normalized write
  development deleted): both go.
- `engine_srgb_raw` takes `DevicePolicy::default()` where development's
  side named `EXACT_SAMPLING`, so it imports `DevicePolicy` again.

Also formats the conflict resolutions (`cargo fmt --all`).

Verified: `cargo check --workspace --all-targets --all-features` passes.

* Drop the sampler word's snap and level-rule fields with their last readers

With every sample the device's own, no function reads a runtime sampler's
nearest snap (`SamplerWord::NEAREST_BASE`, `NEAREST_SNAP`, `NEAREST_LEVEL`,
`LEVELED_SNAP`) or its level rule (`LEVEL_RULE`); only tests named them.
The constants go, with the word test of the base-level mask; the
`VkSampler` clamp on Metal's level grid (`clamps_on_grid`) stays, and its
docs no longer say the shader reads the rule.

The runtime-sampler tests of `engine_sampler` asked, off MoltenVK, for the
emulation's linear state, leveled snap and level rule: they now state the
device's sample on every committed profile (the pixel fields alone, gated;
`MetalSampler` on MoltenVK, `DeviceSampling` elsewhere; no level field).

Also matches `SnapKind::WordGather` as the unit variant it is (clippy).

Verified: clippy (all targets, all features, -D warnings) passes.

* Test the anisotropic, bias and position paths as the device's sampler runs them

The tests of these paths compiled under the exact sampling policy, which
is gone; under the default each now states what the translation does:

- Metal's anisotropic filter is emulated only without `samplerAnisotropy`
  (and on MoltenVK's unmeasured cube-gradient route), so the emulation's
  shape tests compile on committed profiles with the feature withheld,
  and their MoltenVK arms on the profile as described. An isotropic cube
  keeps the device's gradient sample except on the unmeasured route.
- A bias through a sampler without its own is the `Bias` operand on every
  profile (one test over MoltenVK, RADV, lavapipe and the floor); the
  compile-time and anisotropic axis-gradient tests take a constexpr
  sampler with its own bias, the only one that reaches them. The runtime
  slot's word-chosen axis gradients have no reader left: its test goes,
  with the helpers only it used.
- The position kernel writes three words a lane: its record stride is 12
  bytes, not 16, and the by-word gather test's lane floor matches its
  single pass.

Verified: `cargo check -p metal2vulkan --tests --all-features` clean; the
tests run after the rebase onto development.

* Rewrite the sampling tests and notes for the device's sampler

The sampling, texel-conversion and YCbCr-filter emulations are gone, so
the tests that pinned them now pin the device's answer, and the note
docs that described them describe what the module records today.

Tests: the sampler-unk, anisotropic cube, depth-range, bicubic,
dynamic-offset, heap half-texel, shared-switch, sRGB raw view,
swizzled packed and texture-interpreter families. Deleted the tests of
the emulated linear filter over raw sRGB codes (constexpr and runtime),
the runtime sampler's one-texel raw sample and its switch, the shader's
linear depth comparison, the bicubic small-level comparison against the
linear emulation and the depth read's class conversion; the shared
switch keeps the bicubic emulation alone. A NaN texel's half read only
needs to read a NaN under the default policy.

Docs: HalfSampleFilter, FloatSampleFilter, SrgbTexelDecode,
AnisotropicFilter, DeviceAnisotropicFilter, ViewBaseTexelOffset and
HalfTexelConversion in artifact.rs, RuntimeFact::TexelFormat, the heap
class flag, texel_format_spec and a few comments that still named the
emulated linear filter, snapped gathers or the shader's comparisons.

Verified: plain clippy over the workspace with all targets and
features; the touched families under nextest (see the next commits for
the full runs).
2026-10-28 17:24:20 +02:00
Anees Iqbal 6063e66a7c Drop the retired degrade codes
The owner asked for the retired notice codes to go. A kind that no longer
fires is now removed with its code, as any removed public item is; nothing
keeps the history of codes.

- Degradation::RETIRED_CODES (18 codes) is gone, with its rows in
  api_signatures.tsv (re-blessed).
- tests/degradation_codes.txt, the list of every code ever issued, and
  every_code_ever_issued_is_live_or_retired, which held it equal to the
  live and retired codes, are gone.
- codes_are_distinct_and_decode no longer checks retired codes, and
  the_catalogue_lists_every_kind_and_only_them no longer reads retired
  lines.
- docs/API.md's catalogue loses its 18 retired entries; the contract line
  and the runtime's module docs say a code is never renamed, and a kind
  that no longer fires goes with its code. CONTRIBUTING.md drops the
  ever-issued list's rule.
- Validation's C3 test drops the retired code from the announced list it
  judges.

Verified: metal2vulkan-runtime's degradation, catalogue and degradation-site
tests (17 of 17) and validation's
an_announced_deferred_near_equivalent_stays_open_with_its_reason pass;
signatures.py --bless leaves two fewer records.

Originally 3f7ced85af (archive/development-linear-2026-10-28).
2026-10-28 17:24:20 +02:00
Anees Iqbal cee7431132 Record, per refusal, why Metal is believed to refuse the input
The steps this packet landed as, in order:
- Record the runtime sources' hash after the refusals' basis lines

Content: the tree of `development` at 75f847189a, unchanged.
2026-10-26 13:19:18 +02:00
Anees Iqbal 2bd6f6fcf8 Record none of a pending dispatch's commands once a rebind freed what they name
The steps this packet landed as, in order:
- Pin the published crates' public surface by signature

Content: the tree of `development` at e46d17fe41, unchanged.
2026-10-26 13:19:17 +02:00
Anees Iqbal d90ac1ec86 Tell a contributor to bless the inventory, not to hand-write it
The steps this packet landed as, in order:
- Tell a contributor to bless the inventory, not to hand-write it

Content: the tree of `development` at 85b6434430, unchanged.
2026-10-26 13:19:16 +02:00
Anees Iqbal acea7ad20b Measure how much of each Metal enum the conformance suite compared
The steps this packet landed as, in order:
- Wrap the option-space axis's two overlong lines
- Blank a source for the hand-modelled scan only where a match needs it
- Remove the self-test's trees when it is done with them
- Say that a sweep by ordinal states no value by name
- Record why an ordinal-stated value must not be resolved by field name
- Re-derive the generated documents at the landing tip

Content: the tree of `development` at 9e1c5a54d5, unchanged.
2026-10-26 13:19:12 +02:00
Anees Iqbal 92764d0935 Give worktrees the observations as copy-on-write clones of the main worktree's
Content: the tree of `development` at 09b2cb97e7, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal d022f229a7 Add scripts that cut a machine's disk writes from worktrees, targets and traces
Content: the tree of `development` at 6213cb4128, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal a97f7c2757 Keep Metal's contract for host imports and shadows: no posted deallocator, no copy back over CPU bytes
Two fast paths that broke Metal's contract are gone: the posted deallocator of a released host
import and the shadow copy back over bytes the CPU may write. A released import is freed in the
call, as Metal frees it, and a shadow merges back only the bytes the GPU changed. The notice codes
of the two retired kinds are retired too, and the runtime holds the list of every notice code ever
issued so a retired code is never reused. The keep-alive lanes wait for the keep-alive that goes
with an import's free.

Folds in:
- Free a released host import on a handler thread by default (later removed)
- Copy a shadow back over bytes the CPU may write by default (later removed)
- Remove the shadow copy back over CPU-written bytes and the posted deallocator, which broke Metal's
  contract
- Wait for a keep-alive that goes with its import's posted free in the keep-alive lanes
- Retire the codes of the two removed notice kinds, and hold every code ever issued

Verified by each folded change's own checks; the tree this series ends on is the one verified
at the tip on six GPUs, the CPU suites and lint (see the tables commit).
2026-10-19 00:16:00 +03:00
Anees Iqbal 0175289314 Batch the development-fast round: tessellation without tessellationShader, primitive ids, mesh tooling, color groups, the vk12 floor, runtime timing and teardown fixes
One commit of the 247 on development-fast (720ef1ce9a..9f46fdf80d), squashed at the user's request.

Translator:
- Tessellation on a device without tessellationShader: Metal's tessellator emitted as SPIR-V, a
  one-workgroup scan placing each patch's triangles in Metal's order, and the post-tessellation
  function as a plain vertex stage (EmulatedTessellationDraws; SEMANTICS 1739, ARTIFACT_FORMAT 419).
- [[primitive_id]] on a device without geometry or tessellation shaders, as a flat varying the
  vertex function writes; indexed lists, lines and points drawn de-indexed (RuntimeGap::PrimitiveIdIndices).
- Fragment functions of more colors than the device draws at once, compiled in color groups
  (PrecisionNote::ColorAttachmentGroups).
- Object functions' threadgroup memory from the render encoder; a kernel's mesh draws from an
  indirect command buffer; mesh payload sizing.
- The Vulkan 1.2 floor profile (vk12-floor) and the gates it needs; Metal 27.0.1 answers as the M3 Max.
- Overflow tests in the runtime-built modules by the product's high word (NVIDIA's compiler fails
  the division form), guarded crate-wide by tests::owned_divisions.

Runtime:
- Color-group passes replayed per group over twin depth/stencil; snapshot and copy-back cost cuts.
- Command buffers finish on the queue waiter that saw them; the waiter holds no device handle, so
  a program's drop after its wait is the device's last.
- Every object an encoder was handed held until its command buffer completes; deallocator order
  and announcements.
- Driver defects recorded and announced: ANV counts a visibility sample once per color output
  (visibility-count-per-color); MoltenVK fails pending work when memory that held a device-address
  buffer is freed, so freed memory waits for the work in flight (host-deallocator-delayed).
- RenderCommandEncoder::set_object_threadgroup_memory_length; Visibility::counting().

Validation: mesh tooling (object, mesh and ICB-mesh cases on both executors), the authoring
census closed, the queue storm judged in Metal's unit, load-robust exits and indirect-census
bounds, and the golden hashes, printouts, fixture inventory and authored compile census blessed.

Docs: FAST-PATHS.md trimmed to a ledger of what is true now; API.md's catalogue and accepted
differences, REFUSALS.md and METAL-COVERAGE.md current.

Verified on development-fast before the squash: the full suites on the RTX 5080, RTX 3090,
RX 7900 XTX, Radeon 780M, Iris Xe, lavapipe and the M3 (MoltenVK and the Metal oracle), lint in
every configuration, rustdoc, doc tests, packaging and public case qualification; the timing and
teardown lanes x5 on every venue; the authoring-capability census 16656/16656 with 0 unresolved,
the vk12-floor translation census at 6139 translated with the slowest row 794 ms and peak 126 MiB.
The tree is development-fast's at 9f46fdf80d.
2026-10-16 11:12:03 +03:00
Anees Iqbal 61a2efc7d3 Fix the GPU test failures seen on the 3090, 5080, XTX, 780M and M3
What and why, per failure (all release, --cfg m2v_gpu):

AMD RADV, Ubuntu Mesa 26.0.8 (RX 7900 XTX, Radeon 780M):
- generated_executions faulted the GPU (amdgpu gfxhub page fault, ring
  reset): RADV before 26.2 skips re-emitting a compute pipeline it thinks
  is bound, so the second execution's implicit preprocess ran our kernel.
  New RuntimeDriverDefect::ImplicitPreprocessAfterExecutionSet (RADV at
  every identity but the measured clean 780M at 26.2.4): the runtime
  preprocesses every execution of a range explicitly, then a barrier, then
  runs them preprocessed. RUNTIME_VERSION 1183.
- The validation executor's generated-commands replay had the same fault;
  it now preprocesses apart on the same defect (runtime's
  generated_commands::preprocess_apart, now public).
- float_denormals under fast math: the test checked a / b, smoothstep and
  (a / b) * c bit for bit, but without VK_KHR_shader_fma (26.0.8) the fast
  reciprocal is the device's OpFDiv(1, y), within 2.5 ulp. Those words are
  now checked at Metal's edges there, in full elsewhere.

NVIDIA 615.71.09 (RTX 3090, RTX 5080 Laptop):
- render_commands_and_render_states_run_as_the_executor_compiles_them: the
  executor used Vulkan device addresses as Metal addresses, and NVIDIA's lie
  below 2^32, where a record's address names no buffer. An addressed
  allocation's guest address is now its device address read signed (RADV's
  are sign-extended) plus 2^47 + 2^32, one translation for every allocation.
- the_runtime_probe_measures_the_test_device_consistently: two driver
  answers Vulkan does not allow (3090: a buffer read after a linear-image
  copy over the same memory in one submission reads stale bytes; both: an
  explicit linear pitch the driver does not lay out is moved, not refused)
  are listed with their evidence in the test; the runtime records neither.
- exits (5 tests): vkDestroyDevice takes ~55 ms alone and up to 2 s beside
  other processes' GPU work on the 3090, so the exit-timing tests run alone
  (.config/nextest.toml); the 1.5 s limit is unchanged.
- pipeline_records (5080): the test assumed the driver finds a pipeline only
  in byte-identical records, but NVIDIA's bytes vary per compile and the two
  formats share entry keys. It now copies a compute pipeline's record over
  the render state's records, which no driver can hit.
- compile_worker (5080, under load): a worker faster than the 1 ms sampler
  left no peak RSS. Each worker now reports its own peak (VmHWM on Linux,
  ru_maxrss on macOS) and the parent takes the larger.
- tests::completion (both, under load): slow rounds were the GPU starting
  late behind another process's ~200 ms busy kernel, or NVIDIA's
  vkQueueSubmit returning up to 64 ms late; the completion was seen within
  1 ms of the moment it could be. A command buffer is now judged from the
  later of its GPU end and its submission's return where the device
  calibrates timestamps (from the commit elsewhere, as before).
- first_use::new_resources_wait_for_no_gpu_work (both, under load): the
  busy kernel's rate came from one wall-clock run, which collapsed under
  load (3 of 28 calibrations), so the busy work lasted milliseconds. The
  rate is now the fastest of every run at every size by GPU time, for all
  four lanes that share it (gpu_times::read_kinds predicts the notice a GPU
  time read emits, for the neutrals test).

Apple M3 Max, MoltenVK 1.4.1:
- heap_textures allows the shadowed-texture route for depth on drivers that
  lay heap depth textures apart.
- The argument-buffer intersection-table test states Metal's own metadata.
- The indirect lane classifies the deferred pipeline-making failure as
  compile-failed alike and keeps only the failed pipeline's error; Apple's
  33-bit closed-form compiler crash is a known gap in docs/FAST-PATHS.md.

Docs: CONTRIBUTING.md and docs/VALIDATION.md say the golden tables and the
compile census are re-blessed on development.

ENGINE_EXECUTOR_ABI is vulkan-engine-v181 (the RADV replay and the Metal
addresses change what the executor submits): every recorded candidate row
and the authored compile census go stale and need re-recording
(scripts/rerecord-venue per venue, rerecord-commit, corpus-status --c3,
corpus-triage --audit authored-compile --bless).

Still open: M3 frees_in_flight, XTX bfloat clears, 780M half NaN blur and
the 5080's one 2 s rebind_bytes_no_copy did not reproduce; the wall-clock
busy calibrations of framebuffer_fetch/storage_forms.rs and queue_storms
remain.

Verified:
- um780 full suites at the AMD fixes (before the executor and NVIDIA
  commits): XTX 3535/3535, 780M 3535/3535, no amdgpu kernel lines.
- Each fix's focused tests before and after on its GPUs (in the agents'
  commits: e.g. generated/indirect 178/178 on XTX and 780M at 26.0.8 and
  26.2.4; candidate 229/229 on 3090, 780M and Iris Xe; the worker peak 0
  of 1440 under 24-way load on the 5080).
- The combined tip: fmt, clippy (with and without --cfg m2v_gpu) and
  rustdoc on ms01; clippy of the validation crate on macOS; a focused run
  on the 3090 was stopped at 333 of 334 passed, none failed. No full suite
  ran on the combined tip.
- The completion and first_use fixes: 3090 load set 1 of 4 runs failed
  before, 4 of 4 passed after (completion) and 12 runs with no first_use
  failure (84 calibrations, 10.19M-11.24M loads); 5080 6 of 6 and 12 of
  12. fmt and clippy (no cfg, m2v_gpu, m2v_cpu_icd) on ms01.
2026-10-13 01:15:18 +03:00
Anees Iqbal 13b279df1b Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since 43c46ac8 into a single commit. Its tree is
identical to the tree of private master at
b3c77f2d2b20a432be10591a2129547c10b1c24b.

- A Cargo workspace of five crates under crates/: metal2vulkan (the
  translator and the metal2vulkan command), metal2vulkan-runtime (the
  Metal API on Vulkan), metal2vulkan-air (the AIR front end),
  metal2vulkan-validation and metal2vulkan-devtools.
- Dual license: GPL-2.0-or-later OR LGPL-3.0-or-later.
- docs/: API, architecture, fast paths, how-to, Metal coverage,
  refusals, runtime porting and validation guides.

Private-Commit: b3c77f2d2b20a432be10591a2129547c10b1c24b
2026-10-11 20:09:13 +03:00
Anees Iqbal 43c46ac8a2 Squash 680 commits of translator, validation, and corpus work
Rolls up everything since 9e0e99a4 into a single commit:

- src/native, src/passes, src/reflect, src/meta: AIR intrinsic lowering,
  access-chain and pointer handling, constant/composite dedup, storage
  and descriptor-slot fixes, function-constant folding.
- validation/: Metal and MoltenVK oracles, triage, observation contract,
  and the case runner.
- validation/corpus and fixtures: new authored cases and re-recorded
  candidate observations at the shipping fingerprint.
- tests/: module-level oracles for reflection, NonWritable, gated
  varyings/system values/descriptor slots, loop budget, and fallback.
2026-09-06 23:58:13 +03:00
Anees Iqbal 08970cacd2 Consolidate translation, linkage, and validation work
Squash 147 commits (2026-08-20 through 2026-08-31) into one change on top
of the exact-kernel-grid work. Covers native lowering and pointer/layout
construction, AIR intrinsic and funnel-shift coverage, BDA address
preservation across aggregate calls, CFG structurization, function-constant
and visible-function specialization, the 30-second translation ceiling, the
authored-case corpus and linkage validation suite, and refreshed byte-exact
MoltenVK evidence.

The kernel-grid lowering in this tree supersedes the 324-line variant in
the parent commit; that file is reduced to its current 139-line form here.

Resulting tree is identical to 7174c7b. Prior history remains reachable at
tag pre-squash-backup and branch backup/pre-squash-7174c7b.

Claude-Session: https://claude.ai/code/session_01D1u4vU7Mr5QNWrnnRHC8iS
2026-08-31 09:03:42 +03:00
Anees Iqbal 8b78eaca3b Expand macOS 26 AIR translation coverage
Overhaul the validation workflow around sharded authored cases, dependency-exact observations, incremental indexed corpus audits, bounded parallel translation, and native Metal/Vulkan comparison.\n\nExpand native AIR lowering, reflection, linked-function specialization, resource and stage-interface support, and structural CFG/pointer repair across the harvested macOS 26 corpus. Add exact intrinsic inventory, distributed 16x16x16 matrix lowering, explicit opaque tensor linkage, and regression coverage for the newly supported feature classes.\n\nThe final corpus verification accounts for all 88,819 indexed AIR modules under the current product fingerprint: 65,355 translate and validate directly, 23,464 require exact authored linkage, and zero fail or remain unresolved.
2026-08-13 21:46:27 +02:00
Anees Iqbal 6a14365536 Rework validation corpus workflow around ledgers
Replace the old drift/harvest scripts and generated corpus-test path with
Rust validation binaries that use JSONL ledgers as the durable corpus and
execution record.

- Move translate banking from validation/corpus/drift-ledger.jsonl to
  validation/corpus/metal2vulkan-ledger.jsonl, and seed tracked Metal and
  MoltenVK execution ledgers with hash-identified rows and output_b64
  payloads.
- Add corpus-harvest, corpus-mint, corpus-remint, corpus-why, corpus-triage,
  and corpus-run-{metal,vulkan,moltenvk} binaries for shard harvesting,
  additive/remint translate banking, single-case fallback inspection,
  status triage, and backend execution.
- Rework corpus runners to infer execution plans from shard-backed AIR at run
  time, merge per-run deltas into sorted ledgers, support focused reruns, and
  keep Metal oracle coverage available for translate FALLBACK rows while SPIR-V
  backends remain gated on translate status=ok.
- Bound control-parameter seeding and add loop-budget instrumentation,
  quarantine handling, subprocess timeouts, Ctrl-C worker cleanup, slow-case
  logging, panic backtraces, and MoltenVK/Homebrew Vulkan discovery for safer
  offline execution.
- Consolidate validation helpers for AIR stage/entry parsing, corpus source and
  shard resolution, hashing, JSONL I/O, texture shape policy, translate-ledger
  rows, runner status rows, and triage summaries.
- Remove obsolete Python drift/harvest scripts, generated corpus stubs,
  broken/tolerances sidecars, TOOLCHAIN.lock, and unused validation harness
  modules from the repo surface.
- Update validation, corpus, A/B, architecture, contributing, and agent docs,
  plus gitignore rules, to describe the shard-backed ledger workflow and its
  expected generated artifacts.
2026-07-23 20:01:24 +03:00
Anees Iqbal 3007485352 🆕 Open Source metal2vulkan 2026-07-22 13:15:24 +03:00