Commit Graph
2064 Commits
Author SHA1 Message Date
Anees Iqbal 4a09c07658 Replay player: a play cut after its last frame names the command buffers held there, not an invalid stream
A play cut with --until-frame F (or at its recording range) ended exit 1 with "invalid stream:
command buffers [...] still wait on events at the stream's end" where a command buffer committed
before the cut waited on an event a call past the cut signals (glbench-3090-r4 cut at 400: cbs
128646 and 128648). The calls past the stop may signal it, so the stream is not invalid there.

The player now tells the stream's end from the stop after its last frame. At the stop, the
command buffers still held on events go into Report::held and a `held #ID ...` line, and the
play ends as it would without them (exit 0 for `ok`). At the stream's end a held command buffer
stays the invalid-stream error, a last frame past the end included.

Test: a_play_stopped_after_its_last_frame_names_the_command_buffers_held_there (a synthetic
stream: cut at frame 0 names #4 held and waits for nothing; played whole, the later signal lets
#4 complete; a stream ending with #4 held is invalid with no last frame and with one past its
end). Without the fix the cut play ends Err(Invalid).
2026-11-21 17:27:43 -08:00
Anees Iqbal 6c1dff3f09 Translator: under the identity domains, constexpr samplers a lane chooses among beside an argument buffer's texture are one sample through the set-1 sampler array (SEMANTICS 2265)
Some kernels sample a texture their argument buffer holds through a sampler that the run picks
among constexpr samplers with consecutive handles: a program-scope table of samplers read at an
index only the run knows. Under the identity domains, the runtime's, each such sampling was a
switch over the candidates: one arm per candidate, each a NonUniform sample of the heap element
through that candidate's set-1 sampler, and a null arm. RADV wraps each NonUniform sample in its
own waterfall loop (read_first_invocation). The 780M library's heaviest kernel holds 284 such
switches of eight arms, so 2,272 samples and 2,272 driver loops. Its cold create on a 780M peaked
at 7.8 GiB.

select_heap_array now takes the identity domains too. Where every candidate is a constexpr sampler,
their handles are consecutive, the use is not tangled (no fragment implicit level), and every
candidate's sampling is the same but for its sampler, the sampling is one sample. It reads the
set-1 sampler array of its use, NonUniform, at the pushed index (PushField::ConstexprSampler) of
the candidate the handle names. emit::identity_element selects that index among the candidates'
at run time. A handle outside the array still reads zero. finish pushes each candidate's index
and records the use in SamplerPlan::heap_array_identity in place of a binding. Sampling::words
counts each candidate's selection (Source::HeapArray::pushed, 0 outside the identity domains, so
the resident-table domains' weights are unchanged).

Under the identity domains the switch stays where the sampling compares, reads an integer class,
or reads pixel coordinates. Metal's bicubic filter on an argument buffer's texture is refused
before this (bicubic::check). Raw-texel states do not arise here, because the element is read in
its declared class. The resident-table domains keep their form unchanged.

One form for every device: the runtime's floor requires
shaderSampledImageArrayNonUniformIndexing (floor.rs), every committed profile reports it, and a
heap image sampled at all already needs it (texture/slot.rs).

The form is ported from 4b7d9d48ef (steelbrain/privarena-sampler-b, unlanded) and narrowed to the
ruled domain.

SEMANTICS_VERSION 2264 -> 2265. The golden table and the old render descriptor key get
re-blessed at the pin: m3-max-65203 shows "bless due" with exactly 16 cells changed, all
engine/sampler_table.ll sampler_table_held, one per committed profile.

Tests:
- engine_identity's
  chosen_constexpr_samplers_beside_an_argument_buffer_texture_are_one_sample_where_alike
  (replaces ..._is_a_switch_over_them). On every committed profile under the identity domains, a
  kernel's float sample through three chosen constexpr samplers is one sample: one sampled image,
  no switch, one ConstexprSampler pushed per candidate, and L3 passes. The switch stays, with a
  sampled image per candidate, for pixel coordinates (two linear pixel samplers that differ only
  in their border color), an integer texture, a comparison and a fragment's implicit level. The
  resident-table domains take their set-0 array for all but the fragment case, which shows the
  candidates' samplings are alike and only the identity domains' rule keeps the switch.
- argument_sampling's
  every_device_samples_an_argument_buffers_texture_through_a_table_of_constexpr_samplers now reads
  the module the device's translator gives sampler_table_held, asserts 1 sample and 0 switches,
  and prints that, then compares each of the 20 texels with Metal's answer as measured on an
  Apple M3 Max. The fixture has four candidates. The form is the same for any count of two or
  more, so it covers the eight-arm sites, and its texels are M3-measured.

Verified:
- Compile: m3-max-65200 (fmt, signatures, refusal surface, clippy plain / m2v_gpu / m2v_cpu_icd,
  workspace Rustdoc -D warnings), m3-max-65203 (translator suite 3210 passed, lavapipe runtime
  suite 625 passed).
- The execution test passed on llvmpipe (65203), RTX 3090 (65223), RX 7900 XTX (65224) and Iris
  Xe (65225).
- Rows: development 21baf79e79 against this tree, one runner (probe 7faf595d33 / 88125605ae, its
  probe variable choosing the arm), every run cold, validation layer off, arms A B B A in one
  exclusive job per card:
  - ec13339c (780M library, 284 sampler switches) on a Radeon 780M, RADV, job m3-max-65216:
    helper peak 7,772 / 7,773 MiB -> 816 / 819 MiB (89.5% less), driver compile 63.39 / 62.34 s
    -> 21.94 / 21.55 s (65.4% less). Final NIR (RADV_DEBUG=nir): loops 2,571 -> 583,
    read_first_invocation 2,272 -> 568, blocks 34,289 -> 17,533, phis 27,537 -> 13,526.
  - The same kernel on an RTX 3090, job m3-max-65238: 2,447 / 2,443 MiB -> 1,975 / 1,976 MiB
    (19.2% less), 57.72 / 57.70 s -> 51.88 / 51.85 s (10.1% less).
  - d45af8b7 (780M library, 70 sampler switches) on an Iris Xe, ANV, job m3-max-65240:
    4,528 / 4,530 MiB -> 2,622 / 2,622 MiB (42.1% less), 135.54 / 136.55 s -> 67.17 / 67.28 s
    (50.6% less).
- Our module for ec13339c on the 780M's profile (job m3-max-65215): blocks 22,746 -> 19,906,
  explicit-level samples 2,272 -> 284, OpSwitch 625 -> 341, spirv-val clean.
- The ledger over both libraries' 252 rows, plain and partial, both arms (job m3-max-65215): every
  row translates on both arms, none past 20 s, slowest 5.19 s, k12 unchanged at 440.2 MiB, and no
  rise. 20 rows of 10 kernels change, all of the 780M library. The Iris library's kernels sample
  through the program's own switches, one constexpr sampler per case, so no lane chooses a
  sampler there and its modules are byte-equal (probes m3-max-65233, 65241, 65246).
