Commit Graph
8634 Commits
Author SHA1 Message Date
Anees Iqbal c44e588007 Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-21 02:56:16 -08:00
Anees Iqbal d459b4f140 rt: the extension test expects the indirect commands' pair; the conformance ledger follows the ICB states
Fixes forward the two reds the quick check m3-max-62773 found at f3f661dd14 (msi, lavapipe).

1. tests::device::every_device_of_the_cfgs_kind_enables_the_consumers_extensions_it_offers
   expected the device's extensions without VK_EXT_device_generated_commands and
   VK_KHR_maintenance5. The runtime is right. Device creation enables the pair for itself where
   the device lists both and reports their features (floor::INDIRECT_COMMANDS, after the
   barycentric one; Capabilities::indirect_commands), and the indirect command buffers need
   them. So the test now expects the pair after the barycentric extension, where device creation
   took it (core.indirect is Some). Capabilities::extensions' doc now names the pair too.

2. The conformance replay on lavapipe found 46 drift lines in known-gaps-rt.tsv. The ICB rows
   expected a refusal at the state ("pipeline states for indirect command buffers are not
   built"). Render states for indirect command buffers are now made, so each case runs on to a
   later refusal. None of them passes. 19 stale rows are replaced by the 27 the replay gives,
   every venue alike ('*': each is decided before any device query):
   - compute pipeline states for indirect command buffers: Gap::IndirectCommandBuffers,
     ComputeCommands, refused on every device (blit copy, optimize and reset, the compute
     command rows, bind-count limit, pipeline-facts-compute-described);
   - the side's indirect_command_buffer call, which the side does not port yet (the render
     command rows drawn, executed, inherited-state and under-the-pass-state);
   - the render pipeline facts the side does not answer (device, label and the three tile
     getters) of the two-attachment and multisampled states, worded as their siblings';
   - the patch-draw case's indexed pipeline: the translator makes none (Tessellation,
     NotImplemented);
   - indirect-render-commands-vertex-stride: the translator refuses the stage_in attribute
     (invalid descriptor: VertexAttribute { attribute: 0 }). This is a bug of ours and the row
     says so. A state made for indirect command buffers lowers its vertex function pulling
     every attribute, but LinkInputs::render_variant does not set pull_every for it, so the link
     resolves the attribute as fixed function and refuses the mismatch. The fix belongs in the
     translator's link; it is not in this commit.
   The descriptor-properties row's reason no longer says rt has no counterpart of the call: rt
   has Device::new_indirect_command_buffer, and the side does not port it.

Verified: cargo fmt --all; the check job is in the lane's report.
2026-11-21 02:52:54 -08:00
Anees Iqbal 71a77a04be Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-21 02:54:43 -08:00
Anees Iqbal 2a054f7785 Translator: the emitted words are the only words check; the size estimate goes
Selection summed a word cost per strategy and per interface part into a `SizeEstimate` and refused
the function `LimitExceeded(SpirvWords)` before emission when the sum passed the cap. The sum was a
forecast, not a bound, and it overshot: a guest kernel (function hash 4cc9c0bb, Iris profile, on
the command-line path) estimated 30,197,397 words against the 16,777,216 cap and emits 8,589,684
(job 62553), so it was
refused for a size it does not have. The cap already held exactly on the serialized module; that
check is now the only one (`pipeline::compile::lower_bounded`). That kernel is now refused by what
it holds, `LedgerBytes` at 450 MiB; a function the estimate overshot that fits the ledger can now
translate (none in this library does).

Removed with the estimate, as nothing else read them:
- `lower::estimate` (`SizeEstimate` and its frame costs), `Plan::estimate`, the check in
  `stage_bound::emit` (which no longer takes the cap) and the selection's block count;
- the word sums that fed only the estimate: the stage interface's (`StageIoPlan::words`, its
  parameter, object, store and rounding costs, and the fragment family's input attachments,
  discards, interlock, sample loop, snapshots, imageblock, storage form, shader stencil, logic
  operation, blends and word merges), the tessellation and mesh interfaces', the dispatch forms',
  a module blob's, the tile staging's, and the emulated tier's and the predicated walk's extra
  words, with `Predication::reloads`;
- the predicated walk's second structurization before emission, which only measured its
  constructs for the estimate (`structurize::emit::construct_words`).
The per-strategy costs and shared-routine costs the `StrategyCensus` reports stay.

Public: `EntryPlan::estimated_words` goes. The consumer's checkout (reims-vgpu at 44d738908a) has 0
hits for `estimated_words` and for `EntryPlan`. `tests/api_signatures.tsv` loses that one row;
`tests/api_surface.rs`'s pinned names do not move (`EntryPlan` stays).

Tests: the checks that the estimate bounds the emitted words go from the tests that also check
something else; the tests that checked only that go (every stage, simd, leaf, tail, coordinate,
bicubic, snapshot, pulled-fetch and shared-switch entry's estimate, the large predicated body under
a multiple of its words, and the skeleton's estimate bound). The word cap's test keeps both sides
on the emitted words: a module compiles at a cap of its own words and is refused one word below.

SEMANTICS 2253: a function the estimate refused can now translate, and the refusal of one that
does not fit names the ledger. docs/REFUSALS.md regenerated: `SpirvWords` has the one site.

Verified:
- The gate on this change over f3f661dd14 (job 62796): fmt, the API signatures, clippy plain,
  --cfg m2v_gpu and --cfg m2v_cpu_icd, workspace Rustdoc and doctests green; nextest of
  metal2vulkan and metal2vulkan-runtime 3464 of 3468, the four reds development's own suites show
  at f3f661dd14 (m3-max-62774): the old render descriptor key, which hashes SEMANTICS_VERSION,
  and the new icb_indexed_extras fixture's golden cells, AIR printout and inventory part, all
  blessed on development.
- Every kernel of the guest library (63, by hash), on the command-line path: intel-irisxe-anv's
  runtime-policy device file, the release command line before (fe1e8780a2) and with this change
  over it, alternately per kernel on one node (job 62742). 62 keep their outcome and their
  output's hash; the one difference is 4cc9c0bb, refused SpirvWords before and LedgerBytes after.
  It is the slowest row and the largest peak on both sides: 2.55 s and 309 MiB before, 2.86 s and
  470 MiB after (it now runs into emission before the ledger refuses it). Total wall 12.0 s
  before, 12.3 s after.
2026-11-21 02:53:10 -08:00
Anees Iqbal c5d4070850 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-21 02:50:45 -08:00
Anees Iqbal ef03053e2d rt README: every form the identity domains refuse is in the known gaps
What: the known-gaps entry for Unsupported{IdentityDomains} now lists each form that
lower::select::identity_refusal names, in the words of its symbol. It also lists the one unnamed
form a census met, a storage texture access without a format. Before, the entry listed only the
argument-buffer forms, the bicubic forms and the sequentially consistent fence.

Forms added:
- an object or mesh function;
- an encoder value outside the identity push fields;
- a buffer argument not reached through its device address;
- a texture argument of a type the identity arrays hold no element of, or one whose state beyond
  its resource ID is read;
- a texture sampled through a sampler the identity sampling does not take;
- a sampler argument whose minimum level or emulated filter the function specializes;
- state of a bound texture or sampler beyond its resource ID (a RuntimeFact);
- constant data past 64 KiB read through memory;
- a resource bound through a descriptor;
- a read of an argument buffer's texture that decodes an extended-range member;
- with no symbol, a storage texture access without a format that the device does not take.

Each item names its test, or says it has none. The entry's lead now covers every form, not only
the argument-buffer tiers.

Why: the planner's check in ruling (b) asked whether all of identity_refusal's forms are in the
runtime README's known gaps. The missing ones land with (b).

Verified: by grep, each of identity_refusal's 16 symbol texts in lower/select.rs appears in the
README. Docs only; no build.
2026-11-21 02:36:53 -08:00
Anees Iqbal 2bbf157668 DevicePolicy::default() is the identity domains; the resident-table domains become RESIDENT_TABLES
What: DevicePolicy::default() now returns the identity pointer and handle domains, the policy
metal2vulkan-runtime compiles under. DevicePolicy::UNTRUSTED is renamed RESIDENT_TABLES. It stays
for the validation executor's own context (candidate/platform/compute.rs and the engine tests
that build a resident root and a handle table themselves) and for the translator's tests of that
lowering, which name it where they took default() before. The runtime takes default() instead of
setting the two fields itself.

Every tool that took default() now compiles under the runtime's policy:
- the command line's --profile;
- the compile worker;
- the authored compile census, the corpus translation audit and corpus-pipeline;
- acceptance, the tier table and specialization attempts;
- the golden table, whose devices take default() (its policy field goes).

