Commit Graph
2034 Commits
Author SHA1 Message Date
Anees Iqbal 215ee0125b replay: the player plays visibility results through rt; the occlusion pools' gauge in its printouts
What: the replay player on the runtime plays a pass's visibility results instead of stopping at
them. `m2v.setPass` carries `visibilityResultType` (Reset, Accumulate) into the runtime's
`RenderPassDescriptor::visibility_result_type` beside the `visibilityResultBuffer` it already
carried, and a render encoder's `setVisibilityResultMode:offset:` plays as
`RenderCommandEncoder::set_visibility_result_mode` (Disabled, Boolean, Counting), whose counts rt
writes into the buffer at the pass's end. What rt does not build is skipped and counted as every
render command gap is (`skipped_render_commands`, a line per kind with its first frame and call):
a mode in an `Accumulate` pass is `Draw { kind: AccumulatedVisibilityResults }`, and a mode rt
refuses as Metal's validation does (no buffer, an offset off 8 or past the buffer, an allocation
byte off 8, an offset taken before) is `Refused(KIND)`, keyed by the refusal's kind alone, the
encoder's mode unchanged. Any other runtime error still ends the play. The player's two gauge
printouts, the frame-end `live` set and the at-drop list the matrix holds at 0
(`M2V-MATRIX gauge replay-rt/device/GAUGE@drop`), add `occlusion_pools`.

rt: a test runs 200 command buffers one after another, each a pass that sets `Counting` and draws;
the occlusion pools read 1 after the 100th and the 200th (a command buffer gives its pools back
before `wait_until_completed` returns), the word 64, and 0 once the device drops. The README's
visibility section says what the gauge counts.

Docs: docs/REPLAY-STREAM.md says the backend plays visibility results, lists the two skipped forms
under the skipped render commands, drops the visibility result buffer from the pass properties the
runtime does not hold (a skipped one still skips the encoder), and names the query pools among the
frame-end gauges.

Why: the planner's ruling for the visibility follow-ups: the player plays the visibility calls a
stream records through rt, counts what rt refuses, and the occlusion pools get the leak gauge
every resource kind has.

Verified: cargo fmt. rt_replay (lavapipe): a Reset pass's Counting and Boolean words (16 and 16 for
a 4 by 4 target, the untouched word's bytes kept), an offset taken twice counted as
Refused(VisibilityResultOffsetTaken) at its call, and an Accumulate pass's two modes counted by
their gap with the buffer's bytes kept; the compile and lavapipe jobs are named in the lane's
report.
2026-11-21 07:09:56 -08:00
Anees Iqbal dc03c9e1b5 Validation: delete the own context's indirect-command-buffer and pipeline-state arms
What: since 01ed696846 the engine candidate refuses every committed case with an indirect command
buffer or a pipeline state in an argument buffer before it maps the case (the five runtime-limit
requirements). This commit deletes what only those cases reached:
- platform/compute/{replay,device_replay,device_replay/generated,draw_replay}.rs: the host, device
  and draw replays.
- platform/generated_commands.rs and the context's VK_EXT_device_generated_commands loader.
- The children/registered parameters of execute_engine and execute_engine_render, and the replay
  passes in the render recording.
- engine.rs:
  - PreparedCase.templates and replay_templates, with ReplayTemplate, TemplateCase, ChildCommand
    and CompiledChild.
  - replay_variants, replay_regions, region_sizes and edge_sizes.
  - the replay requests, the run-allocation list and the resident state.
  - compile_child, record_child and replay_variant_request.
  - ComputeCase.objects and ComputeCase.command_buffers.
- graphics.rs: StageResources.objects and command_buffers, RenderCase::objects and
  command_buffers, records_ids, and replayed_draw_in_class.
- argument_buffers.rs: embed_objects, EmbeddedObjects, validate_records, records_ids and
  records_storage. field_words and synthetic_addresses take no records or objects.
- variants.rs: compile_replay_for_shape and DrawForm (the large-buffer and replay forms).
- PipelineRequest::BoundCompute.replay and VertexDraw.form.
- artifact.rs: CompileSubject (its one subject is still labelled "case"), the replay module and
  the uncovered note. case_compiles becomes case_compile: one pipeline per run.
- ToolingRequirement::ReplayedTemplateResources, which only replay_templates raised.
- plan_resources Guest.status is a buffer, not an Option: only the device replay passed none.
A case of the runtime's form (kernel-encoded indexed draws that inherit the pipeline state, no
host-encoded commands) raises no requirement. compute_case and stage_resources now refuse it, and
a pipeline state, as not implemented (executor_not_implemented), rather than drop the command
buffer from the mapping. No committed case is of that form.
Object and mesh cases have no own-context execution arm: engine/mesh.rs serves only the authored
compile census (prepare_compile), so nothing of it is deleted.

ABI: no bump. Every case the deleted code ran has been refused since v207, so no recorded row can
observe the change. The artifact digest of a compiled case is unchanged: same label, same
compile digest. The context still enables VK_EXT_device_generated_commands where supported. That
switch has no consumer now; it is the next commit's (with its ABI number).

Tests: removed the tests of the replays, the templates, the replay variants and regions, the
replay fault verdict, records validation and the replay request. The routing test now keeps an
indirect dispatch on the own context. The artifact, argument-buffer member, graphics, census and
device test call sites follow the new signatures.

Verified:
- Probe m3-max-63595 (homelab-um870-1) on 20b4721524, a tree equal to this commit's, passed:
  fmt, clippy (all features, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc, and validation nextest
  (1332 tests).
- m3-max-63628 (homelab-um870-1) ran the own context's device tests (candidate::tests) on
  lavapipe at this commit: 54 passed.
2026-11-21 07:13:17 -08:00
Anees Iqbal d245bab9d1 rt: an execution over a range the GPU writes counts its parts with a kernel; parts bounded at 2 MiB of preprocess bytes
What: an execution of an indirect command buffer runs in parts of the most commands whose
preprocess bytes, as vkGetGeneratedCommandsMemoryRequirementsEXT answers with the inherited
pipeline, stay at or under 2 MiB (indirect::PART_BYTES), one rule on every device, in place of
parts of 64 commands. The device is asked from one command up, doubling while the answer stays at
or under the bound, then again at fewer in proportion to the last answer until it is, so no answer
at far more commands than a part takes is trusted (lavapipe's grows with the square of the count
and wraps at 32 bits). An execution over a range a buffer holds (executeCommandsInBuffer:
indirectBuffer:indirectBufferOffset:), location 0 included, ends the rendering, runs the
translator's new count kernel (pipeline::own_kernel(OwnKernel::ExecutionCounts), one workgroup a
part, its parameter block pipeline::ExecutionCounts in the ring), one global barrier, and begins
the rendering again; each part's vkCmdExecuteGeneratedCommandsEXT reads its count at
sequenceCountAddress: its commands through the range's last, none past it or wholly before its
location. A CPU-given range runs no kernel. While a visibility result's query counts the draws,
the execution is refused (Gap::Draw VisibilityResultInterrupt, counted), as the rendering cannot
end inside the query. The runtime makes its own kernels once a device, at first use, through the
pipeline cache and layout (runtime src/own.rs), and destroys them with the device. The idle
preprocess pool's bound goes from 128 to 64 MiB: one frame of the sample now takes about 27 MB of
commands' bytes plus at most one part an execution.

Why: an execution over a GPU range ran the buffer's whole capacity, every command past the range
costing its vertex work. Parts of 64 commands cost 61 times one execution's GPU time on the 2080.
RADV fails past about 4 MiB of generated commands in one execution (draws nothing on a 7900 XTX,
loses the device on a 780M): it chains by sequence count, not bytes. The 2 MiB bound is half that.

Verified: on the probe branch (d59701c670), jobs 63460 and 63481 measured the frame of Apple's
rendering sample: at the 2 MiB bound 931.8 us of GPU time on the 2080 (920.0 at whole capacity)
and 588.5 on the XTX. This commit: compile job and the lavapipe rt suite, reported with the sha.
Tests: the count kernel against a brute-force count on the interpreter and valid on every
committed profile; held ranges at 0, past a part, past the commands, and a CPU range across
parts; a held range in a Boolean visibility mode before and after its first draw; the widest
layout's part at or under the bound on every device.
2026-11-21 06:47:06 -08:00
Anees Iqbal 01ed696846 Validation: requirement rows for indirect command buffers and pipeline states
What: five new ToolingRequirement variants for what the runtime does not build of an indirect
command buffer, and for a pipeline state an argument buffer holds. Each one stops only the engine
candidate (Limit::Runtime), so the Metal oracle still runs and qualifies these cases.
executor_contract::case_requirements raises them from the case literals:
- indirect_compute_commands: a command buffer of compute commands.
- indirect_draw_types: a render command buffer whose descriptor allows draws other than indexed
  ones alone (non-indexed, patch, indexed patch or mesh draws).
- indirect_command_inheritance: a render command buffer that does not inherit the pipeline state,
  or that inherits buffers.
- host_encoded_indirect_commands: commands the host encodes into a command buffer.
- argument_buffer_pipeline_state: a pipeline state in an argument buffer (the runtime's pipeline
  states have no gpuResourceID).
The runtime builds kernel-encoded indexed draws that inherit the pipeline state and bind their own
buffers (Device::new_indirect_command_buffer). A case in exactly that form raises none of these.
Object and mesh cases already stop the candidate by mesh_render_pipeline
(executor_contract::mesh), so no new row is needed for them. IndirectCommandBuffer (an authoring
requirement about unobserved contents) means something else and is not reused.
ENGINE_EXECUTOR_ABI goes to vulkan-engine-v207, because these cases' recorded rows came from the
executor's own context. executor_contract is a classifier input, so triage recomputes the census.
In the authored compile census, these cases' cells become their requirement refusals; the census
is re-blessed on development.

Routed: none. No committed case is in the runtime's form:
- indexed-draws-a-kernel-and-the-host-encode has host-encoded commands (and point draws, which the
  translator refuses to encode).
- a-vertex-function-whose-only-effect-is-an-indexed-draw-runs-it inherits buffers.

The 27 committed cases with a command buffer or a pipeline state, by requirement (a case can raise
several):
- indirect_compute_commands: 12
- indirect_draw_types: 12
- host_encoded_indirect_commands: 10
- indirect_command_inheritance: 7
- argument_buffer_pipeline_state: 4

Tests:
- requirement.rs: the new variants are in ALL, stop only the candidate, and are the runtime's
  limit.
- engine_case_families_follow_the_case_literals: the runtime's form raises nothing, and each other
  form raises exactly its own requirement.
- committed_command_buffer_and_pipeline_state_cases_refuse_by_their_requirements (new): eight
  committed cases refuse at preparation, with no device, by exactly their requirements. It
  replaces five tests of the own context's replay and pipeline-state mapping, which these cases no
  longer reach.
- the_census_refuses_command_buffer_cases_by_their_requirements (new integration test): it
  replaces the census test of replay variants.
- The case-literal tests and the argument-buffer-member tests now assert the refusal, or drop the
  command buffer and pipeline state they used to map.
docs/VALIDATION.md names the five requirements.