2026-11-21 17:15:11 -08:00
Anees Iqbal 2fbfafe0fe Translator: a structurizer variable no later trip reads is ended at each loop trip's top (SEMANTICS 2264)
What: spirv::carry::end_dead_carries, run in the stage bound after the uniform-load hoist (and in
pipeline::testing's typed module), stores an undefined value into a demoted value's or a phi's
Function variable at the top of the first block of each loop whose body holds every whole store of
the variable, where the variable is live into that block and the block does not read it before a
store. P8 marks those variables LocalVar::trip_local, only in a walk that is not predicated: the
predicated walk runs a loop's later trips for an invocation that left it, which reads the value of
its own last trip after the loop. The new field rides through roll's renumbering with its variable;
roll's own variables are unmarked. Terminator::for_each_target is the read-only twin of
for_each_target_mut. cache::SEMANTICS_VERSION 2263 to 2264. docs/ARCHITECTURE.md names the pass.

Why: the exit dispatches and pending guards P5 to P7 add give paths from a back edge to a read of
such a variable that pass no store of it. No execution takes them, but the driver keeps the
variable around the back edge as a phi live through the whole loop. In the source the value's
definition dominates each use and the loop's header dominates the definition, so no trip reads the
value an earlier trip left; the store ends it at each trip's top and the driver keeps nothing of it.
Jobs m3-max-65023 (780M and RTX 3090) and m3-max-65024 (Iris Xe) timed the same form, written by a
probe after roll and hoist, cold through the runtime's helper against development, arms alternating
in one job: helper peak and CPU time fell on all three cards.

Tests: tests::engine_trip_carries runs a loop with three exits, the second reading a value its trip
defined, on six profiles: a value is ended at a trip's top, carry::dead_carries finds no variable
left that no later trip reads but the module keeps around a back edge, the module passes spirv-val,
and the interpreter gives the source's words. tests::engine_divergent_barriers adds a vote loop
whose early leavers read their last trip's value after it (loop_leaver_k), run predicated on six
profiles under Vulkan's barrier rule. The compile job, the two tests' red runs without the form and
without the predicated rule, and the states-only plays run on this commit.
2026-11-21 15:42:11 -08:00
Anees Iqbal 325e88c276 Runtime: an indirect offset off 4 is Metal's documented refusal; arguments past the end are ours
Refusal::IndirectOffset covered two cases under one `ours` basis. Metal's headers document
the first: "indirectBufferOffset must be a multiple of 4" (MTLComputeCommandEncoder.h for
dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:,
MTLRenderCommandEncoder.h for the indirect drawPrimitives and drawIndexedPrimitives; Apple's
page for the indirect drawPatches sends its offset to the feature set tables, whose minimum
constant buffer offset alignment is 4 bytes). The headers state no rule for the second,
arguments that run past the buffer's end, which is the runtime's own check because Vulkan's
indirect commands read inside the buffer (VUID-vkCmdDispatchIndirect-offset-00407,
VUID-vkCmdDrawIndirect-drawCount-00487, VUID-vkCmdDrawIndexedIndirect-drawCount-00539).

- IndirectOffset { offset, length } is now the offset-off-4 case alone, Basis:
  metal-documented.
- New IndirectArgumentsPastEnd { offset, length, needed }, Basis: ours, for arguments at a
  multiple of 4 with fewer than `needed` bytes (12 dispatch, 16 draw, 20 indexed draw) after
  the offset, or an end that overflows.
- Both raise sites (the indirect dispatch, and the indirect draws' shared check) test the
  alignment first, then the length.
- Regenerated docs/REFUSALS.md and error/basis.rs (refusal_surface.py), and
  api_signatures.tsv (one variant added). The runtime README's indirect-draw paragraph
  names both refusals.

Tests: every_device_refuses_an_indirect_dispatch_off_4_or_past_the_buffer_s_end (compute)
and every_device_refuses_an_indirect_draw_off_4_or_past_the_buffer_s_end (draw) assert each
variant and its basis(): off 4 at 2 and at an offset that is also past the end (alignment
first), past the end at a multiple of 4 and at an overflowing offset, an indexed draw's 20
bytes where a plain draw's 16 fit; then the arguments in each buffer's last bytes dispatch or
draw and their results are read back. The compute refusal test's two IndirectOffset asserts
moved into the dispatch test.

Checked here: refusal_surface.py --check and signatures.py --check pass (source only).
2026-11-21 15:33:10 -08:00
Anees Iqbal b20dc87d22 Translator: the outline pass goes; a repeated region is written in line again (SEMANTICS 2263)
What: spirv::outline (a repeated region of 500 or more instructions written once, as a kept
routine declared DontInline) is deleted with its tests, its call in the stage bound and in
pipeline::testing, its notes in weights.rs, ir::Function::kept, ModuleBuilder::kept_routine and the
serializer, docs/API.md and docs/ARCHITECTURE.md. roll's items and its spine take back their own
visibility and signature (the loop-body sequences only the outline search read). The
bounded-growth test's chain is all one group again: no pass now folds a repeated graph.
cache::SEMANTICS_VERSION 2262 to 2263. The sampling and texel routines stay kept routines,
DontInline as before.

Why: a regression on NVIDIA. Job m3-max-64837 (RTX 2080, 620.70.06, um790, exclusive) made k7
(610e4b3d of the Iris capture's library, weight 320,401) cold through the runtime's helper, arms
A db5fefc2ce (before the pass), B 71014cd7bc's product (the pass in), C 36ed0d15b2, alternated
A B C A B C. The helper's CPU time and peak resident set (VmHWM):
- A: 37.74 s, 1,749 MiB; 37.90 s, 1,750 MiB.
- B: 85.82 s, 2,040 MiB; 87.44 s, 2,041 MiB (10 kept routines; largest function 195,769
  instructions against A's 336,129).
- C: 87.35 s, 2,049 MiB.
B is 2.3 times A's CPU and 16.6% more memory. The pass's only gain on file was synthetic (one
function called from 50 places, m3-max-64453). RADV and ANV cannot gain from it: Mesa 26.2.6
inlines every function before either backend sees the shader, RADV in radv_shader_spirv_to_nir
(src/amd/vulkan/radv_shader.c:574, nir_inline_functions) and ANV through the common runtime
(src/intel/vulkan/anv_device.c:792 sets the shader ops; src/vulkan/runtime/vk_pipeline.c:211 calls
vk_spirv_to_nir, whose src/vulkan/runtime/vk_nir.c:176 runs nir_inline_functions).

Verified: the compile job of this commit and a states-only play of nine streams against
development follow; the golden table and the render key are re-blessed at the pin.
2026-11-21 13:15:45 -08:00
Anees Iqbal 5d2c0bda2e Conformance: signed remainders of every width and sign, recorded on the M3
The case signed-remainders runs the owned fixture kernel_signed_remainders: each of 238 threads
reads a 64-bit dividend and divisor (17 dividends by 14 divisors: both signs, the most negative
long and int, low words that are the most negative short and char, values past 32 bits) and
writes eight words: the remainder of the low words as int, short and char, the 64-bit remainder's
two words, the exclusive-or of an int2 remainder's lanes, and the low word's remainders by 3 and
-8. Apple's compiler writes srem i32, i16, i64 and <2 x i32> by run-time divisors and srem i32 by
the constants 3 and 8 (x % -8 is x % 8). A remainder MSL leaves undefined (by zero, or of the
most negative value by -1) is never taken: the fixture writes 0xdeadbeef there. Every column
compares exactly.

It holds every device to Metal's answer where the translator's signed remainder (the commit
before last) replaced OpSRem, which Vulkan makes poison for a negative operand without
maintenance8.

Recorded on the M3 Max, macOS 27.0.1 (job m3-max-64656, which also compiled the fixture's
companions with scripts/regen-air-fixtures under Apple metal 32023.922 and LLVM 21; TOOLCHAIN
records the fixture's line). Metal's 1,904 recorded words equal C's truncating remainder for
every operand pair (checked from the recording against a reference written apart from the
fixture). docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py).
2026-11-21 12:46:21 -08:00
Anees Iqbal 7e92b1d0fa Translator: a repeated region of 500 or more instructions is written once, as a kept routine
What: a new pass, spirv::outline, runs on every module after rolling and hoisting. It finds a set
of regions of one function that are the same code (one sequence of the function's spine, loop
bodies included; entered only at the start and left only at the end), each of at least 500
instructions with a call of a kept routine counting one, writes the first as a new kept routine
(Function::kept, declared DontInline, the form ModuleBuilder::kept_routine makes) and replaces
every region with a call of it, then looks again, at most 64 times. Values from before a region
are parameters (one per distinct set of the regions' values; a constant that differs only where
any value may stand); a pointer parameter is a Function, Private, Workgroup or UniformConstant
variable itself or a PhysicalStorageBuffer pointer; values read after a region are the routine's
results (several in a struct). A Function variable only its region uses becomes the routine's
own where the region is in no loop or its first use stores the whole variable in a block the
region always runs; otherwise it is passed. Anything else that differs keeps the regions in line.
Candidates come from the spine's keys (16-item windows hashed, extended both ways); a set whose
exact comparison fails at an operand or result is compared again without that item. The spine
(roll::spine) takes a flag to walk loop bodies as sequences; rolling passes false and is
unchanged. SEMANTICS_VERSION 2259. API.md and ARCHITECTURE.md say the routines exist.

Why: NVIDIA's driver compiles a DontInline routine once and Mesa's drivers inline it either way.
On the RTX 3090 (620.70.06, job m3-max-64453) a generated kernel calling a 1,984-instruction
function from 50 places was created in 21.5 s inlined and 52 ms as a kept routine (51.8 s and
75 ms with 64 values live across every call); its dispatch GPU time was the same with few values
live and 20.6% lower as a routine with 64 live. A 497-instruction function: 0.1% and 19.7% lower.
500 is the smallest size measured within 3%. RADV and ANV (Mesa 26.2.6) compiled identical code
for the call, DontInline and inlined forms (jobs m3-max-64357, m3-max-64379).

How verified: spirv::outline::tests build kernels with three equal regions (a variable, a
selection's phi, a counting loop), a chain where each region reads the previous one's result, a
middle region that differs, and two regions in a loop whose accumulator is read before it is
written; each checks the routine and call counts, the module through the verifier and spirv-val,
and the words the interpreter writes against the unrewritten module's and the expected ones.
2026-11-21 12:18:23 -08:00
Anees Iqbal 19620c6f4d API.md: the fractional viewport's accepted difference names the devices measured
What: section 10's Draws entry on a filled primitive past a viewport edge that crosses a pixel. It
said a Vulkan device covers such a pixel where its sample lies in the clipped primitive; it now says
what was measured: RADV (RX 7900 XTX, two Radeon 780Ms, RX 550) and NVIDIA's driver (RTX 3090,
RTX 2080, RTX 5080) cover every pixel the viewport overlaps, as Metal on the M3 Max does; lavapipe
covers such a pixel only where its sample lies in the clipped primitive; the Iris Xe (ANV) covers
every pixel the near edges cross and none the far edges cross, the accepted difference where that
pixel's sample is outside or on the edge and a driver bug (the runtime README's known gap) where it
is inside.

Why: the entry claimed more than was measured; seven GPUs show no difference at all.

How verified: replays of fractional-viewport-coverage through the runtime, each differing pixel
printed against Metal's recording: m3-max-64279 (XTX), 64288 (780M 1002:15bf), 64280 (780M
1002:1900), 64323 (RX 550), 64286 (3090), 64287 (2080), 64282 (5080): 0 differing pixels;
m3-max-64281 (Iris Xe): 120 pixels, all far columns and rows; lavapipe's 344 elements from its
ledger row. The entry's bold lead-in (the allowance slug) is unchanged.
2026-11-21 10:46:52 -08:00
Anees Iqbal eed9ab3b52 Conformance ledger: the Iris Xe's fractional-viewport-coverage row, a driver bug and the accepted difference split by pixel
What: one row of known-gaps-rt.tsv, fractional-viewport-coverage on the Iris Xe at case/drawn/texels
(480 elements differ (F32), the largest difference 12), and docs/CONFORMANCE-COVERAGE.md re-derived
(the ledger's row count and the case's gap list).

Why: the case postdates the last round's replays, so no GPU venue had replayed it, and the next round
holds every GPU venue to the ledger. The Iris site mixes two causes, so the one row splits them by pixel:
- 240 elements, 60 pixels (the far column and row of the arms ending 0.7 into a pixel): each centre lies
  inside the viewport and is undrawn, ANV's truncated scissor far edge (Mesa update_scissors), a driver
  bug, the runtime README's known gap of render encoders; not an accepted difference.
- 240 elements, 60 pixels (the far column and row of the arms ending 0.25 into a pixel and on a pixel
  centre): each centre lies outside the viewport or on its far edge, the accepted difference of
  docs/API.md section 10 (Draws).
The Iris draws every arm's near partial column and row, as Metal does.

How verified: both cases replayed through the runtime on each GPU venue the round replays, with a probe
(never landed) that printed every differing pixel against Metal's recording, built at 8dc5ebbe9f
(development 0b73ac76e5 plus the probe bin), m3-max-64275:
- Iris Xe (ms01) m3-max-64281: fractional divergent as above; lines-fill-past-the-viewport announced
  (equal to Metal under its notice).
- RX 7900 XTX m3-max-64279, 780M HawkPoint m3-max-64280, 780M Phoenix m3-max-64288, RX 550
  m3-max-64323, RTX 3090 m3-max-64286, RTX 2080 m3-max-64287, RTX 5080 m3-max-64282: both cases
  announced, 0 differing pixels; no row.
2026-11-21 10:38:34 -08:00
Anees Iqbal c5ee8d7919 rt: Error::basis answers each refusal's basis, generated from its Basis: line
What: a public RefusalBasis (MetalDocumented, MetalMeasured, Ours, Device) and Error::basis, which
answers Refused, Limit and Unsupported from the variant's own basis, BelowFloor and
NoDirectDriverLoading as Device, and None for Translation, the platform's and Vulkan's failures and
the consumer's own block, stage or quiesce. Refusal::basis, Limit::basis and Gap::basis live in
crates/metal2vulkan-runtime/src/error/basis.rs, which scripts/refusal-surface/refusal_surface.py
writes from the `Basis:` line each variant's doc comment ends with: 131 arms (Refusal 82, Limit 17,
Gap 32), one per variant in declaration order, no `_` arm. The doc comment stays the one source.

Why: a consumer's census of the refusals its guests meet could only match names, so 67 refusals
whose basis is ours counted as "Metal refuses it". A typed basis tells them apart.

How: the script enumerates the enums structurally (rt_refusal_enums), reads each variant's pattern
(`Name`, `Name(..)`, `Name { .. }`) with enum_arms, and maps the basis value to the RefusalBasis
variant it names. It fails where the enum has no such variant (metal-takes and unknown have none:
the value comes with the first variant that needs it) and where a name is too long for rustfmt to
keep its arm's pattern on one line. It writes the file as `cargo fmt` leaves it (one line per arm,
else rustfmt's block form past 100 columns), so no rustfmt run is needed. `--check` fails where
basis.rs is stale, as for docs/REFUSALS.md, and one run regenerates both. `--selftest` gains three
cases: the arms and the block form, two Basis lines give two files, a missing value fails.

Verified: refusal_surface.py --check and --selftest, signatures.py --check and cargo fmt --check
pass on this tree. The generated forms were checked against rustfmt at five name widths and three
variant shapes. The compile job and the lavapipe rt suite are named in the lane report. Without
the change, the new tests do not build: RefusalBasis is unresolved and `basis` is not found.
2026-11-21 09:41:04 -08:00
Anees Iqbal 339d8f05c7 Runtime docs: a waiter on a signal held for room reads Committed until it is staged; the 2019 MacBook Pro's order as job 64081 shows it
A wait for an event's value is met once a signal of it is submitted (staged); a signal its
queue holds for room is not yet staged, so its waiter reads Committed for as long as the
signaller's queue takes to reach it. The Scheduled doc, newSharedEvent's and docs/API.md's
accepted difference now say so: within the M3 Max's own hold, which keeps a shared-event
waiter at Committed until the value lands.

The README's 2019 MacBook Pro sentence now states what job 64081 showed and no more: on the
Radeon Pro 5300M an unrelated read of a second process completed 0.99 to 1.97 ms after its
commit beside about 160 ms of another process's submitted work; a dependent read completed
after its writer and 19.06 to 19.26 ms before the first of 4 command buffers committed after
the write (committed, not shown submitted); the UHD 630 ran both processes first in, first
out in all 18 rounds, so its reader-after-writer is not told apart from that order.

Docs only.
2026-11-21 09:35:12 -08:00
Anees Iqbal 7911c011a0 Runtime: a queue keeps on the VkQueue only what it has room for, and another queue's later command buffer passes the rest
A queue sends a group only while it has room (submit::room): with fewer
than two submissions not seen complete always, and with fewer than
IN_FLIGHT while the expected runs behind the oldest, the group's with
them, stay within GROUP_RUN (16 ms). Without room, a command buffer the
held group does not take (by GROUP_RUN, UNSEEN_JOINS or GROUP) waits in
its queue's list, not staged, with the queue's later commits behind it;
the submit thread skips that queue and other queues' later commits go on.
Each held command buffer is scheduled as it would be in a group, in
commit order once its waits are met, its scheduled handlers run: only
its vkQueueSubmit2 waits for room (WorkState::hold). One that presents a
drawable, has nothing for the GPU, or ended sends its queue through to it,
as its group would go at once. Everything that sent a group still sends
it: a signal as staged, a host wait or send_now, stop, a busy completion
thread, an empty command buffer, a conflict with a texture copy.

A group no longer goes at its sixteenth command buffer: the seventeenth
finds it full and waits for room. A queue whose expected run is not yet
known has room for two.

Fences: a wait on another queue also goes after an update in a command
buffer held for room there, scheduled before the waiter was; that queue
goes through to it first. A held head with no group is staged before any
other command buffer, the earliest held first, so the order of holds is
the order fences read.

abandon ends the queue's command buffers not yet scheduled in place, in
the queue's order behind those held for room, which go at once.

Metrics::held_for_room counts the command buffers scheduled while held
for room (api_signatures row).

Why: one queue's backlog no longer delays another queue's command buffer
by more than about GROUP_RUN of that queue's expected GPU time.
2026-11-21 09:18:56 -08:00
Anees Iqbal 6da9a2bca2 Fractional viewport coverage is an accepted difference beside a point's
The planner's ruling on Metal's recorded answer (fractional-viewport-coverage, m3-max-64012):
MTLRenderCommandEncoder.h's setViewport: states only that fragments outside the viewport are clipped,
not which a pixel the viewport's edge crosses is; the M3 covers every pixel the viewport overlaps, a
partly held pixel included, and a Vulkan device covers a pixel where its sample lies in the clipped
primitive. Rule 1 does not emulate what Metal leaves unstated, and a static note would be decided by a
viewport's value at the draw, so docs/API.md's Draws list gains the entry beside the point's and the
lavapipe row's reason becomes it. The GPU venues' rows come with the next round's replays.
2026-11-21 09:09:38 -08:00
Anees Iqbal 2470d0f5f4 Conformance ledger: fractional-viewport-coverage on lavapipe, open
Metal on the M3 covers every pixel a viewport overlaps for a draw that reaches past it, a pixel the
viewport holds only part of included; the runtime clips at the Vulkan viewport's own edges and
lavapipe covers only pixels whose centres the clipped primitive holds (344 F32 elements, largest
difference 11.25; replay m3-max-64022 at 44c96aa50c). The row names the open bug, which waits on a
ruling: an accepted difference beside a point's, or a clip band past the viewport with a scissor at
its pixel-rounded rectangle. The coverage document is regenerated.
2026-11-21 09:06:40 -08:00
Anees Iqbal 44c96aa50c conformance: Metal's recordings of fractional-viewport-coverage and lines-fill-past-the-viewport
Recorded on the M3 (macOS 27.0.1) by job m3-max-64012 at d55df02bcf: `conformance record` and
`conformance times --runs 8 --write` for the two cases (record-exit 0, times-exit 0, 2 cases carry
their timing). The coverage document is regenerated.
2026-11-21 09:04:17 -08:00
Anees Iqbal 3051b00b00 conformance: fractional-viewport-coverage and lines-fill-past-the-viewport (unrecorded)
What: one module, cases/viewport_cuts.rs, of two cases. Each is one pass into an RGBA32Float
target cleared to -7.5, every draw its own colour (tob_renders: tob_rect, tob_triangle,
tob_solid), the whole target read back.
- fractional-viewport-coverage: a filled draw over four viewports whose edges lie inside a
  pixel, each in a 12-pixel cell of a 48 by 24 target: far edges .7 into a pixel from an edge on
  a pixel boundary; .3 and .7; .75 and .25 (near and far pixel each a quarter inside, neither
  centre held); both edges on a pixel centre. Each viewport is drawn twice: a rectangle reaching
  to clip 1.25 (inside the 1.5 w band point-viewport-coverage found Metal keeping points in) and
  a triangle reaching to clip 6 (past it).
- lines-fill-past-the-viewport: setTriangleFillMode Lines, three triangles each through an
  integer 8 by 8 viewport in a 16-pixel cell of a 48 by 16 target: one corner inside and two past
  the right and bottom edges, inside the 1.5 w band; the same shape past the band; and a triangle
  the viewport lies wholly inside, every edge more than a pixel outside it.

Why: a fractional viewport's far row or column, whose pixel centre lies inside, is cut on one
Vulkan driver, and a triangle under the Lines fill mode larger than its viewport has no Metal
recording. Both need Metal's own answer before anything is ruled. The M3's next recording batch
records them; until then the replay reports each as "no recording" and nothing is ledgered.

Tests (no device): every viewport lies in its own cell with unreached pixels around it; each
arm's near and far pixel lies against its viewport as its docs say; the geometry reaches past the
viewport inside and past the band; every colour is its own; the line triangles cross or surround
their viewport; every line edge passes at least 1/16 pixel from every pixel centre and diamond
corner of the target. Once recorded, Metal's target is held to what every viewport rule gives
(a pixel held whole is drawn, a pixel not reached is the clear), never to one rule.

docs/CONFORMANCE-COVERAGE.md regenerated (case modules 181).
2026-11-21 08:56:40 -08:00
Anees Iqbal 78a19891d5 docs/VALIDATION.md: a bound texture buffer runs on both executors
The authored-case requirements section still said a bound texture buffer carries texture_buffer, which
the runtime does not make. Texture buffers (817463704e) are made by the runtime, and ed4f8976a5 retired
the texture_buffer and texture_buffer_member requirements; 49eebb4d7f made the census compile the
argument-buffer member. Doc only; found by lane censustb.
2026-11-21 08:58:23 -08:00
Anees Iqbal 3a6d244ae2 Translator: runtime-floor's recommendation leaves out its texel-buffer update-after-bind pair, and a device made from it refuses texture buffers naming the feature
Texture buffers (817463704e) made runtime-floor the first committed profile that lists texel-buffer
update-after-bind features with robustBufferAccess and without robustBufferAccessUpdateAfterBind,
so recommended_enables keeps robustBufferAccess and leaves those two out by
VUID-VkDeviceCreateInfo-robustBufferAccess-10247. recommendations_are_closed_fixed_points_on_every_
committed_profile asserted the recommendation left out nothing on any committed profile, an
observation over the profiles, which no longer holds; it now names runtime-floor's pair. The
runtime enables those features and never robustBufferAccess (floor.rs), so no product change.

recommended_enables' doc said the core does not read the buffer update-after-bind features. Since
texture buffers it reads the two texel-buffer ones; the doc and docs/API.md now say a device made
from the recommendation on such a device gets no texture buffers, each refused naming the feature,
and how to have them. A new test builds runtime-floor's device from its own recommendation and
shows the typed refusal (Unsupported ArgumentBufferTextures, needs
DescriptorBindingUniformTexelBufferUpdateAfterBind), and the same member compiling once the
features are enabled without robustBufferAccess, as the runtime does.
2026-11-21 08:33:22 -08:00
Anees Iqbal d274b0b474 Conformance ledger: the texture-buffer and held-texture routes of norm-storage-codes on the NVIDIA cards and the Iris Xe
What: 20 rows in known-gaps-rt.tsv, at case/hsw_buffer/texels and case/hsw_held/texels of
norm-storage-codes-{rgba8unorm, rgba8snorm, rgb10a2unorm, rgba16unorm, rgba16snorm}: ten on
NVIDIA, ten on the Iris Xe. Each carries its card's hsw_write row's reason, with one more
sentence:
- the route answers as `hsw_write` does: the same count, the same largest difference, the same
  first differing element;
- the case's pipeline records `device-color-conversion` and `device-nan-encoding` on that card.
docs/CONFORMANCE-COVERAGE.md is regenerated.

Why: texbuf (817463704e onward) builds texture buffers, and the case's `hsw_buffer` route reaches
the device. Its `hsw_held` route answers on the GPU cards too. Their lavapipe rows came with
b7e3247961; the GPU cards' rows did not.
- The bytes are the card's own normalized conversion at a tie (rule 1), the conversion the
  texture route already ledgers:
  - NVIDIA stores the lower code at a unorm tie: Metal 0x1010101, ours 0x0 (rgba8unorm).
  - At an snorm tie NVIDIA stores the code toward zero: Metal 0x81818181, ours 0x82828282.
  - ANV rounds ties to even.
- The RX 7900 XTX (m3-max-63842) and the 780M (63840) answer Metal's bytes on all four routes.
- The store lowering is the texture's own (lower/texture/mod.rs, `ImageDim::Buffer` included):
  it calls `norm_storage_facts`, which records `DeviceColorConversion` for a slot whose storage
  choice is a normalized format of the identity class, or that has none.

Verified: the compile job and the replays on the 3090 and the Iris Xe, named with the sha.
2026-11-21 08:19:35 -08:00
Anees Iqbal c1b0a6d5e2 Conformance ledger: the GPU cards' rows of the pixel-sampler, downscale and vertex-format cases, each with its reason
What: 696 rows in known-gaps-rt.tsv, one per surprise the tip's replays printed:
- NVIDIA: 227 rows (m3-max-63788, RTX 3090). The round at ce998742d7 printed the same rows on the
  2080 and the 5080.
- RX 7900 XTX and 780M: 102 rows each. The two replays (m3-max-63791, 63789) printed the same
  rows, and so did the round's HawkPoint, which the 780M venue also names.
- RX 550: 112 rows (m3-max-63806).
- Iris Xe: 153 rows (m3-max-63801).
These were replayed at 5cd74cc440, the red-3 tip before its rebase onto 583684ebeb. The rows
cover:
- pixel-downscales-* (all seven sizes), pixel-samplers-* and pixel-samplers-subnormal-*:
  - The device's sampler and filter (rule 1), under `device-sampling`, `pixel-sampler-scaling`
    and, for the subnormal coordinates, `device-denormals`.
  - Each row states how our sources' digests split against Metal's, and the measured bound at
    each coordinate set (NVIDIA's `frac` within 1.19/255; RADV's, the RX 550's and the Iris
    Xe's within 0.95/255).
- vertex-format-* and integer-vertex-attributes, each with its first differing element:
  - A NaN in the device's encoding: `device-nan-encoding`, on every card.
  - NVIDIA's compiler folding the `half` round trip: `native-half-conversion`.
  - On the RX 550, which has no `shaderFloat16` (RADV enables it on GFX8 only by drirc),
    `OpQuantizeToF16`: `native-half-quantize`.
    - Four rows (MTLVertexFormatFloat to Float4, the largest difference 0) differ only in a
      zero's sign. Their reasons cite the note's zero-sign sentence.
    - The other 13 rows flush a value below the smallest normal `half` to zero, the note's
      first clause.
- indirect-range-* on the Iris Xe (3 rows, cases from 2614118ccf): the device does not list
  `VK_EXT_device_generated_commands`, so the execution is refused typed
  (`IndirectCommandsKind::Extension`), a known gap in the runtime's README.

docs/CONFORMANCE-COVERAGE.md is regenerated (scripts/conformance-coverage/coverage.py; --check
passes).

Why: red 1 of the round at ce998742d7. Its GPU replays failed on rows no card had. Each row
here gives that card's true reason, which every row's evidence (digests, the first differing
element, the largest difference) supports. No row was copied from another venue's wording
without its own card's evidence.

Verified: the compile job and the replays on each affected card, named with the sha.
2026-11-21 08:08:15 -08:00
Anees Iqbal 0f2067150f rt: a draw of lines carries DeviceLineRasterization on every device; the raster test holds the diamond-exit rule's cells
What:
- RenderCommandEncoder::LINE_NOTE (PrecisionNote::DeviceLineRasterization)
  is the static note of a draw of lines or a line strip, and of a draw of
  triangles under the Lines fill mode, on every device.
- A render pipeline state no longer carries the note; it carried it only
  under alpha to coverage or alpha to one.
- The note's text (artifact.rs, docs/API.md's catalogue, its items list
  and the accepted difference on a line's tie-break, the runtime's README)
  names its grounds, and keeps what it said of a state with alpha to
  coverage or alpha to one: there the device's default line rule draws,
  not Bresenham's mode. One note, both facts.
- The conformance side announces LINE_NOTE for each line draw and each
  Lines fill mode set. The note is among replay's NATIVE_NOTES, so it
  loosens the notices site alone.
- known-gaps-rt.tsv: the 12 primitive-type-restart-indices rows (NVIDIA,
  RX 550, Iris Xe) cite the note. Their lines run through the boundary
  point (3.5, 1.0).
- api_signatures.tsv gains the const's two rows
  (scripts/api-signatures/signatures.py --check passes).
- Tests:
  - raster.rs's Lines pass draws the triangle (-0.65, -0.675), (3, -0.675),
    (-0.65, 3) through the target's own viewport. Its edges at x 1.4 and
    y 6.7 lie inside the target with a pixel on each side, and strictly
    inside the clip volume and the viewport.
  - The pass holds the diamond-exit rule's cells exactly, column 1 and
    row 6, on every device. A device that draws another cell fails with
    the target drawn. It does not read the corner where the two lines'
    ends meet.
  - draw.rs's alpha-to-coverage test now holds that no state carries the
    note, and that LINE_NOTE is it.

Why the note: a card draws a line pixel that differs from Metal's. The 12
ledgered rows are lines through the boundary point (3.5, 1.0): Metal on an
Apple M3 Max covers the lower pixel there, NVIDIA's driver the upper. The
runtime draws lines with VK_LINE_RASTERIZATION_MODE_BRESENHAM. Its diamond
is open, so no Vulkan control decides that pixel. The Vulkan
specification's section "Bresenham Line Segment Rasterization" also lets an
implementation's fragments "not deviate by more than one unit in either x or
y framebuffer coordinates from a corresponding fragment produced by the
diamond-exit rule", with a fragment count within one. Rule 1: a line's pixels
are the device's answer, so the operation carries a static note.

Why the test changed: the old Lines pass put its bottom edge at y 7.7 through
a viewport of y -0.3 and height 8. The Iris Xe drew none of row 7 there
(m3-max-63429 at ce998742d7, m3-max-63507 at 7c1baad228). With both edges
strictly inside the clip volume and the viewport, the Iris Xe draws the
diamond-exit rule's cells, as the other cards do. The fractional viewport's
cut row is a separate item, not a line rule.

Verified, column 1 and row 6 at the test's geometry:
- Iris Xe: m3-max-63735
- RTX 2080: m3-max-63736
- lavapipe: m3-max-63737
- RX 7900 XTX: m3-max-63707, at the same edges
The exact-cell form's legs are named with its sha.

Not a regression: the Lines pass came with a5fac6fa9b (11-20 22:51), and its
viewport moved at 2a36291a80 (23:32). No Iris run of the old pass passed.
2026-11-21 08:02:39 -08:00
Anees Iqbal 1fbe4eacdb Conformance ledger: the GPU rows of the fetch and stencil-export cases go; those cards lack the feature
What: 91 refused rows leave known-gaps-rt.tsv: the NVIDIA, 780M, RX 7900 XTX and
Iris(R) Xe rows of the 17 padded-blend-* cases, xr-masked-bgr10xr-{red,blue-green,
srgb-red,srgb-blue-green} and argb8-targets-destination-alpha's refusal at
case/pipeline/argb8, and the NVIDIA rows of stencil-output, stencil-output-loaded and
pass-sequence-aspect-actions. The llvmpipe and UHD Graphics 630 rows stay. The fetch
block's comment says which devices read lacks-feature. docs/CONFORMANCE-COVERAGE.md
regenerated (scripts/conformance-coverage/coverage.py).

Why: round ce998742d7's eight GPU replays (m3-max-63423, 63431, 63464, 63447, 63444,
63446, 63468, 63453) read each of these 141 case-card-site triples as "no longer
refuses ... the ledger still lists it": every one of those cases reads lacks-feature
on those cards (NVIDIA 24 of 27 such cases, the others 21). Since 7e8b93d953 the
translator's refusal names RasterizationOrderColorAttachmentAccess alone for the
computed write over a fetch's read, and ExtShaderStencilExport alone for a stencil
output, and none of these devices reports either, so the case cannot run there. A
lacks-feature reading is never a ledger row. a0f86a2efc had reworded these GPU rows
after the lavapipe replay alone (where the feature is reported and the refusal
stands), so no GPU replay saw them since. These are not fixes: the cards still cannot
run the cases. The UHD 630 rows are left: no replay on it read them.
2026-11-21 08:02:12 -08:00
Anees Iqbal 895b3f845a PrecisionNote::NativeHalfQuantize: a zero may round to the other zero
What: the note's text (its doc comment and the docs/API.md catalogue)
says what may differ: where a half rounding's input is a zero or too
small for a normal half, the result may be either zero, so a negative
zero may come out positive; and what a program sees of it: a
reciprocal's or atan2's sign, the bits written to a half target or
buffer. The catalogue names the form not taken (copying the input's
sign bit into the result by integer operations, about 4 instructions
per half rounding on every device without shaderFloat16) and its cost.
No code changes; the planner ruled the note (11-21).