Why: the planner's ruling (b), one policy constructor, so a tool and the runtime agree on the
policy. The description can still differ: --profile takes the profile's description, while the
runtime takes the device's, restricted to the features it enables. repro.rs and README say so.

Docs:
- README's --profile paragraph and the command's help text.
- API.md section 1: the identity domains are listed first, as the default; the resident-table
  domains are the validation executor's.
- device/mod.rs, policy.rs and profile.rs.
- api_signatures.tsv renames the const.
- api_preview's buffer carries a device address equal to its gpuAddress, as the runtime makes it.

No SEMANTICS bump. For a given description and policy, the translator's output is unchanged. The
profile fingerprint covers the policy, so every cached artifact and golden cell whose output moves
does so under a changed key; the golden check reads those cells as re-keyed, a bless due. No bless
here.

Consumer search (consumer-uses.sh) at the consumer's development e76e2ffeb4 and 46 lane refs
younger than a day:
- UNTRUSTED, RESIDENT_TABLES, PointerDomain, HandleDomain and from_queries: 0 hits.
- DevicePolicy: 13 lane refs only, all in the deleted runtime's policy struct (fields this tree no
  longer has); none on development.

Expected census at this commit, not yet rerun: m3-max-62608's identity column, taken at
58bea6ca1c through a scratch policy switch.
- Translation audit, of 17,206 rows: 15,176 translated on runtime-floor, 15,266 on lavapipe,
  15,476 on amd-rdna3-radv and 15,459 on nvidia-rtx50-linux.
- Authored compile census: 6,266 of 7,128 cells.

Verified:
- cargo fmt --all;
- scripts/refusal-surface/refusal_surface.py leaves docs/REFUSALS.md as it was.
2026-11-21 02:36:53 -08:00
Anees Iqbal f3f661dd14 Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-21 02:32:53 -08:00
Anees Iqbal 6fad5cbc61 rt docs: the preprocess bytes of a part, measured, in the known gaps and the idle bound
Every execution now runs in parts of 64 commands, each part's preprocess sized at 64, so the
sizes the README and IDLE_BYTES's doc gave for one execution of the whole capacity were no
longer what an execution takes. Measured with rt's own shapes (a probe test calling
Indirect::shape at 1, 64, 1,024 and 16,384 commands; the probe never lands):

- RTX 2080 (NVIDIA 620.70.06), job m3-max-62671: four buffers 57,600 bytes a part (900 a
  command), 17 tokens 151,808 (2,372 a command); one execution of 1,024 or more: 224 and 592.
- RX 7900 XTX (RADV 26.2.6), job m3-max-62670: four buffers 19,712 (308), 17 tokens 39,680
  (620); one execution: 296 and 608.
- lavapipe (Mesa 26.2.6), job m3-max-62696: four buffers 557,568 (8,712), 134,750,208 at 1,024
  and 8,519,680 at 16,384 (wrapped at 2^32); 17 tokens refused (16 at most).