Verified: gate m3-max-63557 (homelab-um870-1) at c38044230b, the tree of this commit: fmt, clippy
(all features, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc and doctests of metal2vulkan-validation
passed, and its nextest suite passed (1337 tests). Earlier runs on the same branch (m3-max-63495,
m3-max-63532) found the tests fixed above.
2026-11-21 06:58:13 -08:00
Anees Iqbal 02320ca135 rt: the visibility family's test allows a Boolean word's count; as_chunks in the word reader; the coverage document after the ledger's rows
What: the conformance visibility family's table test asserted that no case loosens a word, which
the accepted difference "a Boolean visibility result is the count of samples that passed" now
does for each Boolean offset. It is renamed every_case_is_tabled_and_loosens_only_a_boolean_word
and asserts that every allowance is Loosening::Nonzero under that accepted difference, at an
offset some pass of the case sets Boolean: a Counting word, or any other loosening, still fails
it. The runtime's visibility test reads its words with as_chunks::<8>, which the dated nightly's
clippy asks for in place of chunks_exact(8). docs/CONFORMANCE-COVERAGE.md is regenerated
(python3 -I scripts/conformance-coverage/coverage.py) after the ledger rows the last commit
rewrote: 19 old VisibilityResults rows out, 9 refusal rows in.

Why: check job m3-max-63470 on 3f5c41675b failed these three: clippy under --cfg m2v_gpu and
--cfg m2v_cpu_icd (clippy::chunks_exact_to_as_chunks at tests/visibility.rs:67), the conformance
coverage check, and the visibility table test.

Verified: by the next check job on this commit (named in the lane's report).
2026-11-21 06:37:13 -08:00
Anees Iqbal b5ac9fd07b rt: visibility results, one precise occlusion query per mode, copied into the buffer at the pass's end
What: `setVisibilityResultMode:offset:` builds `Boolean` and `Counting`. Each such mode set is one
segment counted by one precise occlusion query (`VK_QUERY_CONTROL_PRECISE_BIT`), begun in the
pass's rendering before the segment's first draw and ended there at the next mode set or the
encoder's end; a segment with no draw begins and ends its query as it ends, so its word is 0.
After `vkCmdEndRendering` the pass copies the counts (`vkCmdCopyQueryPoolResults`, 64-bit, WAIT)
straight into the visibility result buffer's `VkBuffer` at place+offset, one copy for each run of
consecutive offsets in one pool, before the pass's second barrier (recorded or owed), which orders
them before every later command; a Shared buffer's segment end barrier reaches the host, and a
Managed buffer's write and a texture over the buffer in an image of its own are kept as a blit's
write is. `Boolean` writes the count too, nonzero exactly where a sample passed (Metal documents a
nonzero word; the M3 Max writes 1): an accepted difference in docs/API.md section 10, and the
conformance cases compare a `Boolean` word as nonzero alone.

A command buffer takes its queries from occlusion pools of 256 the device lends it
(`crate::visibility`), each query reset on the host (`hostQueryReset`) as the command buffer
retires or drops uncommitted; the device keeps at most 16 pools free and destroys the rest
(`Gauges::occlusion_pools`). `occlusionQueryPrecise` joins the floor's required features (every
venue's profile reports it; Roadmap 2022 requires it), with the README floor table, the
runtime-floor profile's `m2v_runtime_floor` block and the regeneration script's list.

Refusals: Metal's own, each where the mode is set, the encoder's mode unchanged:
`Refusal::NoVisibilityResultBuffer`, `Refusal::VisibilityResultOffset` (not a multiple of 8, or
past the buffer), `Refusal::VisibilityResultOffsetTaken` (Apple documents each offset as set once
per pass; Metal's validation stops it), and `Refusal::ArgumentPlace` at alignment 8 for an offset
at an allocation byte off a multiple of 8 (VUID-vkCmdCopyQueryPoolResults-flags-00823). Gaps, each
counted and a README known gap: `DrawKind::AccumulatedVisibilityResults` (a mode in an
`Accumulate` pass; `Metrics::accumulated_visibility_refused`) and
`DrawKind::VisibilityResultInterrupt` (a command that would end the rendering while a query counts:
a memory barrier after a writing draw, a draw that moves an attachment to the feedback layout, pays
an owed barrier before an attachment read or copies into a shadow, and, bounded, a draw that looks
at textures over a buffer in an image of their own or reaches a Managed buffer with textures over
its device copy; `Metrics::visibility_interrupts_refused`). Every refusal is checked before the
encoder changes state; a segment's first draw may still end the rendering, before its query
begins. `DrawKind::VisibilityResults` is gone. `RenderPassDescriptor::visibility_result_type`
(`VisibilityResultType`, Metal's `visibilityResultType`) is a field now.

Translator: `PrecisionNote::DeviceOcclusionCount`, the static note of a `Boolean` or `Counting`
result (`RenderCommandEncoder::VISIBILITY_NOTE`), quoting Vulkan's "Occlusion Queries" (precise
counts differ between implementations: fragments killed before rasterization, counts multiplied
per colour output) and "Fragment Operations" (`earlyFragmentMultisampleCoverageAfterSampleCounting`);
its codec tag, ARTIFACT_FORMAT_VERSION 588, validation's allowance (unbounded, no tolerance), the
conformance degradation `device-occlusion-count` among the native notes, and docs/API.md's
catalogue. The dead `Feature::CountingVisibility` (no construction site) is removed with its reach
row. The old runtime's `Device::new` is untouched; the runtime-floor test profile now states
`occlusionQueryPrecise`, which re-keys that profile's fingerprint.

Why: the visibility-cut ruling. A guest that sets a mode got a refusal; it now gets its results,
or a typed, counted refusal where the cut does not build the shape (continuations and a combine
are not built).

Verified: cargo fmt; scripts/api-signatures --bless/--check, refusal_surface (0 without reach or
basis), metal-coverage and conformance-coverage regenerated, check_device_profiles (0 findings).
The compile job (fmt, signatures, clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd, workspace
Rustdoc -D warnings) and the lavapipe rt suite, with tests/visibility.rs (Boolean and Counting
against the CPU's counts, pool reuse and the 16-pool bound past 17, Metal's refusals, Accumulate,
the barrier and attachment-read interrupts), are named in the lane's report.
2026-11-21 06:16:57 -08:00
Anees Iqbal 7c1baad228 rt: overlapping regions of one texture copy in slabs, as from the source before the copy
copy_from_texture refused a copy whose regions overlap in one level and slice of one image (a
texture into itself, or a texture and its view) as Gap::TextureCopy, and the program's copy was
skipped. Metal does not refuse the call; it leaves the result undefined, and an Apple M3 Max gives
each destination texel what the source held before the copy (the conformance crate's
buffer_texture_blits case, which recorded it).

No vkCmdCopyImage may read a texel it writes (VUID-vkCmdCopyImage-pRegions-00124), so
texture_copy now cuts such a copy into slabs along one shifted axis, the one of fewest slabs. Each
slab is no thicker than the shift there, so its two regions lie apart, and the slab at the end the
shift points to goes first, so no slab reads a texel an earlier one wrote: the result is memmove's.
Each slab is one vkCmdCopyImage in the general layout, with an execution barrier (COPY to COPY)
between two slabs, every hazard between slabs being a write after a read. Each extra barrier is
counted. Regions apart remain one slab and one command, and the same region still records nothing.
A shift of 20 texels over a 21-texel row is 2 commands; the worst case, a shift of one texel, is one
command per texel of the region's extent on that axis. No scratch image, no cap.

Gap::TextureCopy keeps its other arms (a multisample texture, depth and stencil both, one pixel
format in two Vulkan formats, 1D with another type); its doc, the rt README's blit section and
docs/REFUSALS.md (regenerated) drop the overlapping arm. The conformance ledger's row for
buffer-texture-blits-overlapping goes, since the rt side now answers that case, and
docs/CONFORMANCE-COVERAGE.md is regenerated.

Tests: overlapping_regions_copy_in_slabs_the_far_end_of_the_shift_first checks the slabs' regions
and order (a 21x1 row shifted by 20, a shift toward lower y, a diagonal shift on the axis of fewer
slabs, regions apart as one slab); the 3D/array host test now expects slabs where it expected the
gap. On a device, every_device_copies_overlapping_regions_from_the_source_before_the_copy copies
toward higher and toward lower x and y, from a view into its texture, along a 3D texture's depth,
and by whole BC1 blocks where the device makes them. Each case expects the source's bytes from
before the copy, one submission, 2 + slabs barriers and no byte copied of the runtime's own.
2026-11-21 06:24:22 -08:00
Anees Iqbal 1d79c26b7a Validation: a render case's argument buffers draw through the runtime
What: runs_render_through_runtime no longer keeps a vertex or fragment case whose function takes
an argument buffer of buffers, textures or samplers on the executor's own context, and it routes a
case that observes an argument-buffer buffer or texture. runtime_render makes each stage's
argument-buffer members the way a kernel's run makes them (platform/runtime.rs):
- each member buffer is a Shared buffer of its bytes;
- each member texture and sampler comes from runtime_textures, with the usage the function
  declares of its field (RuntimeDraw.member_usages, engine::runtime_member_usages);
- each owner holds every member's gpuAddress or gpuResourceID at its field
  (argument_buffers::owner_bytes);
- the render encoder uses each member buffer and texture for reading and writing
  (use_resource).
An argument-buffer buffer output reads back through RenderFinals.argument_buffer_buffers, and an
argument-buffer texture output reads back through runtime_textures::read_back. An argument
buffer's pipeline state or indirect command buffer still keeps the case on the own context.
ENGINE_EXECUTOR_ABI goes to vulkan-engine-v205, because these cases' recorded rows came from the
own context.

What moves: 5 committed fragment cases.
- Public (4): sixteen-overlapping-triangles-update-a-raster-ordered-argument-buffer-member,
  sparse-sample-of-an-argument-buffer-texture-returns-its-value-where-resident,
  sparse-sample-of-an-argument-buffer-texture-states-it-resident,
  sample-in-a-fragment-through-a-sampler-held-beside-its-texture-in-an-argument-buffer.
- Private (1): sample-the-slice-a-runtime-index-picks-from-an-argument-buffer-texture-array.
The other 23 render cases with argument buffers carry visible_function_table (22) or
texture_buffer (1) and run on Metal alone.

Verified on lavapipe, each case through corpus-vulkan against the committed Apple M3 Max macOS
27.0.1 row. Before: own context at b192b89fa1, m3-max-63462 (homelab-gem10-1); each stored row's
executor was engine-render. After: this tree, m3-max-63474 (homelab-um870-1); each stored row's
executor was runtime-render.
- The 4 public cases match Metal on both paths, with the same candidate output digests (ea785a60,
  ebc81c32, 67c145ea, e7e4c872).
- The private case did not run on either node, which has no local source shard for it. It is
  unverified here.

Tests:
- a_plain_draw_and_only_one_runs_through_the_runtime now routes a fragment case with an
  argument-buffer buffer and texture, observed through either. Before, it kept that case on the
  own context.
- The new device test a_fragment_samples_the_texture_an_argument_buffer_holds_through_its_sampler
  draws tail_argument_samplers' argument_sampler_fragment (m.t.sample(m.s, in.uv)) on the own
  context and through the runtime. Both give the texture's rows swapped into the 2x2 target, the
  bytes the committed Metal row holds for the same case. It passed on lavapipe in m3-max-63474.

Gate, m3-max-63474 at this tree: fmt; validation clippy with all features, with --cfg m2v_gpu
and with --cfg m2v_cpu_icd; Rustdoc; the validation suite, 1342 passed, 3 skipped; the two
lavapipe device tests above.

No file this touches is a classifier input, so the authoring-capability census does not move.
The compile census's executor key moves with the ABI (bless on development).
2026-11-21 06:29:32 -08:00
Anees Iqbal c3f9f55e63 rt: a kernel past the stage bound is made from its helper's compile alone, never compiled in the process
A driver's compiler takes memory that grows faster than the stage, in the process that creates the
pipeline. The translator refused every stage past COMPILED_STAGE_WEIGHT (99,109, the heaviest
measured to compile within host-sized memory, ANV on the Iris Xe of RPL-P), where Metal makes it.
Now the translator states the weight and the runtime compiles such a kernel only in a helper
process the consumer starts, caps and times.

Translator: the stage bound refuses nothing. stage_bound::emit still plans a kernel again keeping
its widest-mode pin where only that emulation passed the bound, and returns the module with its
entry weight, now ModuleStats::entry_weight (codec and serde carry it). COMPILED_STAGE_WEIGHT is
public in pipeline. Feature::StageSize and Needs::StageBound are gone. SEMANTICS_VERSION 2257,
ARTIFACT_FORMAT_VERSION 588.

Runtime (new stage.rs):
- Floor: pipelineCreationCacheControl, required and enabled (Vulkan 1.3 requires it), for
  VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT.
- A kernel's VkPipeline of a module past the bound is made from a VkPipelineCache of its own entry
  in the cache directory's stages/ alone, with the fail-on-compile-required flag, the cache
  destroyed when the create returns; the device's shared cache and blob never hold it
  (Metrics::pipelines_from_stage_fills).
- With no entry the make is refused with Error::StageUnfilled(StageRequest), at the state's
  creation, at prepare_dispatch (which now returns Result and reports only this refusal) and at
  the dispatch. A StageRequest is Clone, Send, Sync, Eq and Hash by its stage key, the entry's
  name, so a consumer joins the makes and dispatches of one pipeline into one fill.
- Device::fill_stage writes the request to the helper's pipe, reads its reply and keeps the
  cache data as the entry (Metrics::stage_fills); serve_stage is the helper's main: it opens the
  device of the request's deviceUUID and driverUUID with the parent's options, checks the
  enables, compiles through an empty cache and writes its data. A wire frame is the magic
  m2vstage, the wire version, the length and a checksum.
- Device::record_stage_breach keeps what the consumer ended its helper for (memory, time) as the
  entry; fill_stage keeps a failed compile; a create answered compile-required keeps that. Each
  refuses the pipeline (Gap::StageSize, StageGap::Breach) with no helper asked again, until the
  driver's header changes the key.
- stages/ holds at most 256 MiB and 32 entries, breaches among them, least recently used out
  first (a hit touches the file). An entry that does not check, of another key or another
  driver's header is a miss and is removed. Nothing of an entry stays in memory past the call
  that reads or writes it.
- A device with no cache directory, or whose driver writes no pipeline cache header (lavapipe),
  and a render stage past the bound are refused typed (Gap::StageSize with its StageGap).

The validation runtime executor reports a refused prepare_dispatch; the replay prepass ignores it
as the dispatch reports it again.

Docs: the runtime README's "Kernels past the stage bound" and its known gaps, the stages/
directory, prepare_dispatch's one error, the floor row; docs/API.md's entry_weight;
docs/REFUSALS.md regenerated; the api signature and surface tables.

Tests: tests/stage.rs: the directory past capacity on both bounds, oldest use out first, a hit
outliving older entries, a breach under the same bounds; cut, foreign-key, other-header and
unknown-breach entries a miss and removed; the wire's version and cut frames; the request's
joinable bounds; and on a device (m2v_gpu, m2v_cpu_icd), with the bound lowered for the test, the
refusal with no directory, lavapipe's NoPipelineCache, and elsewhere refused unfilled, filled by
serve_stage over two pipes, made from the entry alone with the shared cache's data unchanged,
then refused by a recorded breach.
2026-11-21 05:55:29 -08:00
Anees Iqbal e6e70666ed Validation: delete the own-context arms of the nine refused families
What: since the refusal rows (d1266e5a5a, a1a47cb9c5), compute_case and render_case refuse a
case of kernel_function_table, kernel_imageblock, texture_buffer, fragment_imageblock,
sparse_texture, kernel_acceleration_structure, kernel_stage_input, rasterization_rate_map or
dynamic_vertex_stride before anything maps it. The executor's own-context code for these
families is reached by no case, so it goes:
- function tables: engine/tables.rs, ComputeCase.function_tables, StageResources.function_tables,
  CompiledCase (the compile functions now return the pipeline), CompileFailure::Tables,
  VariantRequest, the table allocations of compute_shape, and the tables hash of
  CaseArtifact::record;
- imageblocks and tile functions: engine/imageblock.rs, ComputeCase.imageblock,
  RenderCase.imageblock, RenderOutput::Imageblock, RenderFinals.imageblock,
  variants::compile_tile_for_shape, and the tile attachments of plan_resources;
- texture buffers: texel_guard_reach, buffer_target, the texel-buffer views and guards of
  plan_resources, and texel_buffer_bytes;
- sparse textures: platform/sparse_images.rs, device::SparseImages, the sparse paths of
  create_slot_image, the tile-map emulation of executor_contract::sparse, and the executor's
  sparseBinding, sparseResidencyImage2D and sparseResidencyImage3D enables (ExecutorFeature);
- acceleration structures: platform/acceleration.rs and their plan_resources arms;
- kernel stage inputs: the stage-input fetch, stage_in_region and Fetch::of_stage_input;
- rate maps: rate_map_regions, rate_map_pass_census and the per-region draw (a draw now covers the
  whole target in one recording);
- dynamic vertex strides: VertexBuffer.dynamic, DynamicRecord::Strides and
  bind_vertex_buffers2.
runtime_texture was always true after the rows and the cube-array route, so it goes too, and
runs_through_runtime and runs_render_through_runtime take the mapped case alone.
ExecutedCensus.rate_map_pass stays (deny_unknown_fields keeps old rows parsing); every writer
sets None. Enables' Member.registry is now read by the tests alone, so it is cfg(test).

ENGINE_EXECUTOR_ABI goes to vulkan-engine-v204: every artifact digest drops the tables hash, and
the own context no longer enables the three sparse members. opened_chains.txt is re-blessed for
that: each committed profile's chain has 3 members fewer.

Tests removed with the code they held: a_kernel_calls_through_its_visible_function_table,
a_tables_words_are_its_size_and_the_handles_of_its_functions, the_cells_follow_the_reflected_master,
a_plane_must_be_a_master_member_of_its_size, cells_lay_planes_out_at_master_offsets,
the_cells_are_capped, a_guarded_texture_buffer_is_exactly_its_view,
a_texture_buffer_written_past_its_end_is_guarded, texel_buffers_read_one_view_and_write_the_other,
a_tile_map_emulation_maps_exactly_the_cases_texels,
the_new_list_enables_sparse_images_where_the_device_supports_them,
an_oracle_instance_mask_is_refused_typed, a_rate_mapped_pass_is_planned_region_by_region,
a_dynamic_vertex_layout_takes_the_bound_stride and the region and pass tests of
platform/render (now a_draw_covers_the_whole_target). The visible_table fixtures stay: the
runtime's and the conformance suite's tests use them.

No classification moves: executor_contract/out_of_bounds.rs and sparse.rs lose only functions
nothing called. The compile census's executor key moves with the ABI (bless on development).

Verified: gate m3-max-63421 (homelab-um870-1) at this tree before the bless: fmt, validation
clippy with all features, with --cfg m2v_gpu and with --cfg m2v_cpu_icd, Rustdoc, the ignored
bless_opened_chains (its file is the one committed here), and the validation suite, 1342 passed,
3 skipped. Earlier gates m3-max-63393 and m3-max-63412 listed the compile errors fixed here.
2026-11-21 06:12:04 -08:00
Anees Iqbal cf87db0fb7 Validation: a fragment case of no attachment draws through the runtime
What: runs_render_through_runtime no longer keeps a fragment case with no color target and no
depth/stencil attachment on the executor's own context. runtime_render draws it in the oracle's
pass of no attachment (metal::platform): renderTargetWidth and renderTargetHeight 1, and
defaultRasterSampleCount the case's raster samples. The runtime builds such a pass as one
dynamic rendering of no attachment, its area and samples from those three fields. The routing
function's stale comment ("the runtime makes no pass without one") goes, along with the matching
VALIDATION.md sentence. ENGINE_EXECUTOR_ABI goes to vulkan-engine-v203, because these cases'
recorded rows came from the own context.

Executor code removed: multisampled::attachmentless_support and its call in the own context's
Targets::make, the framebufferNoAttachmentsSampleCounts check of a multisampled pass without
attachments. Nothing else reaches it now. The translator already refuses such a pipeline itself
(pipeline/graphics.rs sample_count_properties: RasterSampleCount needs
FramebufferNoAttachmentsSampleCount(N)), and the own context compiles before it makes targets,
so a --profiles-layer run still refuses typed.

What moves: 16 committed cases.
- Public (15): coverage-loop-records-each-sample-at-2x and -at-4x,
  coverage-loop-sample-varying-at-2x, coverage-loop-union-of-runs-at-2x and -at-4x,
  fragment-device-and-constant-pointer-integer-differences, msl-4-1-fragment-seq-cst-atomics,
  coverage-and-pixel-center-read-by-each-run-at-4x, coverage-beside-a-sample-varying-at-2x and
  -at-4x, coverage-beside-the-pixel-center-ored-over-its-runs-at-4x,
  coverage-read-by-each-run-of-a-memory-writer-at-2x and -at-4x,
  coverage-read-by-each-sample-run-at-2x and -at-4x.
- Private (1): void-fragment-no-writes.
- The 17th attachment-less fragment case, gaussian-splat-blended-over-an-authored-imageblock,
  has an explicit imageblock and stays on the own context.

Verified on lavapipe (msi, no GPU), each case through corpus-vulkan against the committed
Apple M3 Max macOS 27.0.1 row, before at a8c2bfbfae (own context, m3-max-63297) and after at
48b14d9dc0 (this tree plus a runs-through-both-contexts edit of the engine_textures cube test that
the cube-array commit does not carry; m3-max-63285, m3-max-63306). Every run after logged through
the runtime path's own validation log; the before-run logged none. Every case gives the same
result on both paths.
- 7 match Metal: coverage-loop-union-of-runs-at-4x,
  fragment-device-and-constant-pointer-integer-differences, void-fragment-no-writes,
  msl-4-1-fragment-seq-cst-atomics, coverage-and-pixel-center-read-by-each-run-at-4x,
  coverage-beside-the-pixel-center-ored-over-its-runs-at-4x,
  coverage-read-by-each-run-of-a-memory-writer-at-4x.
- 3 differ from Metal with the same output digest on both paths (lavapipe's own 4x coverage):
  coverage-loop-records-each-sample-at-4x, coverage-beside-a-sample-varying-at-4x,
  coverage-read-by-each-sample-run-at-4x.
- 6 are refused not_supported{device_capability_missing:RasterSampleCount needs
  Property(FramebufferNoAttachmentsSampleCount(2))} on both paths. lavapipe rasterizes no 2-sample
  pass without attachments, a device gap: coverage-loop-records-each-sample-at-2x,
  coverage-loop-sample-varying-at-2x, coverage-loop-union-of-runs-at-2x,
  coverage-beside-a-sample-varying-at-2x, coverage-read-by-each-run-of-a-memory-writer-at-2x,
  coverage-read-by-each-sample-run-at-2x.

Tests: engine/tests.rs's a_plain_draw_and_only_one_runs_through_the_runtime routes a fragment
pass of no attachment at 1 and 4 samples, which it refused before. engine_render's new
a_fragment_pass_of_no_attachment_runs_each_sample_once draws the owned coverage_natural
nat_sample with no attachment at 1 and 4 samples: each sample runs once and reads its own
coverage bit on the own context, and through the runtime the words are equal (passed on lavapipe
in m3-max-63306).

No file this touches is a classifier input, so the authoring-capability census does not move.
The compile census's executor key moves with the ABI (bless on development).

Landed after the nine refusal rows (v201) and the cube-array route (v202), so the bump is v203 here (v200 on the lane's branch).
2026-11-21 05:42:30 -08:00
Anees Iqbal cb6d9e8b1b Validation: a cube array texture runs through the runtime
What: engine::runtime_texture no longer keeps a cube array texture off the runtime, so a kernel
or render case binding one runs through metal2vulkan-runtime's public API like any other routed
case. runtime_textures already makes cube arrays as the oracle does: arrayLength counts cubes, and
each face slice is written with replaceRegion. A texture buffer still keeps its case on the
executor's own context. ENGINE_EXECUTOR_ABI goes to vulkan-engine-v202, because these cases'
recorded rows came from the own context.

Why: the runtime makes cube-array images and views (imageCubeArray is in its floor), so the
executor kept them on its own context only by its own choice.

What moves: 13 committed cases.
- Public (12): explicit-cube-gradient-combination-table,
  explicit-cube-gradient-component-combination-by-ratio,
  explicit-cube-gradient-component-combination-fine,
  explicit-cube-gradient-turning-points-and-threshold,
  explicit-cube-gradient-minification-threshold-per-face-and-axis,
  gradient-samples-and-comparisons-of-3d-cube-and-depth-textures,
  lod-queries-of-2d-array-3d-cube-and-depth-textures,
  anisotropic-cube-gradients-along-face-columns, anisotropic-cube-gradients-along-face-rows,
  sample-and-query-an-argument-buffer-cube-and-count-a-cube-array,
  depth-cube-and-cube-array-reads-at-32-and-16-bit-coordinates, cube-depth-and-comparison-gathers.
- Private (1): sample-the-second-probe-of-a-cube-array-whose-slices-disagree.
- The two other cases with a cube array also bind a texture buffer and stay on the own context:
  size-queries-of-multisampled-buffer-and-depth-cube-textures and its -at-four-samples.

The own context's cube-array code stays: the CubeArray arm beside Cube that makes an image
cube-compatible (plan_resources). A --profiles-layer run still reaches it, because a restricted
run keeps every case on the own context, and so do the two texture-buffer cases.

Verified on lavapipe (msi, no GPU), each case through corpus-vulkan against the committed
Apple M3 Max macOS 27.0.1 row, before at a8c2bfbfae (own context, m3-max-63297) and after at
7969eaeddd (this tree less the engine_textures revert noted below, m3-max-63281). Every run after
logged through the runtime path's own validation log (metal2vulkan-validation-runtime-PID.log);
the before-run logged none.
- 6 match Metal on both paths with the same output digest: the private case,
  explicit-cube-gradient-combination-table,
  gradient-samples-and-comparisons-of-3d-cube-and-depth-textures,
  lod-queries-of-2d-array-3d-cube-and-depth-textures, cube-depth-and-comparison-gathers,
  explicit-cube-gradient-minification-threshold-per-face-and-axis.
- 5 differ from Metal with the same output digest on both paths (lavapipe's own cube gradients):
  the explicit-cube-gradient component-combination-by-ratio, component-combination-fine and
  turning-points-and-threshold cases, and both anisotropic-cube-gradients cases.
- 2 matched Metal on the own context and are refused by the runtime's identity domains
  (Unsupported{IdentityDomains}, both forms in the runtime README's known gaps).
  sample-and-query-an-argument-buffer-cube-and-count-a-cube-array: "state of a bound texture or
  sampler beyond its resource ID (HeapNumericType ... Cube, arrayed)".
  depth-cube-and-cube-array-reads-at-32-and-16-bit-coordinates: "texture argument ... a type the
  identity arrays hold no element of, or state of the bound texture beyond its resource ID". They
  are runtime bugs, reported by name, and carry no refusal row.

Tests: engine/tests.rs's a_plain_kernel_case_and_only_one_runs_through_the_runtime routes a cube
array texture, which it refused before. engine_textures' cube test stays on the own context: its
texture_ops cube_faces kernel reads a plain cube by face, which the runtime's identity domains
refuse on slot 0 the same way (m3-max-63306). Plain cubes already ran through the runtime.

No file this touches is a classifier input, so the authoring-capability census does not move.
The compile census's executor key moves with the ABI (bless on development).

Landed after the nine refusal rows (v201), so the bump is v202 here (v199 on the lane's branch).
2026-11-21 05:42:16 -08:00
Anees Iqbal d1266e5a5a Validation: nine families the runtime does not build are refusal rows naming their requirement
The family map's first commit (the planner's GO): every committed case either runs through the
runtime or is a refusal row naming its requirement. Nine families of the cases the executor still
ran on its own context have no runtime call, or a runtime refusal at creation on every device. Each
is now a ToolingRequirement of Limit::Runtime that stops only the engine's candidate and keeps its
cases Metal-qualified. Each is raised from the case's literals in executor_contract::case_requirements,
by the template of SeparateDepthStencil and RenderFunctionTable, so no census row carries one:
- kernel_function_table (303 cases): no setVisibleFunctionTable:atBufferIndex:; the make is
  Gap::KernelInput of Slot, held by rt's device test
  kernel_input::a_visible_function_table_kernel_is_refused_as_a_slot;
- kernel_imageblock (51, every tile-pass case among them): no setImageblockWidth:height:; the make
  is Gap::KernelInput of RuntimeFact ImageblockSize (rt's
  an_explicit_imageblock_kernel_is_refused_as_its_named_runtime_fact); no tile function is built;
- texture_buffer (28): new_texture refuses one (Gap::TextureBuffer), held both ways by
  engine_compute::a_texture_buffer_is_refused_where_a_2d_texture_is_made;
- fragment_imageblock (21): refused at creation on every device (Imageblocks, NotImplemented);
- sparse_texture (15): the texture descriptor has no sparse form;
- rasterization_rate_map (12: 8 render-pass maps, 4 kernel cases whose buffers hold map data):
  rt makes no rate map and its pass takes none;
- kernel_acceleration_structure (10): rt makes no acceleration structure and binds neither it nor
  an intersection-function table;
- kernel_stage_input (9): Gap::KernelInput of StageIn (rt's a_stage_in_kernel_is_refused_as_stage_in);
- dynamic_vertex_stride (1): setVertexBuffer:offset:attributeStride:atIndex: is not built.
The nine raise on 450 committed cases with no overlap. No case is deleted.
ToolingRequirement::qualifies_on_metal is now exactly Limit::Runtime (it listed the same eight).

The compile census (authored-compile.tsv) is due a bless here: every cell of the 450 cases moves to
its requirement. All read `compiled` today except 6 texture_buffer cases already
`ulong_texture_atomic` (now `ulong_texture_atomic,texture_buffer`) and 6 kernel_acceleration_structure
cells that read RayTracing device_capability_missing. 4 ICB cases replay a template of these
families, which compute_case/render_case now refuse before the replay check: their
`replayed_template_resources` becomes the template's family:
a-kernel-encodes-the-stage-in-regions-of-its-dispatches and
host-encoded-stage-in-regions-and-attribute-strides-of-executed-commands (kernel_stage_input),
a-kernel-encodes-the-imageblock-sizes-of-its-dispatches (kernel_imageblock),
host-encoded-vertex-attribute-strides-of-executed-draws (dynamic_vertex_stride).
The authoring-capabilities census is untouched: Limit::Runtime rows close without a candidate, and
executor_contract.rs is a classifier input, so cached triage recomputes.

Tests that mapped these families through the own context now meet the refusal. They are rewritten
to assert it: the requirement and case-literal tests, the_case_maps_onto_the_binder_or_names_the_gap,
references_link_and_function_tables_are_typed_gaps, the sparse and rate-map case tests, and the
public argument-buffer case, which now selects the cases with no requirement. Or they are removed
with the mapping they held: stage inputs, acceleration structures, the tile pass, fragment
imageblock cells, the public stage-input, ray, tile and fragment-imageblock cases, the kernel
table's integration case, and the dynamic-stride device test. The device-worker test's case is
now single-thread-store-constant: its acceleration-structure case is refused before the digest
check it holds. The own-context arms these families used are deleted in the next commit.

Owed answer: of the cases that route today, 0 render into one combined depth-stencil texture
using both aspects. The case files hold only Depth32Float textures, the 5 both-aspect attachments
carry separate_depth_stencil, and the route takes one aspect.

Verified: probe at a0f86a2efc, job m3-max-63255, listed the 16 tests the requirements failed. All
16 are fixed in m3-max-63274: fmt, validation clippy plain and --cfg m2v_cpu_icd, Rustdoc, and the
validation suite, 1352 passed. This commit is that tree on a8c2bfbfae.
2026-11-21 05:29:40 -08:00
Anees Iqbal fc021c92d8 replay: a released index is kept back until every commit before its release has retired
The runtime leaves its consumer the duty never to place at an index pending work may use: a
placement writes the index's set-1 elements, which Vulkan does not define while a pending
command buffer uses them, and a consumer keeps a released ID back until every command buffer
committed before the release has retired (runtime README, "An index has one owner"). The player
stands in for that consumer, but owed an index only to the commits of command buffers that named
its object. A command buffer that reached the object through an ID in memory, and the play's own
blits and copies, owed nothing, so a play could make the undefined write.

Indices::give now owes the released object's index to every commit so far, in commit order. The
naming path stays for command buffers not yet committed at the release, and for a live object a
later one displaces.

A placement owed to a commit held on records not yet played (its command buffer waits for an
event only a later record signals, or is behind one that does on its queue) cannot wait for it
without a deadlock. It used to take the index anyway, counted. It is now kept back: the object
takes the highest free index of its class that no commit in flight is owed, outside the
program's sequence, counted on 'indices kept back N: ...' (it replaces 'indices given while a
commit they owe is held N'). The held buffer reads the object it bound. The kept object's ID
differs from the one the program saw, and the id lines report it. A placement waits only where
no owed commit is held, so every wait can end.

An index the player chooses itself skips one still owed instead of waiting or ignoring it: a
constexpr sampler's (the highest free sampler index; it never waited before) and a texture's
outside the program's IDs (place_outside). A sampler state equal to the one placed last at its
index still takes it without waiting: the runtime writes no element for it.

Tests:
- rt_replay an_index_released_after_a_held_commit_is_kept_back_though_it_names_nothing is the
  forced-order test. Held command buffer #6 binds nothing and was committed before #5's
  release, and its event holds it past #8's placement. #8 must take the highest sampler index,
  counted.
- a_placement_a_held_commit_owes_is_kept_back_and_counted replaces the old take-without-waiting
  test.
- The Indices unit tests cover a release owing every commit before it, and top skipping an owed
  index.

Docs: docs/REPLAY-STREAM.md section 5 (resource IDs, textures outside the program's IDs) and the
backend's report paragraph; the indices.rs module doc.

Verified by the compile and suite jobs named in the hand-over.
2026-11-21 05:28:13 -08:00
Anees Iqbal 20ae73f152 Translator: the resident-table domains' encoder-operation lowering goes; object words stay
What: lower/access/encode.rs goes. It lowered a function's indirect-command encoder operations
under the resident-table domains, writing the binder's records and their written flags. What it
held that is still used moves to lower/access/object.rs:
- an argument buffer's command-buffer or pipeline-state member read as its word (ObjectWord);
- the plan that admits such a load only as an encoder operand.

Every encoder operation is now refused, `Unsupported{GpuEncodedIndirectCommands,
NotImplemented}`, except those the identity domains' icb.rs lowers: a render command's buffer
setters, its indexed triangle draw and a reset. icb.rs is selected first, as before. The other
deletions follow from that:
- indirect_commands.rs drops CommandEncoderOperation's per-operation policy table;
- lower/access/dynamic.rs drops the resident-set search and address helpers only encode.rs
  called (plan_search, plan_address, search_start, plain_base);
- the error doc of the depth-stencil argument names the setters' refusal;
- engine_indirect_commands.rs keeps two tests: every encoder operation refused under the
  resident-table domains on every committed profile and Profile F, and a depth-stencil member
  compiled unread and refused read. engine_handles.rs expects the refusal where a pipeline-state
  member is a command's operand;
- the command-writes interface test now takes icbcut's indexed kernel (icb_indexed_16) under the
  identity domains, plus the template that takes no command buffer;
- the authored census integration test expects the encoding case's refusal on both forms;
- docs/API.md's indirect-command section says which domain refuses what;
- docs/REFUSALS.md is regenerated.

Why: rule 4 (small) and rule 2 (one form). The runtime compiles under the identity domains, where
this lowering never ran. Under the resident-table domains, the validation executor's alone, it was
a second form of GPU-encoded commands that no consumer path takes.

No public item changes (indirect_commands is pub(crate); api_signatures.tsv is unchanged).
Versions: SEMANTICS_VERSION 2255 -> 2256 (a placeholder; the landing sets the number), because the
resident-table domains refuse what they lowered. Under the identity domains no output changes.

Verified (jobs at this commit's tree less the runtime README edit below it, 4606692494, or at the
next commit's, the runtime-sources pin, 4e9e857f8c):
- m3-max-63058 at the pin: fmt, clippy, clippy --cfg m2v_gpu, clippy --cfg m2v_cpu_icd, Rustdoc
  -D warnings and scripts/api-docs, all rc 0 (peak 7.5 GiB);
- m3-max-63040, the validation suite at this commit: 1359 of 1360 passed, the one failure the
  runtime guard, which the next commit pins;
- m3-max-63057, the metal2vulkan and metal2vulkan-runtime suites and doctests at the pin: 3349 of
  3360 passed. The failures are the render key, the AIR printout and the golden table (bless due
  at development's next pin) and the engine inventory's 8 parts: 2,142 cells moved, 0 rows new or
  gone, of which 1,342 are the storage forms' removal below this commit (ilock, m3-max-63032) and
  800 are this commit's, the resident-table encoder operations now refused: m3-max-63151, the
  parts with every difference printed, names them as 50 entries on all 16 profiles, each
  ok -> Unsupported{GpuEncodedIndirectCommands; NotImplemented}, in 31 fixtures, every entry a
  kernel that encodes indirect commands (26 engine/icb_* and 3 kernel_icb_* fixtures,
  resident_draws.ll's rd_encode and mesh_commands.ll's six enc_* kernels); the other 1,342 are
  ilock's, class for class. The inventory compiles under RESIDENT_TABLES
  (spirv::testing::committed_profiles), and its bless runs on macOS only (bless_engine_inventory
  refuses without every assembler, m3-max-63084);
- docs/REFUSALS.md regenerated by scripts/refusal-surface/refusal_surface.py;
- no states-only play: the runtime compiles under the identity domains, whose output this commit is
  expected not to change. That is read from the code: icb.rs, the identity lowering, is untouched
  and still selected first. It is not measured, because the golden table's every cell is re-keyed
  until development's bless. ilock and this commit report the same staleness: 29,792 cells,
  m3-max-63032 and 63057.
2026-11-21 04:39:28 -08:00
Anees Iqbal 7e8b93d953 Fetch: the interlocked storage forms go; one input-attachment form, ordered by ROA where the device has it
What. The pixel interlock's storage forms of framebuffer fetch, of the fragment imageblock and of
the shadow stencil are deleted, with their snapshot reads, the sample planes' split and merge
modules, the stencil shadow's copies and the binder, pipeline and runtime items that served them.
A color input now has one form on every device: its input attachment, ordered by
rasterization-order attachment access where the device has it, and elsewhere ordered between
draws alone, noted `PrecisionNote::UnorderedFetchWithinDraw`. The pixel interlock serves raster
order groups only; on a device without rasterization-order access a group on a color input or a
read output does not interlock. What had no other form is refused, typed:
- a fragment function's imageblock use, `Unsupported{Imageblocks, NotImplemented}`;
- a `[[stencil]]` output on a device without `VK_EXT_shader_stencil_export`, naming
  `StencilExport`;
- a merge, a rotated blend or a logic operation that reads the attachment, on a device without
  rasterization-order access, naming `FramebufferFetch` and
  `RasterizationOrderColorAttachmentAccess`.

Why. Rule 2 (one form per Vulkan capability) and rule 4 (small): the storage forms were a second
form of fetch, imageblocks and stencil output chosen by the interlock feature, outside the eight
allowed second forms. The runtime never took them under the identity domains.

Versions: ARTIFACT_FORMAT_VERSION 586 -> 587 (a placeholder; the landing sets the number).
SEMANTICS_VERSION moves in this stack's fourth commit and the runtime-sources pin in its fifth.
RUNTIME_VERSION is not bumped.

Removed public items (crates/metal2vulkan/tests/api_signatures.tsv): pipeline::StorageAttachmentUse,
ShadowStencilUse, FragmentImageblock, ImageblockMechanism, SnapshotForm, SnapshotRefusal,
StorageAttachmentView; bind::PlanesSplitModule, PlanesMergeModules, StencilSplitModule,
planes_split_module, planes_merge_modules, stencil_split_module, CopySource, FragmentTests;
RuntimeFact::{FragmentImageblock, InterlockedFramebufferFetch, MovableStorageWrites,
ShadowStencil, TestedStorageWrites}; PushField::{ShadowStencilState, SnapshotPhase,
StorageKeptChannels}; ResourceKind::SnapshotTexels, BindingSource::SnapshotTexels,
WriteSource::{ShadowStencil, SnapshotTexels}, PushHole::SnapshotPhase,
DrawReplayRule::{FragmentImageblock, ShaderStencil}, PlanesCopy::Alpha8,
ExtendedRangeBlend::OneColorChannel, PrivateRenderField::SampleMask,
PrecisionNote::UnmeasuredFetchBlend (translator and runtime), runtime
RenderPipelineKind::{Imageblock, ShaderStencil}. Changed: FramebufferFetchInputs::of(read, colors),
DepthStencilCopy::{StencilExport, StencilPlane}, WriteSource::TileAttachment.

Runtime README, known gaps: a new bullet names a fragment function with imageblock data (an input
or output declared [[imageblock_data]]) as refused on every device, and the stencil output bullet
says the runtime has refused it on a device without the extension all along. Both say why: the
forms deleted here bound a storage image through a descriptor, which the identity domains the
runtime compiles under hold none of. The raster order group bullet already names its refusal.
docs/REFUSALS.md is unchanged (scripts/refusal-surface/refusal_surface.py leaves it as it is).

Consumer check (~/.cache/m2v-orch/consumer-uses.sh, consumer development e76e2ffeb4 plus its 49
steelbrain/* tips younger than a day): 0 code hits on development for every removed name above
(Imageblock appears there only in rt_platform/diag.rs comments); UnmeasuredFetchBlend and
OneColorChannel hit only crates/reims-vgpu-vulkan on unlanded lane branches, none on development.

This commit does not build crates/metal2vulkan-validation alone: its executor still names the
removed pipeline items until the next commit, which removes its storage-form arms.

Verified: in the stack's second commit, which states every job; this commit alone does not
build the validation crate.
2026-11-21 04:39:18 -08:00
Anees Iqbal a449642cc7 rt docs: placing at an index pending work may use is the consumer's duty, not the program's
The sentence said no work in flight may read a displaced object through the index, "the program's
duty, as it is Metal's". It was wrong on both counts:
- A placement at an index a released object still holds for an unretired command buffer writes
  set-1 elements with one vkUpdateDescriptorSets (arrays.rs place_texture, place_samplers_locked).
  Under UPDATE_UNUSED_WHILE_PENDING with PARTIALLY_BOUND, the spec allows that only where no shader
  invocation dynamically uses the element (vkspec 1.4.366, the binding flags' text), so Vulkan
  does not define it.
- Metal hands a released ID out again at once on a Radeon Pro 5300M (oracle job m3-max-63074), so
  a program may be given an ID that work in flight still reads. Keeping the write away from pending
  work is the consumer's duty: it keeps a released ID back until every command buffer committed
  before the release has retired.

The placement is not refused (form (ii), not built). Between the last holder's retirement and the
block-maker's deferred vacate the index is still the released object's, and a placement then is
defined; a refusal would meet a guest there. The displaced form stays for that window, and the docs
say so.

Docs only: the runtime README's index paragraph and sampler line, docs/RESOURCE-ID.md, the replay
player's rationale in docs/REPLAY-STREAM.md, and the safety contracts of place_texture,
place_samplers and hold_samplers and new_texture's doc. Verified: cargo fmt, the API signatures
check; Rustdoc runs in the quick check after the land.
2026-11-21 04:34:13 -08:00
Anees Iqbal 7503407108 Binder: the identity domains' texture, sampler and runtime-owned push fields are refused typed
What: the translator's binder (bind/plan/compute.rs, bind/graphics.rs) now answers
Unsupported{IdentityDomains; NotImplemented} for every push field that only the identity domains
emit and that no binding state holds:
- a texture's or sampler's resource ID, PushField::SlotGuestBase of a Texture or Sampler slot;
- PushField::ConstexprSampler;
- on the render side also PushField::FetchedColor, TessellationFactorAddress, IndirectRange,
  IndirectSequence and IndirectBase, and PrivateArenaAddress beside ZeroAddress and BicubicTexels.
Before this, a compute plan of an identity pipeline that samples a texture failed with the internal
invariant "a compute push field SlotGuestBase(SlotRef { stage: Kernel, class: Texture, index: 0 })".

Why: one of (b)'s reds, api_preview_example::the_api_preview_example_runs. The example planned
an identity-domain pipeline through the binder, which plans only the resident-table domains.

Can rt's make reach it: no. metal2vulkan-runtime never calls the binder: it has no
pipeline.plan, BindState or BindShape call; it pushes these fields itself. The refusal is reached
only by a consumer of the translator's binder who plans an identity-domain pipeline. That is why
the form is in docs/API.md, the binder's guide, and not in the runtime's known gaps.

The example and the guide:
- examples/api_preview.rs opens a runtime_device, the default policy, and prints its profile.
- Its tour device, committed_device, takes DevicePolicy::RESIDENT_TABLES, because its binding plans
  are the binder's.
- docs/API.md says so after the Device paragraph and lists the refused fields.

The golden storage pair: golden_hashes_match_the_table's check_storage_pair reads the observed
cells, so a bless alone does not satisfy it. Its rule changes to what the identity domains answer.
On the 7 profiles whose bgra8 is not storage-capable (amd-rdna2-apu-radv, intel-arl-anv,
intel-irisxe-anv, intel-irisxe-rplp-anv, intel-uhd770-rpls-anv, nvidia-pascal-linux,
runtime-floor):
- The bgra8 cell is Unsupported{IdentityDomains; NotImplemented} on all 7. Its choice is
  StorageImageClass::SwizzleBgra, state of the bound texture beyond its resource ID. This is not
  the formatless storage row.
- The rgba8 cell is that refusal on 4: intel-irisxe-anv, intel-irisxe-rplp-anv,
  intel-uhd770-rpls-anv and runtime-floor. These lack shaderStorageImageReadWithoutFormat, so the
  read-write choice there declares the format, a storage image the identity arrays hold no
  element of.
- On amd-rdna2-apu-radv, intel-arl-anv and nvidia-pascal-linux, which read and write storage
  without a format, the rgba8 choice declares none and compiles.
Both refusals have the symbol "texture argument S: a type the identity arrays hold no element of,
or state of the bound texture beyond its resource ID", a form the runtime's known gaps list. Each
cell arises only because the golden table supplies a storage_images input that names the bound
format. The runtime never gives one: its slot stays the write that the floor's
shaderStorageImageWriteWithoutFormat takes. So a guest meets neither refusal.

Tests (engine_identity.rs), each failing without the change:
- the_binder_refuses_a_texture_and_sampler_slots_resource_ids_typed: sample_level on moltenvk-m3
  under the identity domains, planned with a buffer, a texture and a sampler bound, answers
  BindError::Unsupported (IdentityDomains, NotImplemented), not an internal error.
- a_storage_choice_the_identity_arrays_hold_no_element_of_is_refused_naming_the_texture_argument:
  on every committed profile, for bgra8 and rgba8, the storage_texture_write compile under the
  identity domains, given the format's storage choice, compiles where the choice is the format's
  own image declared without a format. Elsewhere it is refused naming the texture argument and
  "beyond its resource ID". It asserts at least one compiled, one swizzled and one declared case.

Runtime sources re-pin: the binder is a runtime input of the validation crate's guard, so
runtime-sources.sha256 moves from 47fe413580a9... to 38223c0cc84f17c0bc78a52f216dba49f5bf27655911b528c9cde82d6dcff0b6. The value is
the one the guard test computed at this tree's inputs (m3-max-62914), and development's commits
since then touch none of them. No run's behaviour changes and RUNTIME_VERSION stays:
- the new arms answer only fields that identity-domain compiles push;
- the validation executor plans through the binder only on its own context, under
  RESIDENT_TABLES (candidate/platform/compute.rs), whose compiles hold none of them.

Verified, at the same change on f61383d22b (development's commits since then touch none of
these files):
- cargo fmt --all;
- m3-max-62965, the metal2vulkan suite and doctests at 34ec190bc1: api_preview_example,
  engine_identity's binder test and every other test passed except the four bless-owned reds:
  the render key, the AIR printout, the public-fixture inventory part 4 and golden_hashes;
- m3-max-62991 at 2f29bccef0, which adds this commit's check rule and the generalized storage test:
  fmt and clippy rc 0, and 5 of 6 targeted tests passed (the storage-choice test, the binder test,
  api_preview, engine_profile_f, engine_air_2_1). golden_hashes_match_the_table passes
  check_storage_pair on all 7 columns and stops at the table's staleness, the bless due
  (29,712 cells under a changed profile fingerprint, 80 new);
- m3-max-62914 computed the runtime-sources value above.
2026-11-21 03:42:29 -08:00
Anees Iqbal f61383d22b rt: delete Device::release_indices, Grants::release and Refusal::IndicesInUse
A grant now lasts as long as the device. The consumer never returns one:
its code, read at its tree on the 8a36a49453 pin, has zero calls of
release_indices and no IndicesInUse (it calls grant_indices in four
files). Only the runtime's own tests called it.

Product: Grants::release, Device::release_indices with its doc, the
IndicesInUse variant and its Display arm go; Bits::put and Grants::set
lose the clearing arm only release used. 40 code lines and 19 comment
lines fewer. IndexGrant::indices stays (grant uses it). Grants are
dropped with the device.

Docs: the README's index section, Device::grant_indices, new_texture,
IndicesNotGranted, Gauges::releases_waiting and the pool's release
comments no longer name the call; they say a grant lasts as long as the
device and point at Gauges::descriptor_slots where a vacate shows.
api_signatures.tsv re-blessed (two records out) and docs/REFUSALS.md
regenerated (77 runtime refusals). The api_surface table pins only the
translator's names and does not change.

Tests: 36 tests called release_indices only as cleanup; those calls go
and their grant bindings take a leading underscore. The two Grants unit
tests in tests/arrays.rs drop their release cases. The four that read IndicesInUse read instead:
- an_index_has_one_owner_the_object_placed_there_last: the owners map
  (owns goes false after the owner's vacate);
- every_device_round_trips_texture_bytes and
  every_device_shares_sampler_states_device_samplers:
  Gauges::descriptor_slots, counted while the objects live and back to
  its count before the placements once they are gone;
- every_device_holds_a_release_until_the_work_committed_before_it_retires:
  releases_waiting nonzero and descriptor_slots 1 under the work, then
  descriptor_slots 0 once releases_waiting reads 0 (the block-maker
  thread vacates the index before that gauge falls).

Checked before the commit: signatures.py --check and
refusal_surface.py --check pass. The compile gate (fmt check; clippy
plain, --cfg m2v_gpu and --cfg m2v_cpu_icd; workspace Rustdoc, all with
-D warnings) and the runtime's tests on lavapipe run on this commit.
2026-11-21 03:03:59 -08:00
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 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 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 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 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 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 1208372eb9 Architecture: canon's unrolling also decides a filter nest's texel offsets 2026-11-21 01:22:31 -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 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 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 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 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 a5fac6fa9b rt: the depth clip mode Clamp and the triangle fill mode Lines, as pipelines of the draw's class made at first use
setDepthClipMode: and setTriangleFillMode: refused every value but Metal's defaults
(DrawKind::DepthClamp, DrawKind::FillMode). Vulkan 1.3 bakes both in
VkPipelineRasterizationStateCreateInfo, and only VK_EXT_extended_dynamic_state3 makes them
dynamic. The floor cannot require that extension: the UHD 630's Windows driver lists no EDS3, and
KosmicKrisp reports extendedDynamicState3PolygonMode false. So both are now first-use pipeline
variants, the accepted form. The encoder keeps a Raster (clamp, lines) and each draw takes
RenderCompiled::pipeline(topology, raster). The content keeps its primary VkPipeline (the triangle
or patch class at the default state) and a bounded list of the others, by class list topology and
raster state: at most 7 (three more states of the triangle or patch class, two of each other
class). The line and point classes take the clip mode alone, since Metal and Vulkan apply the fill
mode to triangles only. A triangle's edges under Lines chain Bresenham's rule, as the line class
does ("the effective rasterization input topology is in the line topology class"). The first draw
under a state makes its pipeline and waits for it: a first-use wait of a new site,
FirstUse::Raster (Metrics::first_use_raster_waits, _nanos, _max_nanos). The line and point
classes' first draws at the default state count where they did.

Floor:
- depthClamp joins REQUIRED, and the translator is told (=> DepthClamp), so the encoder maps the
  mode through metal::state::depth_clamp_enable. Vulkan 1.4 and Roadmap 2022 require it. The venue
  dumps report it true on every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736, 48737 and
  61508. tests/floor.rs, the README floor table, RUNTIME_FLOOR and profiles/runtime-floor.json
  add it.
- fillModeNonSolid is enabled where reported (FILL_MODES, told to the translator), and the setter
  maps Lines through metal::state::polygon_mode. KosmicKrisp on the M3 Max reports it false
  (m3-max-48737); every other dumped venue reports it true. There Lines stays DrawKind::FillMode,
  and so does the raw value 2, which no SDK header declares.

DrawKind::DepthClamp is deleted. The consumer's checkout names it nowhere (git grep in
reims-vgpu: 0 hits). Its only call sites are set_triangle_fill_mode and set_depth_clip_mode at
crates/reims-vgpu-vulkan/src/rt_platform/render.rs:371 and :374, whose signatures are unchanged.

The translator's raster-state test reads runtime-floor, which now states depthClamp. Clamp maps
there, and the refusal is asserted on runtime-floor without it, as ab8277a560 did for
depthBiasClamp. Other translator tests that read runtime-floor were grepped for DepthClamp and
FillModeNonSolid, and none reads the floor as lacking them.

Known gaps (README): a content's first draw under Clamp or Lines makes a VkPipeline, which Metal
does not. Under Clamp the depth a fragment function writes is the device's clamp's: Metal stores a
negative NaN as 0 below a range above 0, and the translator's depth_clamp_range variant is not
drawn.

Conformance: render-state-depth-clip and render-state-facing leave known-gaps-rt.tsv;
CONFORMANCE-COVERAGE.md regenerated. Docs: README (encoder, first-use waits, floor and fill-mode
tables, known gaps), REFUSALS.md, the api_signatures table (3 Metrics fields, 1 variant gone).

Tests:
- tests/raster.rs: a triangle in front of the near plane draws nothing under Clip and every
  texel under Clamp (twice: one pipeline made). Under Lines, through a viewport half a pixel
  right of and above the corner, the triangle draws its two edges inside the target, column 0
  and row 7, and nothing inside. Without fillModeNonSolid it is FillMode and fills. Pipelines
  made, raster first-use waits and first-use waits are each 1 + fillModeNonSolid.
- draw.rs: setting both modes makes no pipeline when no draw follows.
- floor.rs: depthClamp's missing case, and the fill-mode feature enabled where reported.
- first_use_sites.rs: the raster site.
2026-11-21 00:14:34 -08:00
Anees Iqbal 73ce142afc Bind: a vertex function that chooses its slice writes Layer in every pass; the dropped-Layer variant goes
A vertex function that writes [[render_target_array_index]] had two forms:
- in a pass of at most one layer (BindShape::render_target_array_length 0, Metal's default, or 1),
  the plan asked for VariantKey::dropped_vertex_layer, a variant compiled without the Layer
  output;
- in a longer pass it ran the pipeline that stores Layer as `index < length ? index : 0`, the
  length each draw pushes (PushField::RenderTargetArrayLength).

The second form already answers the short pass exactly. At a length of 0 or 1 it stores 0 for
every index, the slice Metal renders, so a one-layer framebuffer is never written an out-of-range
Layer. The dropped variant's one gain was a pipeline that needs no shaderOutputLayer. The floor
requires that feature, and every committed profile has it. The runtime never asked for the
variant: it compiles every render pipeline under VariantKey::new() and pushes the pass's layers,
at least 1.

After this change the one form draws every pass, and its plan states no variant at any length.
The binder pushes the pass's length as at least 1, as the runtime does; at 0 and 1 alike the
function stores 0 for every index.
Drawn one amplification at a time in a pass of one layer, a vertex function still writes no
Layer (LoweringInputs::amplification_draws, not layered). RuntimeFact::RenderTargetArrayLength's
layer_dropped now states that case alone.

Size: 24 files, +360/-381.

Removed:
- VariantKey::dropped_vertex_layer, with its is_empty term and its per-stage lowering bit;
- LoweringInputs::dropped_vertex_layer and the function key's "dropped-vertex-layer" bytes. A
  function compiled without the input keeps its key;
- the binder's choice of the variant, and its term in the check that answers
  BindError::NeedsVariant;
- the cache's round trip of the variant, and the variant's cases in the function key test.

Rule 1: no precision note changes.

The evidence gate (validation's candidate/platform/device.rs, fails_row) fails a row on every
ERROR the validation layer reports and on every WARNING of the validation type. Without the
variant the layer warns on each such draw into the render executor's one-layer framebuffer:
  WARNING (validation) Undefined-Value-Layer-Written (0x1fc55805): "vkCmdDraw(): Shader stage
  VK_SHADER_STAGE_VERTEX_BIT writes to Layer (gl_Layer) but the framebuffer was created with
  VkFramebufferCreateInfo::layer of 1, this write will have an undefined value set to it."
It warns of the write whatever its value: VK_LAYER_KHRONOS_validation 1.4.363 reports it for a
minimal draw that writes Layer = 0 (job m3-max-61934). The spec leaves the framebuffer undefined
only where "the Layer value is less than 0 or greater than or equal to the number of layers in
the framebuffer" (Layered Rendering, vkspec 1.4.366). This pipeline pushes the length 1 there and
stores 0. As the planner ruled, the gate now withholds that message, under five conditions:
- Exact: a WARNING of the validation type with that id name, number and whole text
  (CLAMPED_LAYER), for a row whose pipeline states RenderTargetArrayLength without layer_dropped,
  drawn in a pass of at most one layer. The render executor sets this per row on the sink
  (MessageSink::clamped_layer), so it is keyed on structure, never on a case.
- Counted: the row's environment records withheld_validation_messages
  {"Undefined-Value-Layer-Written": n}, and corpus-vulkan prints it.
- Proved by our own tests: candidate::tests::engine_render's
  an_index_past_a_one_layer_pass_renders_the_pass_s_slice draws rt6_layered_vertex writing index
  3 in a pass of length 0 and reads Metal's answer: the slice holds the fragment's word
  1 << 8 | 3 (the conformance case layered-render-target-array-length, recorded on an Apple M3
  Max). rt's tests::layered::on_device::every_device_renders_metal_s_layers checks the same for
  the runtime at lengths 0 and 1.
- One definition: rt's own device tests run under the layer and fail on any message, but they do
  not get this one, because rt renders through dynamic rendering:
  every_device_renders_metal_s_layers, index 3 in passes of length 0 and 1, passes under the layer
  on RADV's RX 550 (m3-max-61553).
  CLAMPED_LAYER is the only list.
- It cannot outlive its cause: the same device test asserts that the row withheld exactly one
  such message. When the layer stops reporting it, the test fails, and the exception goes with
  it. The sink's unit test the_clamped_layer_warning_fails_no_row_of_a_clamped_store_alone checks
  the match: the message for another row, another number, an error, or another draw's text still
  fails the row.
The executor version stays: a row the gate passed before draws and records as it did. The layer
bug's minimal repro and the issue text are staged for the owner to file.

Validation: two authored cases write [[render_target_array_index]] from a vertex function. Both
are vertex-stage cases into one 1x1 target, so both ran the dropped variant:
- 013406ac01b7 (public, vertex_amplification_id_layer) now runs the form that stores Layer;
- 434e73e03189's index is not shown the same across a primitive, so the commit below already
  refuses it on every leg.
Qualified on lavapipe at this tree's content (m3-max-61968, at dvl-5 1fa4aed963, which differs only
by a test's needless borrow): 013406ac01b7 matches Metal with robustness on and off (candidate
output e9eec98c138165bb), and each record states the gate's exception ran:
withheld_validation_messages {"Undefined-Value-Layer-Written": 1}.
The candidate engine's graphics tests now expect an empty variant for every case. The case that
chooses its slice in a one-layer pass declares Layer, with layer_dropped false.

Tests:
- engine_render_target_slice: every_pass_runs_the_vertex_function_that_writes_its_layer replaces
  the variant tests. On the 780M and lavapipe, each of three pipelines, at the lengths 0, 1 and 4:
  - states no variant;
  - declares Layer and reads the length, which the draw pushes as 1, 1 and 4;
  - draws.
  An amplified draw in a one-layer pass still draws one amplification at a time.
  the_dropped_variant_needs_no_output_layer goes.
- engine_target_indices loses its compile of the variant on the device without
  shaderOutputLayer.
- validation: an_index_past_a_one_layer_pass_renders_the_pass_s_slice (lavapipe, under the
  layer) and the_clamped_layer_warning_fails_no_row_of_a_clamped_store_alone, above.

Bless due: nothing new. Every golden compiles without a variant.

SEMANTICS_VERSION 2248 -> 2249 and ARTIFACT_FORMAT_VERSION 584 -> 585 are placeholders that main
renumbers.
SEMANTICS: a slice-choosing vertex function in a pass of at most one layer now compiles to the
module that stores Layer. ARTIFACT: VariantKey and LoweringInputs each lose a field.
RUNTIME_VERSION stays, and runtime-sources.sha256 keeps development's (land-pkt re-pins it). api_signatures drops the two
fields. API.md's layered-rendering bullet states the stored 0 in place of the variant.

Consumer check (consumer_check.sh, consumer development b76d6ac4a9): dropped_vertex_layer,
layer_dropped and NeedsVariant have 0 hits.

Verified (jobs read):
- m3-max-61968: the lavapipe device suite at dvl-5 (dvl-6 without the clippy fix), 1483 of 1483,
  qualify 013406ac01b7 Match, the withheld count {Undefined-Value-Layer-Written: 1} under both
  robustness settings.
- At the stack's tip over this change (dvl-5 1fa4aed963 and dvl-6 92fe40c38f): 61978 and 61987,
  fmt, clippy in every configuration, Rustdoc, each feature alone, the API docs and the Windows
  clippy, green; 61891, the suites at dvl-4: 13 failures, each a bless-due golden above or
  development's own (the raster state test, the inventory's sample_fill rows); 61968, the lavapipe
  device suite of metal2vulkan-validation, 1483 of 1483, and public case qualification Match;
  62042, the metal2vulkan-validation suite at dvl-5, 1378 of 1378 passed.
- States-only play of this change's player (p-dv.zst) over 35 distinct streams on ms01 (61971),
  gem10 (61980), um790 (61991) and um870 (62110): 456,384 render and 91,972 compute states made,
  0 refused, every stream exit 0; 62073 (um790) and 62105 (ms01) repeat those nodes' streams with
  the same counts. The msi stream (windrag-780m-b2) is not played: msi had no memory free.

Rebased onto the rebased geomdel over development 4cf936ed4d. The conflicts: the version lines;
runtime-sources.sha256, where development's is kept; and the validation context's device.rs, where
development's robustness record lost its leg and this change adds expect_clamped_layer and
take_withheld beside it. api_signatures.tsv checks against the sources (signatures.py --check) and
docs/REFUSALS.md regenerates unchanged. The jobs above ran at the old base; the rebased tip's are
in the report to main.
2026-11-21 00:04:06 -08:00
Anees Iqbal 57855c6097 Link: the synthesized geometry stage goes, both forms (the barycentric weights and the rate map's fan-out)
The translator built geometry stages in two forms that no Metal function asks for:
- the barycentric weights: a fragment function's [[barycentric_coord]] read as varyings, which a
  generated geometry stage of each topology class wrote, on a device without
  fragmentShaderBarycentric;
- the rate map's fan-out: a draw of a rasterization-rate-mapped pass's triangles once, a geometry
  stage emitting a copy of each per region, with its probe and its region-copy vertex variant.

Neither form reached a guest. The runtime enables no geometryShader, so it refused the weights
form already. It never sets BindShape::region_fan_out, and draws a rate-mapped pass region by
region (the regions route, RateMapRegions, and region_viewports, which stay). Validation never set
region_fan_out either.

After this change, one form is left for each:
- A fragment function that reads [[barycentric_coord]] reads the device's own
  BaryCoordKHR/BaryCoordNoPerspKHR. Without fragmentShaderBarycentric it is refused as
  Unsupported(Barycentrics) needing that feature alone; geometryShader is no longer offered.
- A rate-mapped pass draws through the regions route.

Rule 1: no precision note stops being raised. The fan-out's copies were a near-equivalent of the
regions route, which carries its own note (RateMapRegions::precision), and the weights form
raised none. The catalogue is unchanged.

Removed:
- pipeline::link::geometry (GeometryStages, the three classes' stages) and pipeline::link::fan_out,
  with their tests (link/tests/geometry.rs, link/tests/fan_out.rs) and tests/engine_region_fan_out;
- bind::fan_out (the region table, the probe's word layout and its constants);
- RegionFanOut and FanOutState;
- the region_fan_out fields of GraphicsState, BindState, BindShape, VariantKey and
  RenderLinkInputs, and LoweringInputs::region_copies;
- the region copy's lowering: StageIoPlan::region_copy, RegionCopy and the region table's
  declaration;
- PushField::RegionBox and RegionProbe;
- SyntheticBinding::RateMapRegions and RateMapFlags, and WriteSource::RateMapRegions and
  RateMapFlags;
- RuntimeFact::SynthesizedGeometry, RenderPipeline::runs_stage and Linked::geometry;
- IoRole::Barycentric with VaryingKey::barycentric and its key tag;
- VkProperty::SubgroupGeometryStage;
- the SPIR-V IR's geometry execution model, which only these stages produced: ExecModel::Geometry,
  OpEmitVertex and OpEndPrimitive, the InputPoints, InputLines, OutputLineStrip,
  OutputTriangleStrip and Invocations modes, ModelNeed::Geometry, EntryRule::GeometryModes and the
  builder's geometry ops;
- from scripts/regen-spirv-grammar/items.txt, the opcodes EmitVertex and EndPrimitive, the
  execution model Geometry and those five execution modes. spv.rs is regenerated: the opcodes and
  the model stay as test-only values, which the test parser reads, and the modes go;
- in validation, the census's geometry stage filter, the draw's runs_stage filter and the
  candidate's GEOMETRY stage arm. The census test that read three geometry stages from
  engine/bary_weights goes with them.

The SPIR-V builder now marks only Position Invariant; ClipDistance was the fan-out's.
band::plan loses its geometry flag, and takes the four SPIR-V helpers it shared with the
geometry module. The binder's stage map takes a geometry stage as no render stage.

Validation cases that executed either form: none.
- Fan-out: no validation code sets region_fan_out.
- Weights: two authored cases read [[barycentric_coord]], fa8b920d3cf3 and ae0a7e39b12f. Neither
  has a stored Vulkan observation on a profile without fragmentShaderBarycentric. fa8b920d3cf3 is
  observed on Metal and MoltenVK, and moltenvk-m3 has the feature. ae0a7e39b12f is observed on
  Metal only.

Fourth user of GeometryStages: none. It was used by link, the compile API's splice, the binder's
selection (through RuntimeFact::SynthesizedGeometry and GraphicsState::region_fan_out) and its
own tests.

Tests:
- engine_stage_io_tail's weights test is now without_the_feature_the_weights_are_refused: on
  lavapipe, ANV's Iris Xe, NVIDIA's Pascal (each with geometryShader) and runtime-floor (without
  it), both barycentric entries are refused needing fragmentShaderBarycentric.
- engine_target_indices checks each pipeline's stages valid where it counted geometry stages, and
  loses the_weights_stage_beside_a_vertex_layer_is_not_implemented: that combination is now the
  plain refusal above.
- engine_amplification no longer counts geometry stages.
- The binder's render stage test refuses a geometry stage.
- The builder's invariant test refuses ClipDistance.
- engine_rotated_weights' rotated draw runs on moltenvk-m3 and RDNA3's RADV, each with
  fragmentShaderBarycentric, where it ran on lavapipe through the weights form.
- The fact mechanism test numbers its 100 RuntimeFact variants densely again (PrivateArena,
  which development added, takes 99).

Bless due until the next named pin, where the M3 bless job takes them; nothing is blessed here:
- tests::public_fixtures_engine (the inventory): every [[barycentric_coord]] cell on a profile
  without fragmentShaderBarycentric becomes Unsupported(Barycentrics) needing it alone, where it
  compiled through the geometry stages (with geometryShader) or offered GeometryShader as the
  alternative;
- tests::golden_hashes, and pipeline::compile::tests::the_old_render_descriptor_key_keeps_its_value
  (the render key), as under the commit below: the profiles' fingerprints change;
- the authored compile census.

SEMANTICS_VERSION 2247 -> 2248 and ARTIFACT_FORMAT_VERSION 583 -> 584 are placeholders that main
renumbers.
SEMANTICS: a fragment function's weights and every rate-mapped variant change form. ARTIFACT: the
codec loses the RegionFanOut, FanOutState, GraphicsState::region_fan_out, IoRole::Barycentric,
RuntimeFact::SynthesizedGeometry, PushField, SyntheticBinding and VkProperty tags. RUNTIME_VERSION
stays: the runtime's render-pipeline kind no longer reads region_fan_out, which it never set, and
its SynthesizedStages doc names the bands alone. runtime-sources.sha256 keeps development's (land-pkt
re-pins it), api_signatures and api_surface drop the removed items, and docs/REFUSALS.md is regenerated.
API.md drops the geometry stages from RenderPipeline's stages, its barycentric bullet and its band
bullet. ARCHITECTURE.md's link line drops pipeline::link::geometry, and the runtime README's
Barycentrics gap names the feature alone.

Consumer check (consumer_check.sh, consumer development b76d6ac4a9): region_fan_out,
RegionFanOut, FanOutState, region_copies, region_copy, RateMapFlags, RegionBox, RegionProbe,
SynthesizedGeometry, FEW_COPIES, PROBE_DRAW_WORDS, RegionCopies and runs_stage have 0 hits.
GeometryStages appears in crates/reims-vgpu-c/link-order.txt only. fan_out's hits are the
consumer's own event fan-out in crates/reims-vgpu/src/graphics/decode/cmdbuf.rs, not this
module.

Verified (jobs read):
- m3-max-61801: the suites at this change's work in progress (4f1f934423); its real reds were the
  mechanism numbering and the rotated weights on amd-rdna3-radv, both fixed here; the render key
  reads bless-due.
- At the stack's tip over this change (dvl-5 1fa4aed963 and dvl-6 92fe40c38f): 61978 and 61987,
  fmt, clippy in every configuration, Rustdoc, each feature alone, the API docs and the Windows
  clippy, green; 61891, the suites at dvl-4: 13 failures, each a bless-due golden above or
  development's own (the raster state test, the inventory's sample_fill rows); 61968, the lavapipe
  device suite of metal2vulkan-validation, 1483 of 1483, and public case qualification Match;
  62042, the metal2vulkan-validation suite at dvl-5, 1378 of 1378 passed.
- States-only play of this change's player (p-gd.zst) over 35 distinct streams on gem10 (61919),
  um870 (61924), ms01 (61967) and um790 (62004): 456,384 render and 91,972 compute states made,
  0 refused, every stream exit 0. The msi stream (windrag-780m-b2) is not played: msi had no
  memory free.

Rebased onto development 4cf936ed4d (selidx landed as 3ecf606aa8). The conflicts: the version
lines; the mechanism test, where development added RuntimeFact::PrivateArena; runtime-sources.sha256,
where development's is kept; and api_signatures.tsv and docs/REFUSALS.md, both regenerated
(signatures.py --bless, refusal_surface.py) and differing from development by this change's items
alone. The jobs above ran at the old base; the rebased tip's are in the report to main.
2026-11-21 00:03:34 -08:00
Anees Iqbal fa70528de2 validation: the opened chains blessed for drawIndirectFirstInstance on the rebased base; conformance coverage regenerated
The rebase of the indirect draws onto 4cf936ed4d met conflicts in two generated files, which
took the base's side in ec5841552f (whose subject still names the bless it carried before the
rebase). They are regenerated here on the rebased tree:

- opened_chains.txt: the runtime floor's device and restricted chains gain one member each
  (drawIndirectFirstInstance), now 44 and 52 members (bless_opened_chains, job m3-max-62279,
  homelab-gem10-1, at ec5841552f: 1 passed).
- docs/CONFORMANCE-COVERAGE.md: scripts/conformance-coverage/coverage.py on this tree, which
  counts the indirect draw cases that left the ledger.

REFUSALS.md regenerates unchanged; METAL-COVERAGE.md --check passes.
2026-11-21 00:09:33 -08:00
Anees Iqbal aed460e0da rt: indirect draws, of primitives, indexed primitives and patches
The render encoder builds Metal's three indirect draws:
`drawPrimitives:indirectBuffer:indirectBufferOffset:` (`draw_primitives_indirect`),
`drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_indexed_primitives_indirect`) and
`drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_patches_indirect`). Each is one `vkCmdDrawIndirect` or `vkCmdDrawIndexedIndirect` on the
buffer at its offset: Metal's argument structs lie as Vulkan's commands do, so the GPU reads
them as they are and nothing is copied. Before, the encoder had no such methods and the README
listed indirect draws as not built.

drawPatches indirect is built: rt's patch draw is vkCmdDraw(patch_count, instances, patch_start,
base), each patch one vertex of the state's patch list, so Metal's patch count is the indirect
command's vertex count unchanged. A patch index buffer stays `DrawKind::PatchIndexBuffer`, as
the direct draw's.

The arguments' buffer counts among the draw's reads as an index buffer does (draw_reaches,
Managed copies), and the command buffer keeps it until it retires. The pass's first barrier
(Reach::Commands, which has INDIRECT_COMMAND_READ) and the encoder's memory barrier make earlier
writes visible to the read. An offset not a multiple of 4 or without the arguments' 16 bytes (20
indexed) is Refusal::IndirectOffset; arguments at a block byte not a multiple of 4 are
Refusal::ArgumentPlace; an indexed draw's index offset must be a multiple of the index size and
inside the buffer. A device that takes firstInstance 0 alone under a divided step rate refuses
an indirect draw through such a state (DividedBaseInstance), since the GPU reads the base
instance.

Floor: drawIndirectFirstInstance joins REQUIRED (Vulkan 1.4 requires it), so Metal's base
instance is the device's own. The translator is not told. The venue dumps report it true on
every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736, 48737 and 61508. tests/floor.rs,
the README floor table, regen_device_profiles.py's RUNTIME_FLOOR and profiles/runtime-floor.json
add it. The translator's tests that read runtime-floor only see indirect_needs_arguments become
false more often, which none asserts the other way.

Known gap (README): an indexed indirect draw's index count is the GPU's, so a count past the
index buffer is not refused as a direct one is. Without robustBufferAccess2, which the floor does
not require, a count past the block's VkBuffer is outside valid usage
(VUID-vkCmdDrawIndexedIndirect-robustBufferAccess2-08798).

The encoder's doc no longer lists `useResource:` as not built (it is, since 62b3e5a250).

Docs: README, REFUSALS.md and METAL-COVERAGE.md (the three selectors now implemented), the
api_signatures table (three methods).

Tests: draw.rs's every_device_draws_from_indirect_arguments_a_blit_wrote: arguments written by a
blit earlier in the command buffer, at offset 16, draw the constant-step triangle as the direct
draw does (vertex 1, instances 1 and 2 at base instance 1), indexed through [7, 0, 1, 2] from
index 1 at base vertex 1 too; arguments of no instances draw nothing. patch.rs's
every_device_draws_patches_from_indirect_arguments: two patches from arguments 4 bytes in draw
as the direct patch test's, and a patch index buffer is PatchIndexBuffer.
2026-11-21 00:02:34 -08:00
Anees Iqbal 4f6dc912f3 Identity domains: a plain ulong texture slot is the RG32 element its resource ID names
A `ulong` texture slot that no `ulong` atomic updates is an `RG32` unsigned image whose two words
the shader joins and splits (`TexelClass::Uint64`), declared `Rg32ui` where it is a storage image
(`ulong_format`, under the floor's `shaderStorageImageExtendedFormats`). Under the identity domains
identity_class refused every `ulong` declaration, so such a kernel was
`Unsupported{IdentityDomains}` ("a type the identity arrays hold no element of"). It now admits it:
its class is the unsigned integer class of its shape, as its declared image is, and a storage
declaration of `Rg32ui` is the class `StorageFormatClass::Format(R32G32_UINT)`, whose variable is
the storage-image array's (set 1, binding 1, which every storage class aliases), as Metal binds
only an `RG32Uint` texture there. A slot a `ulong` atomic updates (an `R64ui` image) and an
argument buffer's `ulong` texture stay refused. The default domains are unchanged.

Docs: RESOURCE-ID.md's arrays name the `RG32Uint` storage class of a `ulong` texture; API.md's
identity forms name a `ulong` slot's reads and writes.

Test: engine_identity's ulong_texture_slots_are_rg32_elements_their_resource_ids_name: the owned
fixture unk_ulong_access (a sample-access and a read-access `texture2d<ulong>`, a write-access
`texture3d<ulong>`) under the identity domains on lavapipe, moltenvk-m3 and moltenvk-m3 without
robustImageAccess2: each passes L3, its classes are the sampled array's unsigned 2D class and the
storage array's 3D `R32G32_UINT` class, and on the CPU interpreter each of 20 threads reads its
elements' two words joined as `(v, 0, 0, 1)`, `(0, 0, 0, 1)` outside the textures, and writes the
sum's two words inside the texture alone.

SEMANTICS_VERSION 2246 -> 2247: a refusal becomes a module.

Evidence:
- The 9 public conformance cases on the plain ulong slot (unk_ulong_rw x7, unk_ulong_access
  x2): before, at f3418eacb9 on lavapipe (m3-max-61725), the 2 access rows not_supported;
  after, at 2796fb6e14 (an earlier form of this commit), 9/9 match, the 2 access rows on
  runtime-compute (m3-max-61703).
- States-only play of all 36 streams at 3bb97361a8 (an earlier form of this commit plus probe
  commits that never land): every render and compute pipeline state made, 0 refused. msi
  m3-max-61733 (1 stream), um870 61734 (1), um790 61760 (5), ms01 61775 (7), gem10 61795 (22).
2026-11-20 22:10:44 -08:00
Anees Iqbal 3ecf606aa8 Stage io: an index not shown the same across a primitive is refused; the selected index store goes
Metal's shading language leaves a primitive whose vertices write different indices undefined:
"You must return the same value of [[render_target_array_index]] for every vertex in a primitive.
If values differ, the behavior and value passed to the fragment function are undefined." The same
sentence covers [[viewport_array_index]]. The selected index store answered that case with the
first vertex's index, through the synthesized geometry stages, and MoltenVK's profile could take
DriverDeviation::MetalFirstVertexIndices to store it as written. Both reproduced undefined Metal.
The runtime never reached either: it enables no geometryShader, and no profile takes the
deviation.

After this change every profile has one form. An index that the function's structure shows to be
the same at every vertex of a primitive is stored to Layer or ViewportIndex where
shaderOutputLayer or shaderOutputViewportIndex is enabled. Without that feature it is refused as
Unsupported(LayeredRendering), or as Unsupported(VertexAmplification) for an index the
amplification's offset alone sets. The refusal needs the output feature only; geometryShader is
no longer offered. An index not shown the same is refused as NotImplemented(LayeredRendering) on
every device. index_store's comment cites the two spec sentences as the reason for that refusal.
It cites Vulkan's same-value rule (VUID-VkPipelineShaderStageCreateInfo-stage-02596 for Layer,
-02597 for ViewportIndex) as the reason the index is not stored as written. A device without
multiViewport still stores no viewport index.

Removed:
- IndexStore::Selected, indices_selected, selected_index;
- StageIoPlan::indices_selected and first_vertex_indices_by_device, and the compile layer's
  requirement;
- IoRole::SelectedLayer and SelectedViewport, with their codec tags;
- VaryingKey::selected_layer and selected_viewport, with their key tags;
- GeometryStages::layer and viewport, the stages' Layer and ViewportIndex stores, and the
  Reason's index half;
- RuntimeFact::SynthesizedGeometry's layer and viewport fields;
- DriverDeviation::MetalFirstVertexIndices, its last variant, and with it the DriverDeviation type
  and DeviceProfile::takes_driver_deviation;
- VkProperty::MetalFirstVertexIndices and its codec tag.

The geometry stages keep the barycentric weights and the fan-out. A fan-out stage past the
geometry limits is now refused as RasterizationRateMap needing the limit. Before, it was refused
as LayeredRendering with an empty alternative, because the stage's reason held neither weights
nor an index.

Rule 1: no note stops being raised. The first-vertex form raised none. The input it served is now
a typed refusal, so no difference goes silent. The catalogue is unchanged.

The command line: no code there names a removed item. Translating a vertex function whose index
is not shown the same now prints FALLBACK (NotImplemented LayeredRendering) on a geometryShader
profile, where before it compiled with the stages. Validation: four authored cases compiled on
every profile-leg but moltenvk-m3 through the stages: 07f125464dac, 434e73e03189, 7ce6dea0475e
and a013a2bcbe56. On moltenvk-m3 they were refused needing geometryShader. They are now refused
on every leg; the authored compile census takes them at the next named pin, not in this change.
The coverage census test that read three geometry stages from engine/rt6_first_vertex now reads
them from engine/bary_weights on the 780M profile without fragmentShaderBarycentric.

Fixture: engine/vertex_amplification's amp_vertex and amp_vertex_layer now take their viewport
and slice from the instance (iid & 1) instead of the vertex (vid & 1). The amplification and
render-target-slice tests then still compile them, and engine/rt6_first_vertex carries the
per-vertex case. The fixture was regenerated by scripts/regen-air-fixtures (Apple metal
32023.922, llvm-dis 21.1.8).

Tests:
- engine_selected_indices becomes engine_target_indices, covering:
  - a uniform slice or viewport takes the output or nothing else;
  - no multiViewport stores nothing;
  - per-vertex indices are refused on every device;
  - the floor's zero reads;
  - the weights' stage beside a vertex Layer is not implemented.
- link/tests/geometry.rs loses its two selected-index tests.
- engine_amplification, engine_render_target_slice and engine_stage_io now expect the builtin and
  the output-only refusal.
- runtime-floor now requires shaderOutputLayer, so the tests that need a device without it
  withhold the feature from the floor's description (engine_target_indices, engine_amplification,
  engine_stage_io).

Bless due until the next named pin, where the M3 bless job takes them; nothing is blessed here:
- tests::air_input::engine_fixtures_match_their_golden_printout: vertex_amplification's printout;
- tests::public_fixtures_engine (the inventory):
  - rt6_first_vertex and rt6_first_vertex_point become NotImplemented(LayeredRendering) on every
    profile;
  - amp_vertex and amp_vertex_layer become ok on moltenvk-m3;
  - each LayeredRendering cell that offered GeometryShader loses that alternative;
- tests::golden_hashes, and pipeline::compile::tests::the_old_render_descriptor_key_keeps_its_value
  (the render key): the profiles' fingerprints change with VkProperty's codec;
- the authored compile census.

SEMANTICS_VERSION 2245 -> 2246 and ARTIFACT_FORMAT_VERSION 582 -> 583.
SEMANTICS: an index store changes form. ARTIFACT: the codec loses two IoRole tags, a VkProperty tag
and two RuntimeFact fields. RUNTIME_VERSION stays; runtime-sources.sha256 takes the new hash, and
api_signatures is blessed. docs/REFUSALS.md is regenerated. The runtime README's known gap for a
differing index names the refusal as not implemented and drops the geometry stage form. API.md's
layered-rendering bullet, its RenderPipeline stage list and its profile accessors, and
ARCHITECTURE.md's link line drop the selected index.

Consumer check (consumer_check.sh, consumer development b76d6ac4a9):
- MetalFirstVertexIndices, SelectedLayer, SelectedViewport, selected_layer, selected_viewport,
  SynthesizedGeometry, driver_deviations and DriverDeviation: 0 hits.
- GeometryStages and takes_driver_deviation: in crates/reims-vgpu-c/link-order.txt only.
- DriverDeviation and takes_driver_deviation are named in crates/reims-vgpu-vulkan/src/gpu/rgbx.rs
  and encode_render/tests/metal_tests.rs on some of the consumer's steelbrain/* branches, for
  MetalSampler, MetalHalfConversion and MetalVertexSimdgroups, which the stack below already
  removed. development has neither file.

Verified (jobs read):
- m3-max-61766: lint in every configuration and the suites at this change on the earlier stack
  (eeef281428); its reds were the bless-due goldens above.
- At the stack's tip over this change (dvl-5 1fa4aed963 and dvl-6 92fe40c38f): 61978 and 61987,
  fmt, clippy in every configuration, Rustdoc, each feature alone, the API docs and the Windows
  clippy, green; 61891, the suites at dvl-4: 13 failures, each a bless-due golden above or
  development's own (the raster state test, the inventory's sample_fill rows); 61968, the lavapipe
  device suite of metal2vulkan-validation, 1483 of 1483.
- m3-max-62042: the metal2vulkan-validation suite at dvl-5, 1378 of 1378 passed.
- States-only play of this change's player (p-si.zst) over the 36 streams on um870 (61909),
  gem10 (61912), ms01 (61958), um790 (61990) and msi (62045): 502,920 render and 108,189 compute
  states made, 0 refused, every stream exit 0.
2026-11-20 23:23:51 -08:00
Anees Iqbal d54a1a5568 Validation: the MoltenVK backend, its C3 venue and the old engine's baseline are deleted
The validation executor's Vulkan side runs on Linux through native ICDs
and the runtime. No lane records MoltenVK rows any more, and no MoltenVK
venue is wanted. This commit deletes the MoltenVK backend from the
store up.

Before the deletion, git grep at e35d9098c0 showed these readers of
Backend::Moltenvk rows outside tests:
- C3's input (c3.rs: C3Input::moltenvk, the baseline, the old-mismatch
  ledger), its venue kind (venues.rs), the evidence census
  (index.rs: the index's candidate table and evidence_status);
- the store's own layout check, shard rewrite and rekey;
- the batch's worker store, which linked the other backend's rows;
- the corpus-moltenvk binary, the host and driver checks
  (candidate.rs, platform/compute.rs) and candidate_batch's CPU refusal.
Every one goes or loses its MoltenVK arm here. No reader is left.

What goes:
- The corpus-moltenvk binary (Cargo.toml entry included), and
  Backend::Moltenvk and BatchBackend::Moltenvk. Backend keeps one
  variant, Vulkan. Collapsing it is a follow-up commit.
- corpus/observations/moltenvk: 64 shards, 4,809 rows. 4,802 of them
  are old-engine rows in about 60 slots: apple-m3-max-moltenvk 1,137,
  the byte-exact-* and local-* runs, and probe slots. The other 7 are
  engine rows of apple-m3-max-moltenvk@engine.
  corpus/observations/refusals/moltenvk: 16 shards, 6 refusals.
- The store's MoltenVK shards: its layout check, the aligned rewrite,
  the refusal follow and the rekey now read the Vulkan backend alone.
  The batch's worker store links only the Metal rows. The index stores
  the Vulkan candidates alone, and evidence_status's rows have no
  moltenvk column (corpus-status's evidence line loses it too).
- C3's MoltenVK venue (VenueKind::Moltenvk, c3-venues.json's
  apple-m3-max-moltenvk entry) and with it the old engine's baseline:
  - Population::OldEngineMatched, the baseline closure and the "new
    mismatch" count (SlotReport::new_mismatches);
  - the old-mismatch ledger (LedgerRow, C3Report::ledger, stale_causes,
    unexplained);
  - the reviewed list's old_mismatches part (OldMismatch,
    ListPart, EntryRow::part), and Venues::baseline and by_environment.
  The venue list's MoltenVK-driver check goes too. VenueDevice's
  metal_environment_id, which only an Apple GPU's venue device set,
  goes with Venue::identities_compared_with: a venue run is held to
  all of its devices' identities.
- c3-reviewed.json: the 12 old_mismatches entries (all signed off),
  and the 10 fast_math_regrouping readings whose only observation was
  the apple-m3-max-moltenvk@engine slot. These are the linked-single
  radix 5/7/11/13/15 zero-write cases, two each, all signed off. A
  reading must list an observation, and theirs named a slot that no
  longer exists. A regrouping mismatch of those cases on another venue
  now reads unreviewed until a reading lists that venue's row. The 12
  apple_reading entries are untouched; none named a MoltenVK slot.
- corpus/authored-compile.tsv: the moltenvk-m3 column keeps its cells
  but drops their artifact digests (2,255 cells). Only a C3 venue's
  profile keeps a digest, and moltenvk-m3 is no venue's now. This is
  what a bless writes; the profile itself stays, since the translator's
  tests read it.
- scripts/rerecord-venue's moltenvk kind (and its Homebrew validation
  layer path), and scripts/rerecord-commit's MoltenVK build, install
  and shard paths. docs/VALIDATION.md loses corpus-moltenvk, and its
  venue list names what each venue covers.
- In the docs, the robustness leg's "profile-leg" (validation README,
  corpus README) is now "profile", which 79d95a2887 missed.

What C3 still decides: per venue of c3-venues.json, lavapipe on arm64
and x86 (the public cases) and the 780M, the Iris Xe RPL-P and the RTX
5080 Laptop (every Metal-qualified case), each case's verdict in the
venue's engine slot by the same rules as before (match, reviewed,
device_gap, out_of_scope, reference_gap, mismatch, refused, stale,
missing). It holds when every slot holds, every reviewed observation
holds, every listed reference gap is recorded, every entry and recorded
reference gap is signed off, and no sign-off is refused. It no longer
holds anything to an old-engine population, counts new mismatches
against one, or keeps a ledger of old-engine mismatch causes.

Tests:
- c3/tests.rs: the synthetic MoltenVK venue becomes a native GPU venue
  (GPU, Metal-qualified, still described by the moltenvk-m3 capture).
  Deleted: the baseline test (moltenvk_must_cover_every_case...), the
  ledger test, and the Apple-GPU Metal-environment test.
  Rewritten: the population tests (two populations now) and the
  reference-gap test (on lavapipe's public population). The schema test
  checks its review fields on a reading. The venue checks lose the
  baseline and driver cases.
- index.rs and store.rs tests run their toy rows as Vulkan's. The
  cross-backend checks have no second backend and go.
- vulkan_batch/tests.rs: the MoltenVK batch test goes. The install test
  refuses a Metal batch's record in place of a MoltenVK one.
- tests/integration: the store-layout and worker tests drop
  corpus-moltenvk. fast_trig_within_apples_bound reads the Vulkan store
  and wants one row per venue (5). It wanted 10, which the robustness-off
  and MoltenVK rows made up.

Device-level MoltenVK accommodations stay for the follow-up commit with
the MSL helper, once a grep shows no Vulkan run on macOS: the loader
word, MoltenVK's withheld diagnostics, coverage's robust-buffer host
class and the pipeline flag.

Verified: cargo fmt; no committed observation path, C3 list entry, venue
or script names the MoltenVK backend (git grep). The compile gate of the
Q3 commits follows as a potluck job.
2026-11-20 22:15:53 -08:00
Anees Iqbal 79d95a2887 Validation: the robustness-off leg and its slots are deleted
The ruling Q3: the validation executor runs each case in one context,
which enables every robustness feature its device states. Its second
leg (every robustness feature off, the ID@engine+robustness-off slots)
measured an encoding that metal2vulkan-runtime never runs, since the
runtime's floor fixes the robustness it enables. The tier table keeps
both of its compiles: they are translator coverage of what the runtime
ships, so coverage::Leg stays as the tier table's type alone.

Deleted:
- the executor's leg: corpus-vulkan's and corpus-moltenvk's
  --robustness-off, the device worker's leg, engine_slot's leg (an engine
  slot is ID@engine or ID@engine@P; an ID@engine+robustness-off is no
  engine slot), the enable lists' leg (engine_list enables what the
  description states), and the leg in a row's environment and census
  (ExecutedCensus.leg, environment.robustness.leg) with its validation;
- the batch's legs: corpus-vulkan-batch takes no --leg. Its passes are
  Pass::Engine and Pass::Metal, so a done-list line names "engine" where
  it named "stated", and a log is CASE.engine.txt. Its report lines carry
  no leg= field, and batch-slowest names pass=engine;
- the authored compile census's robustness-off profiles: a profile is
  its committed stem (ProfileStem, which was ProfileLeg); a label with a
  "+" names no profile. corpus/authored-compile.tsv loses its 9
  +robustness-off columns mechanically. Every other cell stays, and the
  reader takes the new layout in this commit. The rows are re-blessed
  at the next named pin. the_committed_expectations_parse holds the file
  to what a bless renders. No test is expected to read red until the
  bless, since no kept cell changed (unaudited until development's census
  runs);
- C3's legs: a venue lists no legs and has one slot (c3-venues.json
  drops its legs fields). c3-reviewed.json drops the 12 observations
  recorded in robustness-off slots;
- the committed rows of the +robustness-off slots: 193 rows and
  refusals out of corpus/observations, which empties and removes 44
  shards. "leg":"stated" is stripped from the remaining rows' census and
  environment;
- scripts/qualify-public-cases' second run per case, and
  scripts/rerecord-venue's --leg; docs/VALIDATION.md's robustness legs.

corpus-triage's usage, corpus-status' --c3 help and the census's file
comment say "profile" where they said "profile-leg".

Verified: cargo fmt. The compile gate follows as a potluck job.
2026-11-20 22:15:02 -08:00