Why: the 11-21 round at ce998742d7 read the RX 550 (RADV, Polaris)
answering +0 for a -0 float attribute rounded to a half parameter
(vertex-format cases), where Metal answers -0. The SPIR-V specification
defines OpQuantizeToF16 so: "If the magnitude of Value is too small to
represent as a normalized 16-bit floating-point value, the result must
be either +0 or -0." A zero's magnitude is in that range. So the answer
is the quantize's own, documented, and rule 1 gives it a static note.
The note already covered a denormal rounding to a zero of either sign,
but its text did not name a zero's own sign. SignedZeroInfNanPreserve
is not the fix: it only restrains optimizations ("does not perform
optimizations on floating-point instructions that do not preserve sign
of a zero") and does not narrow what the instruction may answer.

How verified: a text change only. The RX 550's vertex-format rows go to
the ledger under native-half-quantize with the per-card rows.
2026-11-21 08:01:36 -08:00
Anees Iqbal 44a1c864c8 rt: no copy command whose source and destination share memory: buffer copies over a texture in place cut in slabs, heap aliases refused
A copy between a buffer and a texture in place over its bytes (copy_from_buffer into it,
copy_from_texture_to_buffer out of it, and their options forms) recorded one
vkCmdCopyBufferToImage or vkCmdCopyImageToBuffer whose region's bytes could be the texture's own,
which Vulkan forbids (VUID-vkCmdCopyBufferToImage-pRegions-00173,
VUID-vkCmdCopyImageToBuffer-pRegions-00184). And a copy between two textures placed in one heap
whose ranges meet, or between a heap buffer and a heap texture whose ranges meet, recorded one
command over memory one image lays out as the device chooses (VUID-vkCmdCopyImage-pRegions-00124
and the same two). Metal leaves both undefined.

Buffer and texture over it: buffer_copy now compares the region's rows (its offset and
bytes_per_row in the VkBuffer shaders reach) with the texture's rows (Side::rows, from bufcopy)
where both lie in one VkBuffer, and feeds every meeting pair of rows to bufcopy's meeting/cut:
one slab form for every copy whose bytes meet. A BufferCopy carries its slabs; each slab is its
own vkCmdCopyBufferToImage / vkCmdCopyImageToBuffer, with the COPY->COPY execution barrier between
two slabs that copy_from_texture's slabs take (now one fn, between()). The region on the
texture's own texels copies nothing; regions whose bytes do not meet stay one command. The answer
is the source's bytes from before the copy, as an Apple M3 Max gives between two textures over one
buffer (conformance buffer_texture_blits); between a buffer and its texture it was not recorded on
a Mac.