The README's b1 region line names the part sizes; the parts gap adds NVIDIA's fourfold
preprocess bytes; the lavapipe line says what is true with parts (the wrap is not reached,
each part's size covers the writes and is large). IDLE_BYTES stays 128 MiB; its doc now
says why: one frame of the sample's 45,024 commands in 704 parts of 151,808 bytes, about
107 MB, which a completed frame gives back for a later one.

Verified: cargo fmt --all (no change); docs only.
2026-11-21 02:14:06 -08:00
Anees Iqbal 22ae7df766 rt: indirect command buffers of indexed draws on VK_EXT_device_generated_commands
What: the first cut of Metal indirect command buffers, the runtime's half, in one commit: the
device's extension, the buffer object, the executions, the reset and the pool depend on each
other, and any part alone would be dead code.

- The device enables VK_EXT_device_generated_commands with VK_KHR_maintenance5 together where
  both are reported (floor::INDIRECT_COMMANDS), and nothing else chooses a form. maintenance5 has
  one form here: rt takes nothing of it but the BufferUsageFlags2 a preprocess buffer needs, and
  its A8 format stays untaken. dgc.rs declares the extension's structures by hand, each size and
  offset checked at compile time against the spec's layout; it goes once ash binds the extension.
- IndirectCommandBuffer, IndirectCommandBufferDescriptor and IndirectCommandType
  (Device::new_indirect_command_buffer): indexed draws that inherit the pipeline state and bind
  their own buffers, at most 31 a stage; records in a Private block, reset from the device's
  template at the next commit. gpuResourceID is the records' device address.
- RenderCommandEncoder::execute_commands_in_buffer (a CPU range) and
  execute_commands_in_buffer_with_range (a range read from a buffer, executed at full capacity
  with the SEQUENCE_INDEX token): one PUSH_CONSTANT token a run of slot words, the index buffer
  token and the indexed draw, through the inherited pipeline; the push constants and the index
  buffer are pushed again after an execution. Every execution runs as one
  vkCmdExecuteGeneratedCommandsEXT a part of CHUNK = 64 commands, in order, on every device (the
  planner's ruling: one execution of more drew wrong on the XTX past ~4 MiB of generated commands
  and out of order on the 2080 past 64 sequences); each later part pushes its first command
  (PushField::IndirectBase) and takes its own preprocess offset in the execution's one region. A slot a command binds is pushed the widest bounds,
  unchecked, as a loaded pointer's access is (README, SlotBounds).
- BlitCommandEncoder::reset_commands_in_buffer (copies from the template in regions) and
  optimize_indirect_command_buffer (no work); useResource of an indirect command buffer in the
  compute and render encoders, and RenderCommandEncoder::use_heap.
- Preprocess memory: sized from vkGetGeneratedCommandsMemoryRequirementsEXT with the inherited
  pipeline per (content, raster state, record layout) at a part's 64 commands in a cache of
  SHAPES = 256; layouts LAYOUTS = 64;
  templates TEMPLATES = 16, each at most 64 KiB. Each a fill-past-capacity test. A new pool of
  regions (its own VkBuffer and VkDeviceMemory each, usage2 PREPROCESS | SHADER_DEVICE_ADDRESS, a
  memory type from the requirements' bits, device-local first, rounded to 64 KiB): one taken at
  record time per execution (an idle one at most twice its need, else one made), given back when
  its command buffer retires, the oldest idle ones freed past IDLE_BYTES = 128 MiB. At rest it
  holds idle regions up to 128 MiB, freed at device drop. No execution waits or is refused for
  the pool's sake. Not the block mechanism: blocks are made with the floor's one usage on every
  device, and adding the preprocess bit on DGC devices alone would be a second form; the memory
  types come from the driver's per-layout requirements. Gauges of the used and idle bytes: flat
  between iterations 100 and 200, zero at device drop (tested).
- Typed refusals by name (Gap::IndirectCommandBuffers with IndirectCommandsKind): no extension,
  other command types, per-command pipelines (everywhere), inherited buffers, bind counts past
  31, capacity, an unflagged state, a draw input the commands cannot carry, more tokens than the
  device takes; Refusal::CommandRange for ranges past the commands.
- README: indirect command buffers and their known gaps (b1's two costs, the preprocess cost,
  lavapipe's preprocess size defect verbatim, the Iris, UHD 630 and Mac host lines, the parts
  and their measured cost), the
  extension rows; METAL-COVERAGE and REFUSALS regenerated; api_signatures blessed.

GetDeviceProcAddr audit (verified by grep of the runtime's loads): every device function rt
loads belongs to an extension enabled at the load. calibrated_timestamps is a floor extension;
feedback_loop_dynamic_state loads only under the feedback loop; device_fault loads only where
device creation enabled it; external_memory_fd,
external_memory_win32 and external_memory_host load only where enabled(); Dgc::load runs only
where INDIRECT_COMMANDS is enabled.

Verified: see the lane's report (compile gate, lavapipe and GPU device tests).
2026-11-21 01:53:50 -08:00
Anees Iqbal d9ba8d0e72 Translator: GPU-encoded indexed triangle draws into indirect command buffers under the identity domains
What: the first cut of Metal indirect command buffers, the translator's half.

- pipeline::IndirectDrawLayout (public): the record contract the runtime and the lowering share.
  A 24-byte header (capacity, vertex and fragment slot counts and stride as u32, then the reset
  index address as u64 at 16), then command i at 24 + i * stride, stride = 8 (Nv + Nf) + 40:
  the slot words (the buffer's address less 2^31, the word an execution pushes as the slot's
  SlotGuestBase), the index token's data, the sequence index and VkDrawIndexedIndirectCommand.
- lower/access/icb.rs: under the identity domains, a function's render_command
  set_vertex_buffer, set_fragment_buffer, draw_indexed_primitives of triangles and reset write
  the records through the gpuResourceID an argument buffer's command_buffer member holds, each
  only where the command's index is below the capacity (and a slot below its stage's count).
  Every other indirect-command operation stays Unsupported{GpuEncodedIndirectCommands,
  NotImplemented}; a vertex or fragment function without its stage's store feature and a device
  without device addresses refuse by name.
- LoweringInputs::indirect_range with PushField::IndirectRange, PushField::IndirectSequence and
  PushField::IndirectBase: a vertex function of a state made with supportIndirectCommandBuffers
  reads the execution's range and its command (the sequence index plus its part's first command)
  in its first block and draws nothing for a command outside the range, so an execution over a
  range a buffer holds runs at full capacity (one SEQUENCE_INDEX token), in parts. Such a state's
  vertex function pulls every attribute it reads.
- Fixture engine/icb_indexed_extras (MSL we wrote, regenerated by scripts/regen-air-fixtures):
  a reset kernel, a vertex function that reads before its buffer's address, and one of fourteen
  vertex buffers (a state of more tokens than lavapipe's 16). Inventory rows added by hand (the
  fourteen-buffer vertex function's thirteen constant buffers pass the runtime floor's twelve);
  the golden hash rows, the air_input printout and the old render descriptor key come with
  development's bless.
- SEMANTICS_VERSION 2252 and ARTIFACT_FORMAT_VERSION 586 are placeholders one above
  development's (2251 and 585); the lowering's emission and the encoded lowering inputs change.
- docs/API.md states the forms; docs/REFUSALS.md regenerated; api_surface and api_signatures
  carry IndirectDrawLayout.

Why: the cutover's guests encode indexed draws into indirect command buffers from kernels, which
the identity domains refused.

Verified: see the lane's report (compile gate and test jobs, the states-only play).
2026-11-21 01:50:00 -08:00
Anees Iqbal 7fc969bc16 Bless at the pin tip 8a36a49453: the compile census's product fingerprint
What: the authored compile census's artifacts_at line takes the product fingerprint of
8a36a49453. No row of the table changes.

Why: the translator's sources moved with fe1e8780a2 (the ledger keeps the plan's strategy table
charged and releases the typed module's charge at serialization), so the fingerprint the census
records moved with them; every cell compiles or refuses as before.

Verified at 8a36a49453, on the M3:
- census m3-max-62710: exit 0, the one line above its only change;
- bless m3-max-62709: the engine inventory, the golden hash table and the air_input printouts
  re-bless to a 0-byte patch;
- render key m3-max-62711: the old render descriptor key keeps its value.
Development's quick check m3-max-62707 at 8a36a49453: signatures, clippy plain / m2v_gpu /
m2v_cpu_icd, Rustdoc, lavapipe rt 544 of 544, conformance on lavapipe, all green.
2026-11-21 02:28:38 -08:00
Anees Iqbal 0f3cce524d rt: a released index waiting for work is vacated on the block-maker thread, before releases_waiting falls (fix forward of 39b0efc6e7)
What: the block-maker thread vacates a ripe Free::TextureIndex or Free::SamplerIndex itself
(reaper::free), as Pool::release does on the releasing thread when nothing is in flight, and
lowers Gauge::ReleasesWaiting only after that. Views, images and device samplers still go to the
reaper. Docs: releases_waiting says what it counts (an object stops counting once it is handed to
the reaper, which frees it next); release_indices, IndicesInUse, new_texture and the README's
set-1 paragraph say when IndicesInUse clears: once the command buffers committed before the
release retired and the block-maker thread vacated the index, on its first pass after the
completion thread's round that retired them, behind the frees ahead of it there. The README's
known gap for a wild pointer gains the planner's sentence: on a driver that reports no loss, such
a read can stall the device with no error, and the runtime's waits end only on a loss the driver
reports (62569's 10-minute Xid 109 hang on the RTX 3090).

Why: dev's quick check m3-max-62673 at 52ee4de509 failed argument_tier's held-release test on
lavapipe: "an object lives at Texture index 1 of the grant". The block-maker lowered the gauge
and handed the index to the reaper, so the gauge and allocations_freed could read done while
the reaper had not yet vacated the index: a consumer retrying release_indices right after the
retire could still meet IndicesInUse.

Locks: the handoff runs with the pool's lock dropped. vacate_texture and vacate_samplers take
only the arrays' grants lock, a leaf (inside it only descriptor writes and counter atomics), and
already run on any releasing thread and on the completion thread at a retire.

Test: the held-release test now holds the reaper thread (a job that waits on a channel) from
before the releases until the grant is returned, so the return depends on the block-maker thread
alone. Before this change that order refuses every time; the 62673 failure is its before-run.

Product lines (comments left out): +6 -1 in memory.rs.

Verified: cargo fmt; signatures --check; refusal surface regenerated (no change). Its check (fmt,
clippy under m2v_gpu and m2v_cpu_icd, workspace doc, lavapipe) follows; the report names it.
2026-11-21 02:24:41 -08:00
Anees Iqbal 8a36a49453 rt tests: argument_sampling imports HeapRange inside its GPU hazard (fix forward of 2d0c57661d)
What: the hazard test's one import of HeapRange moves from the module's import list into the test.

Why: under --cfg m2v_gpu without m2v_gpu_hazards the test is compiled out, so the module-level
import was unused and clippy -D warnings failed. That was the gate of 39b0efc6e7 (as
39b0efc6e7), job m3-max-62653: clippy_gpu red; fmt, signatures --check, clippy (all features),
clippy under m2v_cpu_icd, workspace doc, rt tests and lavapipe (541 passed) green. The hazard
archive builds, under both cfgs, compiled it.

Verified: cargo fmt; clippy under --cfg m2v_gpu and under m2v_cpu_icd in the job this commit's
report names.
2026-11-21 02:13:24 -08:00
Anees Iqbal fe1e8780a2 Ledger: the plan's strategy table stays charged; the typed module's charge goes at serialization
In process the ledger is a translation's memory bound on live bytes: it refuses past 450 MiB so
the attempt holds under its 500 MiB ceiling. Selection charged the strategy table (one entry per
value) and the facts while it ran and released both when it returned, though the plan holds them
through emission, the roll and serialization. They now stay charged; only the walk's per-value
scratch goes. A guest kernel (function hash 4cc9c0bb, Iris profile, the size estimate lifted)
tripped at ledger 448.7 MiB with 538 MiB live in the attempt (job 62539); with this change it
trips at 450.0 MiB with 455 MiB live, 5 MiB uncounted (62588).

The other direction: the builder's growth, charged during emission, stayed on the ledger after
serialization consumed the typed module. `Emitted::held` carries it, and it goes when
serialization does: at serialization the ledger falls from 211.1 to 89.1 MiB with 90.0 MiB live
(function hash 16d856fc), and from 539.5 to 245.8 MiB with 199.5 live (4cc9c0bb under a raised
cap) (62611 against 62588).

The runtime README says what the bound is: live bytes. While an attempt ran, resident memory
stayed within about 10 MiB of them (16d856fc: 250.3 MiB live peak, 256 MiB resident peak; 62588);
after it returned, glibc kept about 140 MiB of it resident (18 MiB before, 158 after, 32 after
malloc_trim(0); 62601), which is the consumer's to return.

Verified:
- tests::ledger_resident (new): a function of 6,000 float operations applied 16 times in a chain
  (the applications roll into one loop), compiled for runtime-floor under ledger caps of 1/8 to
  7/8 of its uncapped peak. Each is refused LedgerBytes holding at most the cap and a ninth (the
  ratio of 500 to 450); uncapped, it holds at most its ledger peak and a ninth. Fails on
  development (62576: 45,049,929 bytes held at once against a ledger peak of 32,733,356, 1.38x);
  passes with this change (62604: 45,049,929 against 45,553,651; every cap held under the cap).
- The measurements above: release command line with a counting allocator (a probe that does not
  land), on the guest library's two kernels, by hash.
- The change moves only what the ledger counts: no emitted word depends on it, and a module is
  refused LedgerBytes only where its live bytes reach the cap.
2026-11-21 01:58:21 -08:00
Anees Iqbal 52ee4de509 rt: a commit takes the Managed ranges named since the last, with commands or none
Before this change, a commit captured the Managed buffers' named ranges only if its command buffer
had commands. A command buffer with nothing for the GPU (no commands, or only dispatches the
runtime elides: a kernel that writes no memory, or a grid with no thread) took no submission. So
its copy-in waited for the next command buffer that did submit, and a program's "upload now"
commit uploaded nothing: the upload slid into its next, timed commit, and the wait on the
upload commit covered no copy.

Now every commit captures. In the submit thread, a command buffer with nothing for the GPU that a
copy-in waits for (Captured::waits_for: the oldest captured at or before its commit number, the
taker rule) leads a group as one with commands does. The copy-in becomes its submission, and it
completes after it. Elided dispatches stay elided. One with nothing named still takes no
submission.

Its other answers keep Metal's empty shape:
- It is scheduled as it joins, with its scheduled handlers run before the submission.
- It retires in flight order, with its completed handlers, Completed status and the wait.
- It writes no timestamp, so its GPU start and end are one time (command::retire's empty branch).
- The copy-in counts in runtime_command_buffers with its own timestamps.

This is within documented Metal: a named range may be taken at any commit after the naming. On an
AMD Radeon Pro 5300M, Metal takes it at the first commit whose encoder binds the buffer. The
runtime takes it at the same commit where that commit binds the buffer, an earlier one where it
binds nothing, and never a later one.

Docs: did_modify_range, the runtime README (the Managed section, the empty command buffer, GPU
times) and docs/API.md's accepted difference. The internal docs in capture.rs and submit.rs are
updated too.

Tests: the two device tests of the previous commit, and a host check of waits_for.
2026-11-21 01:49:57 -08:00
Anees Iqbal 492ac7b946 rt tests: a commit with nothing for the GPU takes the Managed ranges named before it
Two device tests over one helper. In each, a Managed buffer is written and named, then a command
buffer with nothing for the GPU is committed and waited for. Test (i) encodes no commands. Test
(ii) encodes one dispatch over the buffer of a kernel that writes no memory, which records nothing
(it asserts dispatches_without_effects rose by 1).

Each test asserts, on a device that keeps two copies:
- At the commit, captured == 256, submissions == 1 and runtime_command_buffers == 1: the copy-in
  is its one submission.
- The command buffer reads Completed with no error, and its GPU start == end > 0.
- The next commit captures nothing, and it reads the bytes from the device copy.

On a unified device the same tests expect nothing captured or submitted.

quiet_step (the step kernel under has_effects false) moves into the compute tests' helpers. The
existing no-effects test uses it.

This commit holds the tests alone, ahead of the fix, so that a run of this commit shows them
failing on a two-copy device without the fix.
2026-11-21 01:49:33 -08:00
Anees Iqbal 39b0efc6e7 rt: a release waits for the command buffers committed before it, one commit-order mark for textures, samplers, idle allocations and imports
What: one mark (memory::Wait) for everything a command buffer may reach with no handle of it.
A release notes the last commit's place in the commit order. It goes once every command buffer
committed up to there is submitted (Work::settled) and that submission completed. With none in
flight (a count kept from commit to retire) it goes at once, as before.
- What waits:
  - a texture's index (its set-1 elements), views and image, and its shadow view;
  - a texture view's views;
  - a sampler state's index and its device samplers;
  - an idle allocation's free;
  - an imported or exported block's free, and with it the import's release.
- How the objects and indices go: the block-maker thread holds them in one FIFO (Pool::release)
  and hands each to the reaper once its wait is over; teardown frees what is left. With nothing
  in flight, an index is vacated on the releasing thread, so its grant may be returned at once.
- What is unchanged: a displaced index; attachment views, pipelines and modules, which their
  command buffers keep. The loose memory (texture allocations, surface plane imports, copies'
  staging) takes no second wait: it comes from the reaper's frees, or from copies.
- New: Gauges::releases_waiting counts what waits. Every device test's teardown reads it zero, and
  the harness compares it at runs 100 and 200.
- Consumer-visible: Gauges gains a field (non_exhaustive, so nothing breaks). release_indices
  refuses IndicesInUse for an index whose texture or sampler state was released under work in
  flight, until that work retires (docs/REFUSALS.md regenerated). A command buffer parked at an
  event wait holds every such release after its commit until it retires (README, in the memory
  and the set-1 paragraphs).
- Docs: new_texture's doc and the README take the new contract and Metal's own answers (the
  consumer's game tool on two Macs, from main), and api_signatures.tsv is blessed for the field.
- Test: one ordinary test, argument_tier's held release. A command buffer at an event wait holds
  a 17 MiB allocation's free and a released texture's index past twice the idle age; once it
  retires, both go. The two hazard tests of the commit before run on a CPU device always, and
  pass only with this.

Why: the consumer's game step loses the device on RTX 3090s (Xid 13, MMU faults). The game tool
remakes heap textures every frame and drops the old ones at once, while the frame in flight still
samples them through set 1 by resource ID, naming only the heap. Before this, rt nulled the
elements and destroyed the views and image at once, under that pass.

Product lines (comments left out): +171 -23 in crates/metal2vulkan-runtime/src.

Verified at this commit: cargo fmt; scripts/api-signatures --check after its bless (the one new
line is Gauges.releases_waiting); docs/REFUSALS.md regenerated (IndicesInUse's row). Before-run on
ms01's RTX 3090 at 2d0c57661d (job m3-max-62569): the address test (argument_tier) hung the GPU
(Xid 109 CTX SWITCH TIMEOUT, no loss rt saw, Xid 31 at teardown). The texture test showed no Xid,
and its lines were lost (the leg's buffered pipe). Its gate and its after-fix hazard run follow
this commit; main's landing names them.
2026-11-21 01:59:43 -08:00
Anees Iqbal 33e402b518 rt tests: the heap-texture hazard drops its textures while a pass samples them too
What: argument_sampling's hazard test gains a third form. A pass of 40,000 hs_sample dispatches
(about 200 ms on an RTX 3090) has its textures dropped 20 ms after its commit, while it samples
them: the consumer's frame f-1. The test now prints the heap block's address range, and for each
form the drop's host time beside the pass's GPU span and rt's DeviceLoss, so a fault's address
and time can be placed. The texture grant takes 6 indices for the three forms.

Why: the one hazard run at 2d0c57661d (job m3-max-62569, ms01's RTX 3090) showed no Xid while
this test ran, but its lines were lost: the leg piped nextest through buffered `cut | head`, and
the job was killed later. In the two forms before this one, the release nulls the set-1 elements
before the pass starts, so the pass most likely never reaches the destroyed image. In the same
run, the address test (argument_tier) gave Xid 109 CTX SWITCH TIMEOUT and hung for 10 minutes
with no loss rt saw, then Xid 31 at its teardown; the card came back on its own.

Verified: cargo fmt. This commit is the base of one replay of this test on ms01's 3090 (main's GO,
because the first run's output was lost); the fix's report names its jobs.
2026-11-21 01:58:42 -08:00
Anees Iqbal 2d0c57661d rt tests: two GPU hazards, memory read by address and heap textures read by index, released under the work that reads them
What: two device tests under the GPU-hazard cfg (docs/VALIDATION.md: compiled on a GPU only
under --cfg m2v_gpu_hazards, run always under m2v_cpu_icd), and the runtime's check-cfg list
gains m2v_gpu_hazards.

- argument_sampling: hs_sample's two textures placed in one Private heap at indices of their
  own, sampled through set 1 by the resource IDs its argument buffer holds, by a pass that names
  only the heap (use_heap). Their last handles drop right after the commit, in two forms: while
  the command buffer waits on an event (committed, not submitted), and while about 200 ms of work
  committed ahead of it on its queue runs. Each form records the device's loss, the command
  buffer's error and whether the pass read the textures as they were, then the test asserts all
  three. hs_sample's state and texel bytes move into helpers the first test shares; gpu_span's
  long-work helpers become crate-visible for it.
- argument_tier: a 17 MiB Shared block, an allocation of its own, read only by address through a
  constant buffer (ab_address) by a command buffer that waits on an event first and names nothing
  of the block; the block's last handle drops right after the commit and the event is set past
  twice the idle age.

Why: today a texture's release nulls its set-1 elements and destroys its views and image at once,
and an idle allocation is freed after the idle age, whatever committed work still reads them. The
tests show what that does on a device; the fix (one commit-order mark for every release) follows
in the next commit, and the tests land with it, since a CPU device runs them always.

Verified: cargo fmt at this commit. It is the base of one hazard archive build and one run of
both tests on ms01's RTX 3090; the fix's commit names those jobs and what they showed.
2026-11-21 01:31:41 -08:00
Anees Iqbal 58bea6ca1c Bless at the pin tip ff940dec22: golden tables, compile census and the render key
The pin after 7d106c865a: indirect draws, depth clip Clamp and fill Lines, cube arrays, passes with
no attachment, several viewports, the geometry-stage and dropped-Layer deletions, the loss error's
driver report, the replay player's use* and fault placement, and the texel-offset unroll
(4e3bf2438b..ff940dec22). Development's checks at ff940dec22: quick m3-max-62519 green (signatures,
clippy plain, --cfg m2v_gpu, --cfg m2v_cpu_icd, doc, rt on lavapipe, conformance replay on
lavapipe with no ledger drift); suites m3-max-62520: product with 11 reds, all bless-owned (the
render key, the golden printout, golden_hashes, llvm_as parts 1-8). GOLDEN read "bless due (output
changed under an unchanged key, but SEMANTICS moved 2245 at the bless 7d106c865a -> 2251 here)".

- golden_hashes.tsv, public_fixture_expectations_engine.tsv and air_input/vertex_amplification.txt:
  the M3 bless at ff940dec22, m3-max-62529 (bless-job.sh, rc 0, patch 173,182 bytes).
- authored-compile.tsv: the census at ff940dec22, m3-max-62530 (rc 0; executor vulkan-engine-v197
  unchanged; result blob a8d08a7919, applied from the job's own diff because its workspace was
  reused). 45 cells move, each by a landed change:
  36 compiled cells and 4 refusals become not_supported{unsupported:not_implemented
  LayeredRendering}: a vertex function whose layer or viewport index is not shown the same across
  a primitive is refused (3ecf606aa8); 5 compiled cells become not_supported{Barycentrics needs
  Feature(FragmentShaderBarycentric)} on profiles without that feature, the synthesized geometry
  stage's weights form being deleted (57855c6097). The rest are artifacts moved with SEMANTICS.
- the_old_render_descriptor_key_keeps_its_value: the key m3-max-62531 computed at ff940dec22
  (c2e3aa7731...), the value the test says to write; it moved with SEMANTICS 2245-2251.

Verified: the three M3 jobs above, each rc 0 at ff940dec22 (the key job reports the one expected
failure with its new value); the census table's blob equals the job's.
2026-11-21 01:39:32 -08:00
Anees Iqbal ff940dec22 SEMANTICS 2251 for the texel-offset unroll
Development was at 2250. The canon change earlier in this series changes the translator's output for a
loop nest whose counters decide a texel offset, so every cached artifact keyed on 2250 misses once.
2026-11-21 01:22:36 -08:00
Anees Iqbal cec332eb7a Canon docs: the texel-offset unroll before the branch unroll 2026-11-21 01:22:31 -08:00
Anees Iqbal 1208372eb9 Architecture: canon's unrolling also decides a filter nest's texel offsets 2026-11-21 01:22:31 -08:00
Anees Iqbal 37ff76effa rt test: a filter nest samples alike unrolled and switched
A kernel samples an 8x8 RGBA8Unorm texture through a nearest clamped constexpr sampler at each
texel centre in a 3x3 nest whose counters make the texel offset. With the constants deciding
the counters the translator unrolls the nest (constant offsets); with the inner loop's end
loaded (2 at run time) the offset stays dynamic, a switch over its values on every device (the
runtime never enables maintenance8). Both kernels must write the same 64 sums, bit for bit, and
both the nearest filter's. Unrun yet.
2026-11-21 01:22:31 -08:00
Anees Iqbal 7f070dd3c1 Offset arms test: a decided 3x3 filter nest has constant offsets; a loaded end or 27 runs keeps 256 arms
The filter nest's counters start at -1, step by 1 and leave at 2: 9 samples, 8 with
ConstOffset (the zero offset takes none), no switch, on the armed profiles and on RADV with the
Offset operand's features. With the inner loop's end loaded, or the outer loop running 9 times
(27 runs together), the offset stays dynamic: one switch of 256 arms. Fails without the unroll
form (the decided nest takes the switch).
2026-11-21 01:22:31 -08:00
Anees Iqbal 4e3bf2438b Canon: a loop whose counters decide a texel offset is unrolled, in nests of at most 25 runs
A device without the Offset operand on a sample (no maintenance8, which the runtime never
enables) takes a dynamic texel offset as a switch over all 256 of its values. A 3x3 filter loop
whose counters make the offset (start -1, step 1, leave at 2) gave the rendering sample's
fragment two such switches, and NVIDIA 620.70.06 took 216 s (RTX 3090) and over 300 s (RTX
2080) to create its pipeline. Canon's unroll pass already unrolls a loop whose trip count the
constants decide where a counter decides a branch. It now also unrolls one where a counter
decides the texel offset of a texture operation of its body, where the loop and every loop
nested in it run at most 25 times together, within the pass's existing ceilings, in rounds
before the branch rounds, kept whatever their size: each offset is then a constant on every
device. A loop past those bounds, or whose runs are not decided, keeps its armed offset.

SEMANTICS moves to 2251 in this series' last commit.
2026-11-21 01:22:30 -08:00
Anees Iqbal 35b16445e4 api_signatures: FaultAddress's Debug is its own impl (fix forward of 6b1367b6c5)
6b1367b6c5 replaced FaultAddress's derived Debug with an impl of its own (ash builds without its
debug feature, so vk::DeviceFaultAddressTypeEXT has no Debug), but left the signatures table at
the derive. The table now records the struct without Debug in its derive list and the
impl fmt::Debug for FaultAddress. Nothing breaks for a consumer: FaultAddress is Debug as before.

Verified: scripts/api-signatures/signatures.py --check passes at this tree; it failed at
54c7312a60 (suites m3-max-62458 at 53d429143a: the_public_signatures_are_the_committed_table).
2026-11-21 01:16:38 -08:00
Anees Iqbal 54c7312a60 rt tests: a command buffer's GPU span leaves out what goes ahead of it
Two device tests for the command buffer's GPU start stamp (TOP_OF_PIPE today):

- a short command buffer over a Managed buffer whose 256 MiB were named before its commit spans
  under a quarter of its copy-in's span (the delta of runtime_command_buffer_gpu_nanos), where the
  device keeps a device copy;
- of two command buffers committed back to back on one queue, the first about 60 ms of
  dispatches, the second's gpu_start_time is not before the first's gpu_end_time.

Under m2v_gpu and m2v_cpu_icd.
2026-11-21 00:56:41 -08:00
Anees Iqbal 4961ea6f71 validation: the opened chains blessed for multiViewport and shaderOutputViewportIndex in the floor; conformance coverage regenerated
The viewports' piece (99e5d42deb) puts multiViewport and shaderOutputViewportIndex in the
runtime floor. Blessed on the rebased tree: the runtime floor's device and restricted chains
gain both, now 48 and 56 members (bless_opened_chains, job m3-max-62390, msi-laptop, at
d6c110338d: 1 passed). docs/CONFORMANCE-COVERAGE.md regenerated
(scripts/conformance-coverage/coverage.py; render-state-boxes leaves the ledger), which that
job's the_conformance_coverage_document_is_what_the_sources_derive asked for.

The same job at d6c110338d: fmt, clippy (plain, m2v_gpu, m2v_cpu_icd), Rustdoc, the runtime's
lavapipe device tests and the lavapipe conformance replay (rc 0, the ledger exact) passed. Its
other test failures are development's own at 43f7439dc9 (m3-max-62312): the old render
descriptor key, the engine golden printout, golden_hashes and the llvm_as parts.
2026-11-21 01:00:18 -08:00
Anees Iqbal d6c110338d rt: a translator's viewport and scissor dynamic states are the pipeline's with-count states
The viewports' piece made the pipeline's viewports and scissors dynamic with their count
(VIEWPORT_WITH_COUNT, SCISSOR_WITH_COUNT), but render.rs still compared the translator's dynamic
states (VIEWPORT, SCISSOR) with that list one for one, so every render pipeline state was
RenderPipelineKind::DynamicState (m3-max-62168, at 99e5d42deb). The ash form of a translator
state now maps VIEWPORT and SCISSOR to their with-count states, which the pipeline holds in
their place (VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-04132 and -04133 forbid both
forms).

The translator's tests of target indices (engine_target_indices) that read runtime-floor as a
device without multiViewport now take it below the floor, without multiViewport and
shaderOutputViewportIndex, which the floor now requires: the raw viewport index alone, and a
fragment function's read of a viewport no stage writes, which reads 0 only where the device
cannot declare ViewportIndex (with multiViewport it declares the input). The same fix was made
to engine_selected_indices before development deleted that file (3ecf606aa8).
2026-11-21 00:34:20 -08:00
Anees Iqbal d00c32ecf6 translator: the identity domains push the draw's viewport count to a vertex function that selects its viewport
Under the identity domains a vertex function that writes [[viewport_array_index]] was refused
as IdentityDomains (an encoder value the function reads as ViewportCount): the field was not
among the encoder values those domains push. The runtime fills it per draw (the encoder's
viewport count, 99e5d42deb), so the field joins the admitted pushed values beside
RenderTargetArrayLength; nothing else of the form changes. Found by 99e5d42deb's suite
(m3-max-62168), whose viewports device test the translator refused.

SEMANTICS_VERSION 2250, one above development's 2249: such a vertex function now
compiles where it was refused. lower/select.rs and cache/mod.rs are not among validation's
runtime inputs, so runtime-sources.sha256 and RUNTIME_VERSION stay. A test pins the form on
lavapipe's profile (engine_identity_render: rt6_viewports' rt6_select pushes ViewportCount in its
window, depends on RuntimeFact::ViewportCount and stores ViewportIndex under
shaderOutputViewportIndex; both modules L3), and docs/API.md names the pushed count.
2026-11-21 00:34:20 -08:00
Anees Iqbal 99e5d42deb rt: several viewports and scissor rectangles, and the viewport index, through the with-count dynamic states
setViewports:count: and setScissorRects:count: refused any count but 1 (DrawKind::Viewports). They
now take 1 to 16 each, and every draw records them with their count (vkCmdSetViewportWithCount,
vkCmdSetScissorWithCount, core in Vulkan 1.3). VIEWPORT_WITH_COUNT and SCISSOR_WITH_COUNT replace
VIEWPORT and SCISSOR in every pipeline's dynamic states, whose viewport state counts become 0, so
no pipeline is made for a count. Vulkan takes as many scissors as viewports. Each viewport's
scissor follows the deleted runtime's rule (render_state.rs's vk_scissors at 5d725aeec7^): the
rectangle of its index, the one rectangle where one is set, and none past the rectangles set where
several are, each cut to the pixels its viewport covers. A draw's attachment-read area is the
union of what it covers through the viewports it reaches: every viewport set for a vertex function
that writes [[viewport_array_index]] (GraphicsState::writes_viewport_index, now Draws::
selects_viewport), and viewport 0 for any other.

A vertex function's [[viewport_array_index]] is the translator's one form at the floor: its
ViewportIndex output, written 0 at or past the encoder's count (RuntimeFact::ViewportCount), which
the draw now pushes (PushField::ViewportCount -> FieldValue::ViewportCount, refilled when the count
changes). Its fragment function reads the index as written. An index that is not one value across
a primitive stays the translator's refusal at creation, needing geometryShader, which device
creation does not enable. Out of range: none or more than 16 is DrawKind::Viewports.

Floor: multiViewport and shaderOutputViewportIndex join REQUIRED, and the translator is told.
The venue dumps report both true on every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736,
48737 and 61508. shaderOutputViewportIndex is also true in the probes 61359 to 61362 and 61366.
tests/floor.rs, the README floor table, RUNTIME_FLOOR and profiles/runtime-floor.json add them.

The translator's tests that read runtime-floor as a device without the viewport index now take it
below the floor: engine_selected_indices (the raw index alone without multiViewport; the zero
indices without shaderOutputLayer and shaderOutputViewportIndex) and engine_stage_io_tail (the
floor declares Layer and ViewportIndex; the zero index below it). runtime-floor joins the stems
whose fragment ViewportIndex needs MultiViewport.

Also, missed in a5fac6fa9b: the README's pipeline bullet names the depth clip and triangle fill
modes among what a VkPipeline bakes.

Conformance: render-state-boxes leaves known-gaps-rt.tsv; CONFORMANCE-COVERAGE.md regenerated.
Docs: README (encoder bullets, floor table, refusal list), REFUSALS.md (Viewports' doc), the
encoder's built list.

Tests: tests/viewports.rs. rt6_select draws through the viewport of its instance, two viewports
(the halves) and two scissors (the whole target and its top half). Instance 0 fills the left half,
instance 1 the right half's top, and instance 2, past the count, draws through viewport 0, its
fragment reading 2. No pipeline is made, and none or 17 viewports or rectangles are Viewports.
draw.rs drops its two-viewport refusal. floor.rs adds the two missing cases, and the translator
sees shaderOutputViewportIndex.
2026-11-21 00:34:20 -08:00
Anees Iqbal 53d429143a Replay: a lost device's fault addresses are placed among the stream's buffers and heaps
What: the runtime player's `loss` line places each access address of the driver's fault report
among the stream's buffers and heaps, as the play made them. An access's range is the address
rounded down to its precision, `precision` bytes long. The line names each live buffer or heap
the range meets, by address, with the address's offset in it. Then it names each of the last
65,536 released ones it meets, newest first, with the frame and call of the release. It shows
at most 8 of each, then "N more". Where none meets the range, it says the address is outside
every buffer and heap of the stream. The released spans are kept in a bounded queue, filled at
each release. Live spans are read from the object table only when the device was lost. A
texture is placed only through the heap or block it lies in, and the play's own buffers are not
placed. docs/REPLAY-STREAM.md documents the line.

Why: the runtime reports the driver's addresses as given (DeviceLoss::fault) and places none,
since only its caller knows what each range was. The player is that caller for a stream: a
replay that loses the device on a 3090 then says which of the stream's objects the fault hit,
whether it was live or freed (and when), or that it hit none.

Test: new_runtime::tests::a_fault_s_access_is_placed_among_the_stream_s_buffers_and_heaps:
- a live buffer and the live heap it lies in, by address with offsets;
- a page that meets a buffer starting past the address (negative offset);
- two released buffers, newest first, with their release positions;
- an address outside everything;
- the queue filled past its 65,536 entries, so the oldest is gone.

Verified: cargo fmt --all. Build, clippy and the tests run in the job named in the lane's report.
2026-11-21 00:59:14 -08:00
Anees Iqbal 5ea6b63f01 Replay: a render encoder's residency declarations play as nothing
What: the runtime player plays a render encoder's useResource:usage:, useResource:usage:stages:,
useResources:count:usage:, useResources:count:usage:stages:, useHeap:, useHeap:stages:,
useHeaps:count: and useHeaps:count:stages: with no runtime call. Until now each was refused
("not played on a render encoder"), which ended the play. What these calls name is still
noted before the call plays, as for any encoder call (tiled-texture takes, index reads,
covers, place users). docs/REPLAY-STREAM.md lists the eight among what render encoders play.

Why: a recorded consumer stream (run 62101 of the 3090 Xid 13 investigation) stopped at frame
239 on its first render encoder's useHeaps:count:stages:, before any heap-pass draw. The
consumer's runtime backend makes no rt call for these either (reims-vgpu 14c00263ef,
crates/reims-vgpu-vulkan/src/rt_platform/render.rs:310-312 puts UseHeaps and UseHeapsStages in
the arm that does nothing; :301-309 notes a useResources texture's tiled take and
own-index read, and makes no rt call). The runtime's render encoder has no residency call, and
every object of a play is resident.

Test: rt_replay's a_render_encoder_s_residency_declarations_play_as_nothing (device tests,
--cfg m2v_gpu or m2v_cpu_icd). After a triangle, a stream makes a heap and declares all eight
forms on the render encoder, naming the heap and the vertex buffers, then draws again. The play
ends, nothing is skipped and the target checks green. Before this change the first declaration
was refused.

Verified: cargo fmt --all. Build, clippy and the lavapipe device tests run in the job named in
the lane's report.
2026-11-21 00:56:28 -08:00
Anees Iqbal 6b1367b6c5 Runtime: FaultAddress formats its kind by its Vulkan name
What: FaultAddress drops its derived Debug for its own, which prints the address type by its
Vulkan name (the seven VK_DEVICE_FAULT_ADDRESS_TYPE_* names, else "kind N"), then the address
and the precision in hex. The replay player's `loss` line prints each access and instruction
pointer through it.

Why: ash is built without its `debug` feature here, so vk::DeviceFaultAddressTypeEXT has no
Debug, and the derive failed to compile (E0277 at fault.rs:36; gate job m3-max-62271 failed in
every step on it).

Verified: cargo fmt --all. Compile, clippy, Rustdoc and the tests run in the re-run gate named in
the lane's report.
2026-11-21 00:45:34 -08:00
Anees Iqbal 0156925ec6 Runtime: a lost device's loss carries the driver's fault report (VK_EXT_device_fault)
What: device creation enables VK_EXT_device_fault and its deviceFault feature where the device
lists the extension (one of the floor's optional extensions; Vulkan requires the feature of a
device that lists it). At the device's first loss of the runtime's own whose result is
ERROR_DEVICE_LOST (a failed vkQueueSubmit2, or the completion thread's semaphore read or wait),
the runtime reads vkGetDeviceFaultInfoEXT once, counts then records, into the new
DeviceLoss::fault: the driver's description, its memory accesses and its instruction pointers
apart (each a FaultAddress of kind, address and precision, as reported), and its vendor records.
A loss the consumer reports (Device::report_loss) is never read: it may name a device that is not
lost, and the query is valid only on a lost one (VUID-vkGetDeviceFaultInfoEXT-device-07336). The
runtime places no address; the consumer, told of every allocation's map and unmap, places them
among its own blocks and buffers. The replay player prints the loss and its report as a `loss`
line of its report (docs/REPLAY-STREAM.md).

Why: two RTX 3090s lost the device with Xid 13 (Graphics SM Warp Exception: MMU Fault) in a
consumer step, and neither the runtime nor the consumer could say which address faulted.

Public API (breaking): DeviceLoss gains `fault` and is no longer Copy; new DeviceFault and
FaultAddress; floor::Features gains `fault`; OPTIONAL_EXTENSIONS gains VK_EXT_device_fault.
api_signatures.tsv blessed; docs/REFUSALS.md regenerated (unchanged).

Verified: the 11-19 minimal repro (a dispatch reading through a freed buffer's address) with
deviceFault enabled, on um870's RTX 3090 (NVIDIA 620.70.06), job m3-max-62203: the device was lost
at the first empty submission after Xid 109 (11.5 s after Xid 13), and the report gave
READ_INVALID 0xdef63a3000 precision 0x1000, inside the freed buffer's range, and
INSTRUCTION_POINTER_FAULT 0xdefdfeb950 precision 0x10; no description, no vendor records.
2026-11-21 00:45:34 -08:00
Anees Iqbal 3e1069db45 Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-21 00:33:20 -08:00
Anees Iqbal 28f2560c9f conformance: the half attribute rows are lavapipe's own answer under native-half-conversion
3860bf04fc wrote 47 rows of integer-vertex-attributes (int_attribute_to_half4, 16 rows) and
vertex-format-half4 (31) as an open bug, because the value lavapipe hands a `half`-typed
attribute is unrounded where Metal rounds it to nearest even, and whether our module or the
device was at fault was unsettled. The module carries the rounding: job m3-max-62280 (msi, at
d42388b6c9) compiled int_attribute_to_half4 with the command line for the tree's lavapipe
profile (shaderFloat16, no shaderDenormPreserveFloat16, so QuantizeForm::Converted), attribute 0
a Short4. Per vertex the attribute's load is followed by `OpFConvert %v4half` and
`OpFConvert %v4float`; with Metal's constant step each pulled lane takes the same pair (8
OpFConvert), with no NoContraction and no float controls. lavapipe's compiler folds the pair, as
narrow::converted records for it and NVIDIA's, which is the stated bound of
`native-half-conversion`: a value not rounded at all. The rows now say so, in the existing
rule-1 form, each keeping its first differing bits.

docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py).
2026-11-21 00:22:30 -08:00
Anees Iqbal 3860bf04fc conformance: the cases a pass with no attachment opens, read as Metal's or named
What: with a pass with no attachment built (de58250086, 0906aad6e5), the 377 cases the
NoAttachment refusal hid now run on lavapipe (m3-max-62179). Most compare. The 87 lines that do
not fall in four classes, none of them the pass's:
- Notices: the 7 tessellation-partition-* cases (partition-modes-quad and -triangle, -factors,
  -degenerates, -insides-quad and -triangle, -steps; and -scales, which crosses the same modes)
  draw the two fractional modes. Their pipelines announce tessellation-fractional-spacing, which
  the cases did not declare. A new tessellation_sweeps::partition_notices declares it for every
  case that crosses the four modes, as tessellation-rendered-patches does. Only their notices
  site differed, so they get no row.
- Rule 1, 30 rows: the device's fixed-function conversion of a normalized UChar attribute, 1 ulp
  from Metal's correctly rounded value (Metal 0x3efefeff, lavapipe 0x3efeff00 for 127/255; note
  device-vertex-conversion). Also the payload of a Half or RG11B10 attribute's NaN, which the
  fetch keeps where Metal reads 0x7fc00000 (0x7fc02000, 0x7ffe0000; note device-nan-encoding).
  These are rows in the ledger's form for a rule-1 value difference: a note declares its
  notice and loosens no value (replay.rs, NATIVE_NOTES).