Heap aliases: a texture names where its image's memory lies that other resources may share
(TextureObject::bound: a heap texture's range, from Under::Heap's block and offset; a texture in
place, from its rows). copy_from_texture between two textures (not one image) whose memory meets
where either has no rows, and a buffer copy whose region's bytes meet a heap texture's memory, are
refused: nothing records, and nothing is emulated.

Both refusals have their own kind, Gap::OverlappingCopy { pixel_format }, which also takes over
bufcopy's two shapes no one-axis cut orders (a destination row across the end of its own source
row and the start of the next; rows of two pitches meeting at their starts), until now under
Gap::TextureCopy. Every one counts in the new Metrics::overlapping_copies_refused.

Docs: the rt README's blit section describes the buffer slabs and the heap refusal, and a new
"Known gaps of blit encoders" names the two shapes (built, cut on two levels, when a replay stream
or a walk counts one) and the heap refusal. docs/REFUSALS.md regenerated; api_signatures.tsv
blessed (the variant and the Metrics field).

Tests: a_buffer_copy_over_its_texture_s_own_bytes_copies_in_slabs_or_in_no_order (slabs a row on
into and out of the texture with their order, two texels on both ways, a one-row region, whole rows
two texels on unordered, a region after the texture and one in another buffer one slab, the
texture's own bytes nothing, a heap texture's memory met or not);
textures_whose_memory_meets_where_one_is_laid_out_by_the_device_copy_in_no_order (heap/heap both
ways, in place/heap, touching ranges, another buffer, a texture of its own, two slices of one heap
texture). On a device: every_device_copies_between_a_buffer_and_a_texture_over_it_from_the_source_before_the_copy
(a row on and back into and out of the texture, within the rows both ways, apart; whole buffer
bytes as from the source before the copy, one submission, 2 + slabs barriers, no byte copied; whole
rows a memory alignment on refused, counted, nothing recorded) and
every_device_refuses_a_copy_between_heap_resources_whose_memory_meets (texture onto its alias, into
and out of a heap buffer over its bytes: refused, counted 3, nothing recorded; copies between heap
resources apart run, the bytes back as they went in, one submission). bufcopy's device test now
expects Gap::OverlappingCopy and its count.
2026-11-21 07:59:23 -08:00
Anees Iqbal b7e3247961 Conformance: the known-gaps ledger's texture-buffer rows after the runtime makes texture buffers
From the lavapipe replay of d7f0a88fd9 (job m3-max-63634 on msi: 298
lines of ledger drift, 132 rows no longer held and 166 gaps unlisted):

- dropped the 132 rows of 'texture buffers are not built' and of the
  translator's IdentityDomains refusal of a texture buffer slot, which no
  longer hold on lavapipe: read-through-buffer,
  buffer-textures-cpu-access and norm-storage-fields-rgb10a2unorm now
  compare equal;
- 98 rows (every venue): Device::new_texture and the heap size of a
  texture buffer's descriptor are Refusal::TextureBufferNotOverBuffer,
  the consumer's contract;
- buffer-textures-made: the made texture buffers' cpuCacheMode,
  hazardTrackingMode and allowGPUOptimizedContents are the consumer's, as
  the 2D rows are (every venue, but offsets 4, 8 and 20, which are
  scoped to llvmpipe, NVIDIA, Intel and RADV, and are
  Refusal::TextureBufferAlignment of 16 bytes on Apple M3 Max, whose
  KosmicKrisp states no single-texel alignment); offset 33 is
  TextureBufferAlignment of 4 bytes (16 on Apple M3 Max); and a texture
  buffer over a Managed buffer states Shared where Metal answers Managed
  on a device of one copy (llvmpipe, 780M, Intel, Apple M3 Max), as a
  2D texture over one does;
- buffer-tails-texture-buffer: texels past the buffer are
  Refusal::BufferTextureLayout;