- Open bug, 47 rows (vertex-format-half4, and integer-vertex-attributes int_attribute_to_half4):
  a vertex function's half-typed attribute reads unrounded to half where Metal rounds it (Metal
  32767 as 32768, 0x47000000; ours 0x46fffe00). The pipeline announces native-half-conversion;
  whether the module's rounding is missing or the device folds its round trip is open, and the
  bug is in the bug list.
- Unbuilt, 3 rows: setTessellationFactorScale: under a state that does not enable the scale
  (tessellation-factor-scales, 2: no runtime method, already among the README's not-built
  methods), and DrawKind::DividedBaseInstance on a device without supportsNonZeroFirstInstance
  (vertex-step-rate-instances on lavapipe, already a README known gap).
The other 10 lines are development's argb8-targets lines.

Also: the device test draws at 1 and 4 samples, the counts Vulkan requires of
framebufferNoAttachmentsSampleCounts. lavapipe lacks 2, so its state was the translator's
RasterSampleCount refusal (m3-max-62179). CONFORMANCE-COVERAGE.md is regenerated.
2026-11-21 00:22:11 -08:00
Anees Iqbal 0906aad6e5 rt: a pass with no attachment is refused at 0 samples alone, as plain Metal refuses it, measured
What: Refusal::NoAttachmentPass refused a side of 0, and any defaultRasterSampleCount that is not
a power of two up to 64. The first form's basis was ours, and that is not enough: only what Metal
refuses may fail. A new probe, crates/metal2vulkan-conformance/probes/no_attachment_passes.m,
measured plain Metal (the API validation layer off) on an Apple M3 Max, macOS 27.0.1, in job
m3-max-62174:
- a new descriptor's defaultRasterSampleCount is 0;
- a side of 0 makes no encoder (nil), and 64 by 64 at 1 sample makes one;
- a count of 0 ends the process at the encoder (SIGABRT), with or without a draw;
- 4 by 4 at 1 sample runs the counting fragment 16 times, and at 4 samples 64 times.
So the refusal keeps a side of 0 and a count of 0, now with the basis metal-measured. A count
that is no Vulkan sample count now makes the encoder, as Metal makes one at 260 (the low 8 bits,
4; ead49055ec's probe). No pipeline state has such a count, so every draw in it is
DrawKind::AttachmentFormats.

Docs: the variant's doc and basis, the descriptor field's doc, the README bullet, REFUSALS.md. The
probe's header carries what it measured. Test: no_attachment.rs drops the 3-sample refusal case.
2026-11-21 00:22:08 -08:00
Anees Iqbal de58250086 rt: a render pass with no attachment, renderTargetWidth by renderTargetHeight at defaultRasterSampleCount
Until now a pass with no attachment was refused as Gap::RenderPass of RenderPassKind::NoAttachment.
Pass::check now builds it. Its area is renderTargetWidth by renderTargetHeight, and its samples
are the new RenderPassDescriptor::default_raster_sample_count (Metal's defaultRasterSampleCount,
0 by default as in Metal), which a draw's pipeline state must match through the existing
renders_into check (DrawKind::AttachmentFormats otherwise). Vulkan's dynamic rendering of no
attachment takes the bound pipeline's rasterizationSamples alone. The translator already asks
framebufferNoAttachmentsSampleCounts for such a state. Its area is the Vulkan render area
unrounded: there is no load, store or resolve to reach the 32-pixel band.

Refusals:
- Refusal::NoAttachmentPass { width, height, samples } (new) covers a side of 0, or a count
  that is no sample count (a power of two up to 64), Metal's default 0 included. Basis: ours
  (VUID-VkRenderingInfo-None-08994 and -08995).
- RenderPassKind::NoAttachment stays, now for a side past the device's maxFramebufferWidth or
  maxFramebufferHeight (VUID-VkRenderingInfo-pNext-07815 and -07816; EncoderLimits::max_framebuffer).
  Every venue dumped reports 16384 or 32768, so 16384 (Metal's largest side) or more: jobs
  m3-max-48727 to 48731, 48736, 48737 and 61508.

Consumer: reims-vgpu builds rt::RenderPassDescriptor from Default and its fields
(crates/reims-vgpu-vulkan/src/rt_platform/descriptor.rs:412), so it still compiles. Its ops
already keep default_raster_sample_count (reims-vgpu-graphics ops.rs:480), but rt_pass does not
yet pass it on. Until it does, its passes with no attachment are NoAttachmentPass at 0 samples.

Conformance: the rt side sets default_raster_sample_count to 1 wherever its pass has a size, as
the Metal side sets it (metal_side.rs:8940). All 377 ledger rows refused with "a render pass with
NoAttachment is not built" leave known-gaps-rt.tsv: integer-vertex-attributes, the tessellation-*
cases, vertex-format-*, vertex-constant-step-instances, vertex-step-rate-instances.
CONFORMANCE-COVERAGE.md is regenerated. Docs: README (the descriptor, the new pass bullet, the
render pass gaps), REFUSALS.md, and api_signatures (1 field, 1 variant).

Tests:
- tests/no_attachment.rs: engine rt6_attachmentless (the functions a Metal probe drew in such a
  pass) in a 2 by 2 pass at 1, 2 and 4 samples. rt6_mark_sample, which reads [[sample_id]], marks
  every sample of every pixel and runs 4 times the samples. rt6_mark_coverage marks every sample
  and runs at least once a pixel. Also checked: a 4-sample state in a 1-sample pass is
  AttachmentFormats; no width, no height, 0 and 3 samples are NoAttachmentPass; a width past
  the device's is NoAttachment.
- tests/pass.rs: the default descriptor is now NoAttachmentPass at 0 by 0 and 0 samples.
2026-11-21 00:22:07 -08:00
Anees Iqbal 876268aa36 docs: conformance coverage counts rotated_targets among the modules declaring a notice
Regenerated (scripts/conformance-coverage/coverage.py) after bc7d76530f, whose cases declare
rotated-blend-rounding: modules declaring a notice, loosening no value, 43 -> 44.
2026-11-21 00:24:53 -08:00
Anees Iqbal bc7d76530f conformance: the argb8-targets cases whose blend rounds declare rotated-blend-rounding
5db3215260 ("Rotated blends: every blend not exact by construction announces its rounding")
made the translator raise PrecisionNote::RotatedBlendRounding for every blend on an attachment
held with its channels rotated (ARGB8Unorm) but a minimum or a maximum and one whose four
factors are all ZERO or ONE. The argb8-targets cases declared no such notice, so on lavapipe
the ten whose blend rounds (multiply, source-color, blend-alpha, straight, straight-alpha-one,
straight-red-green-alpha, premultiplied, additive-alpha, reverse-subtract-alpha and
subtract-one-minus-alpha) were divergent at case/notices with the notice undeclared, which the
ledger does not list (conf rc=1 in m3-max-62286 and earlier).

Each RotatedTarget now declares crate::replay::notice_allowance of the note's code where its
state rounds by the translator's rule (RotatedTarget::rounds: a blend whose colour operation is
not Min or Max and whose four factors are not all Zero or One), as the tessellation cases
declare their notices: the notices site alone, every texel still compared exactly, and the
unblended, red-alpha and max states declare nothing. Their texel sites keep their ledger rows.
2026-11-21 00:24:27 -08:00
Anees Iqbal 1cad2faaf4 validation: the opened chains blessed for imageCubeArray in the floor, beside depthClamp and drawIndirectFirstInstance
The rebase of the cube arrays onto b71567aca4 took the base's opened_chains.txt in 758b601cbd,
whose own bless was made on a base without depthClamp and drawIndirectFirstInstance. Blessed
again on the rebased tree: the runtime floor's device and restricted chains gain
imageCubeArray, now 46 and 54 members (bless_opened_chains, job m3-max-62335, msi-laptop, at
758b601cbd: 1 passed; clippy of metal2vulkan-runtime and metal2vulkan-conformance passed in
the same job).
2026-11-21 00:23:03 -08:00
Anees Iqbal 758b601cbd rt: cube arrays' opened chains and conformance ledger
The follow-ups of 7cd1103a44, from its suite at 216038a939 (an earlier form of it), m3-max-61809
on gem10:

- opened_chains.txt: the four runtime-floor contexts gain imageCubeArray (members 44, 42, 52 and
  49), from the suite's bless_opened_chains run. Neither runtime-floor.json nor the chains changed
  on development between the two bases.
- known-gaps-rt.tsv: the 87 rows of `cube array textures are not built` (every venue) are gone;
  lavapipe's conformance run held none of them. Where a case's cube-array site now reaches the
  next gap, its row is that gap's: 44 rows, each with the venue and the waiting text of the
  case's same answer at its other texture types. heap-sizes-formats-without-textures (16),
  heap-sizes-unspecialized (12) and heap-sizes-two-plane-cubes (4) name formats no device makes;
  texture-pairs-plain-contents (6) names the consumer's descriptor fields;
  format-footprints-plain-stragglers (1) reaches its texture-buffer step; read-write-tier-
  descriptors' ASTC_4x4_sRGB cube array is made on no venue its other ASTC rows name (780M,
  NVIDIA, RX 550, RX 7900 XTX, llvmpipe; verified on llvmpipe, expected elsewhere). Its
  promised-and-refused row lists the tier's texture buffers alone.
  CONFORMANCE-COVERAGE.md regenerated (7644 ledger rows).