- norm-storage-codes-*: hsw_buffer and hsw_held diverge on llvmpipe as
  hsw_write does (the device's conversion);
- texel-swizzles-*: a swizzled texture buffer is Gap::TextureBufferSwizzle,
  a view of one Gap::TextureView, and llvmpipe's unorm8 read is one ulp
  high (the device's conversion);
- texture-buffer-fill-*: this side answers no fillTexture yet.

The llvmpipe rows are verified by that replay. The rows of other venues
are expected from each venue's texel-buffer offset alignments and device
type in its vulkaninfo, not run; the replay matrix holds them.

docs/CONFORMANCE-COVERAGE.md regenerated after the ledger
(scripts/conformance-coverage/coverage.py).

Verified: the lavapipe replay's drift lines, classified by
~/.cache scratch; the conformance suite and replay follow in the next
job.
2026-11-21 07:27:48 -08:00
Anees Iqbal 8f797a923d Conformance: the texture-buffer rows' comments name the runtime's refusals; the coverage document after the texture-buffer alignment query
The runtime makes texture buffers now (c2a8f4527c), so the comments that
named Gap::TextureBuffer say what it answers at those sites: the stride
row's texture buffer (bytesPerRow below its width's bytes) and the
tails case's (texels past its buffer) are Refusal::BufferTextureLayout,
as a 2D texture's are.

docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/
coverage.py): minimumTextureBufferAlignmentForPixelFormat: is implemented
and no case exercises it yet (reachable not exercised 76 -> 77), and
textureBufferDescriptorWithPixelFormat:...'s note is coverage.tsv's
generic one.

The known-gaps ledger's texture-buffer rows follow from the lavapipe
replay in a later commit.

Verified: rustfmt; the generator's output.
2026-11-21 07:45:35 -08:00
Anees Iqbal 418494f380 rt: a texture's image accessor no longer shadowed by TextureObject::image; the texture buffer's docs
TextureInner's Option-returning image() lost method resolution to the
TextureObject trait's image() -> vk::Image on Arc<TextureInner>, so
ae747745df did not compile (compile job m3-max-63551 on msi: E0599 at
nine call sites). It is image_of() now. texel_form asked
supports_format with the ash format; it takes the translator's.

Docs for the texture buffers of ae747745df: RESOURCE-ID.md's arrays
paragraph names set 1's bindings 5 and 6 (uniform and storage texel
buffers, 65,536 each) and the null elements of the other kind; API.md's
identity forms list texture buffer reads, writes and atomics, slots and
members alike, and keep refusing the parts or rows forms; the runtime
README's known gaps of textures add the swizzle, the view and blit
copies, and the both-usages format rule.

Verified: rustfmt; the compile job follows on the rebased tip.
2026-11-21 07:27:27 -08:00
Anees Iqbal 817463704e rt: texture buffers are buffer views of their buffer's bytes in set 1's two texel-buffer arrays
What: Buffer::new_texture of a texture buffer's descriptor makes one VkBufferView of the bytes
shaders reach (a Managed buffer's device copy where it has one), from the offset, its width's
texels long: no image, no copy, no new push field. Set 1 gains two arrays of 65,536 elements,
binding 5 (uniform texel buffers, the read ones) and binding 6 (storage texel buffers, the written
ones), at the same index class as textures; a texture buffer's index is the same element of both,
and placing a texture or a texture buffer over the other's index nulls the other's elements. The
translator's identity domains classify a texture_buffer slot or argument-buffer member as a texel
buffer of that array (no TexelBufferRange fact, no swizzle under identity), so a pipeline that
declares one is no longer Unsupported{IdentityDomains}. SEMANTICS_VERSION 2258.

Metal's own refusals are typed: an offset off Device::minimum_texture_buffer_alignment
(minimumTextureBufferAlignmentForPixelFormat:, the device's texel-buffer offset alignment, the
larger of the uniform and storage ones, a single texel's size where the device says it suffices)
is Refusal::TextureBufferAlignment; a bytesPerRow below the row or texels past the buffer is
Refusal::BufferTextureLayout; a descriptor of more than one row, level, slice or sample, and a
swizzle with writes, as Metal refuses them. Device::new_texture (and every other make) of a texture
buffer's descriptor is Refusal::TextureBufferNotOverBuffer: the consumer places the bytes as it
places every buffer. Gap::TextureBuffer goes; a swizzled texture buffer (Gap::TextureBufferSwizzle),
a view of one, and a blit copy of one are recorded gaps. A format needs both texel-buffer usages in
its buffer features (Gap::TextureFormat otherwise): the view's buffer has both usages, and without
maintenance5 its usage is the buffer's.

The floor requires the six texel-buffer descriptor-indexing features (update-after-bind, dynamic
and non-uniform indexing, uniform and storage) and raises the limits the two arrays count against:
uniform texel buffers against the sampled-image limits, storage texel buffers against the
storage-image limits, both against maxPerStageUpdateAfterBindResources and the pools: sampled and
storage per stage and per set 131,072 (196,608 sampled with attachment reads' second elements),
resources 262,152 (327,688), pools 274,144 (339,680). Every recorded device fits: the 8 device dumps'
least are llvmpipe's 1,015,808 sampled/storage/resources and the UHD 630's 1,048,576 pools; all 12
devices there report the six features.

Why: six harvested guest functions declare a texture buffer, and a pipeline that declared one was
refused at creation.

Checked by: tests::texture_buffers (lavapipe: R32Uint read at a buffer offset and written, out of
bounds read zero and dropped, atomics through read_write, every refusal), engine_identity's
a_texture_buffer_is_the_texel_buffer_element_its_resource_id_names (L3 on lavapipe and moltenvk-m3),
the floor tests, the signatures table and REFUSALS.md regenerated; the lane's compile job reports
the runs.
2026-11-21 07:27:27 -08:00
Anees Iqbal 2614118ccf conformance: the three GPU-range rows' Metal recordings; Watching forwards encoded_range; the coverage document
What: recordings/indirect-range-gpu-written-at-zero.json, -past-zero.json and
indirect-range-written-by-an-earlier-draw.json, recorded on the M3 Max (macOS 27.0.1, 26A434), three
runs each folding into one outcome, the validated leg run clean. Metal draws commands 0 to 2, 5 and
6, and 2 to 5: each execution reads the range the GPU wrote, the third after the earlier draw's
write behind the in-pass barrier. watch::Watching forwards encoded_range. docs/CONFORMANCE-COVERAGE.md
regenerated (python3 -I scripts/conformance-coverage/coverage.py): 180 case modules, 1322
recordings, executeCommandsInBuffer:indirectBuffer:indirectBufferOffset: and the indirect command
buffer's gpuResourceID now exercised.

Why: job m3-max-63598 on f2d20e177e failed the conformance tests on the missing recordings, the
wrapper's forwarding (the_announcing_side_forwards_every_call) and the coverage document.

Verified: recording job m3-max-63599 on f2d20e177e. The timings and the lavapipe replay follow.
2026-11-21 07:14:27 -08:00
Anees Iqbal abb3c82247 rt: a copy between two textures over one buffer whose bytes meet copies in slabs
copy_from_texture recorded one vkCmdCopyImage when its source and destination were two
different textures in place over one buffer (each a linear image on the buffer's bytes) whose
regions' bytes meet, which Vulkan forbids (VUID-vkCmdCopyImage-pRegions-00124: no memory both a
source and a destination of one command). Only regions of one subresource of one image were
cut into slabs. Metal leaves such a copy undefined; an Apple M3 Max gives each destination texel
what the source held before the copy (the conformance crate's buffer_texture_blits rows
within-buffer-a-row-on and -reversed).

A texture in place now names where its texels lie: the VkBuffer commands reach the buffer's bytes
through (one per allocation, spanning it), the first texel's offset there and the row pitch the
device reports for the linear image (Rows, Side::rows). Where both textures of a copy lie in one
VkBuffer, texture_copy finds every pair of a destination row and a source row whose bytes meet
(meeting: a source row meets at most the two destination rows whose starts lie nearest it, as a
pitch is at least a row; nothing to look at where the two regions' spans of bytes do not meet)
and feeds their shifts to the slab chooser of 7c1baad228, generalized to take several shifts
(cut): an axis every shift moves along, all one way, is cut no thicker than the least shift in
whole texels (bytes along x, rows along y), the end the shifts point to first, so no slab's
source and destination share a byte and no slab reads a byte an earlier one wrote; the axis of
fewest slabs wins, as before. One subresource of one image is the one-shift case and cuts as
before. Regions on the same bytes copy nothing. Regions whose bytes do not meet, interleaved rows
included, stay one command.

Where along each axis the rows meet shifted both ways, or not shifted (a destination row across
the end of its own source row and the start of the next, or rows of two pitches meeting at their
starts), no cut along one axis keeps the order: Gap::TextureCopy names that arm now, its doc,
docs/REFUSALS.md (regenerated) and the rt README's blit section with it, instead of an invalid
command. No scratch image, no cap, no copy of the runtime's own.

Tests: regions_of_two_textures_over_one_buffer_copy_in_slabs_where_their_bytes_meet checks the
slabs (a row on both ways with the regions' order, two rows on, two texels on within the rows
both ways, a row and two texels on), the gap (whole rows two texels on; two pitches meeting),
one slab for interleaved rows of one pitch and of two and for another buffer, and nothing for
the same bytes. On a device, every_device_copies_between_textures_over_one_buffer_from_the_source_before_the_copy
makes four RGBA8 textures in place over one Shared buffer at the device's own pitch (asserted in
place) and copies a row on and a row back, a memory alignment on within the rows on and back,
and apart, each expecting the whole buffer to hold the source's bytes from before the copy and
everything else kept, one submission, 2 + slabs barriers, no byte copied; the gap case is refused
and records nothing.
2026-11-21 07:08:04 -08:00
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