- The validation executor's runtime_texture doc: a cube array stays on the executor's own
  context, no longer a refusal of the runtime's.
2026-11-21 00:19:40 -08:00
Anees Iqbal 7cd1103a44 rt: cube array textures and views, with imageCubeArray in the floor
A cube array texture (`MTLTextureTypeCubeArray`) is built: an image cube-compatible with six of
its layers a cube (`arrayLength` times six layers), whose shader view is
`VK_IMAGE_VIEW_TYPE_CUBE_ARRAY`. Metal's casts with a cube array
(`makeTextureView(pixelFormat:textureType:levels:slices:)`) are built in the same form: a cube
array's subrange of whole cubes, its faces as a 2D texture (one face) or a 2D array (any faces),
six of its faces as a cube, a cube as a cube array of one cube, and a multiple of six slices of a
square 2D array as a cube array where its image is cube-compatible. A pass resolves into a
one-sample colour cube array as into a cube (`Plan::resolves`), and a layered pass renders a cube
array's faces across its cubes (the attachment view of its layers, as for a cube).

`imageCubeArray` joins the floor's required features. Every probed device reports it (vulkaninfo
dumps m3-max-48727 to 48731, 48736, 48737 and 61508: the RX 7900 XTX, every 780M, the RTX 2080,
the RTX 3090, the RTX 5080 Laptop, the Iris Xe, lavapipe, the UHD 630's Windows driver,
KosmicKrisp and the RX 550), and Vulkan 1.4 and Roadmap 2022 require it of every device. A device
without it gets the floor's refusal. The runtime-floor profile and its generator state it
(check_device_profiles: 0 findings), and the floor's missing-feature test has its case.

`Gap::CubeArrayTexture` is deleted (the consumer's checkout at 9bb622a2c2: 0 hits); REFUSALS is
regenerated and the API table loses the variant. The runtime README's texture and view lines,
its resolve line and its floor table say what is built.

Tests, each on every device of the cfg's kind: `tests::texture` round-trips a cube array's last
face (its second cube's); `tests::view` casts a cube as a cube array of one cube, reporting
Metal's array length 1; `tests::cube_views` samples a two-cube `RGBA32Float` cube array at its
second cube and a cube view of its first six faces through the owned fixture
`unk_cube_grad_lod`, every lane reading its face's slice, with `imageCubeArray` enabled; and
`tests::layered` renders a cube array's slices 4 to 9, across both its cubes (the cube-array
layered case, as the layered change landed first).

The conformance ledger's cube array rows and the runtime-floor contexts' opened chains follow in
the next commits.
2026-11-21 00:19:34 -08:00
Anees Iqbal b71567aca4 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-21 00:18:35 -08:00
Anees Iqbal 47c7e3a30f validation: the opened chains blessed for depthClamp in the floor, beside drawIndirectFirstInstance
The rebase of the depth clip and fill mode piece onto fa70528de2 dropped its own bless
(a785e6e275), whose chains were blessed on a base without drawIndirectFirstInstance. Blessed
again on the rebased tree: the runtime floor's device and restricted chains gain depthClamp,
now 45 and 53 members (bless_opened_chains, job m3-max-62316, msi-laptop, at 2a36291a80: 1
passed; clippy of metal2vulkan-runtime and metal2vulkan-conformance passed in the same job).
2026-11-21 00:17:23 -08:00
Anees Iqbal 2a36291a80 rt test: the raster test's Lines viewport lies off the diamonds' ties
What: under Lines the test drew the triangle through a viewport 0.5 pixels right of and above
the target's corner, so the edges inside the target ran through texel centers: x 0.5 down column
0 and y 7.5 along row 7. On lavapipe the line along row 7 drew no pixel (m3-max-62049, lvp leg),
since a line through centers ties at every diamond's corners under Bresenham's diamond-exit rule.
The viewport is now 0.4 right and 0.3 above. The edges lie at x 0.4 and y 7.7, inside each
pixel's diamond away from its corners, and both start at (0.4, 7.7), strictly inside the corner
pixel's diamond. The pattern expected is unchanged: column 0 and row 7.

Verified by the lavapipe and GPU legs that follow this commit.
2026-11-21 00:14:45 -08:00