Commit Graph
9369 Commits
Author SHA1 Message Date
Anees Iqbal d421fee0b0 Conformance ledger: quad-helpers is refused where the device lacks shaderQuadControl
KosmicKrisp on the Apple M3 Max and the UHD Graphics 630's Windows driver report no
shaderQuadControl. A fragment function with a quad or simdgroup operation that reads,
combines or counts other lanes needs it, so quad-helpers' first state, qh_any's, is refused
there, as discard-quad-sum-placement's first state is. Expected from the translator's refusal;
the matrix's runs on those venues have not been read yet.
2026-11-23 16:08:38 -08:00
Anees Iqbal 198f9876fd Conformance: quad-helpers' fixture companions and Metal's answer, recorded on the M3
quad_helpers.ll, quad_helpers.air.ll and the TOOLCHAIN line were compiled by
scripts/regen-air-fixtures (Metal 32023.922, SDK 27.2, the pinned LLVM 21). The recording is
`conformance record quad-helpers` followed by `conformance times --runs 8 --write quad-helpers`
on the reference M3 Max (macOS 27.0.1), at 326213f839, job m3-max-72398.

The inventory rows are written as gsm2_helper_threads' fragment functions read; the gate has not
checked them yet.
2026-11-23 16:02:40 -08:00
Anees Iqbal 326213f839 Conformance: quad-helpers, a fragment's quad and simdgroup operations over quads with helpers
The owned fixture quad_helpers and the case quad-helpers. Five quad functions (quad_any and
quad_all of the helper query, quad_ballot of it, quad_is_first, quad_active_threads_mask) are
each drawn over 64 small triangles, one in each 8 by 8 cell of a 64 by 64 target, whose edges
cross quads. Three simdgroup functions (sum, min and max; and, or and xor; any, all, and the
lane counts of the ballot and the active mask) are each drawn over one triangle that covers
three pixels of a single quad, once for each quad lane the helper can take. Those are the draw's
only fragments, so the simdgroup holds that quad alone and no answer names a lane.

Each function runs its operations first, in control flow uniform over the draw, and then takes
a derivative of a value the answers feed. A helper therefore still has a gradient to compute when
the operations run, and MSL 4.1 sections 6.10.2 and 6.10.3 make it an active thread of each.

A translator test, a_fragment_simdgroup_operation_keeps_the_mode, checks that a fragment entry
with a simdgroup operation, with or without a derivative beside it, states
MaximallyReconvergesKHR on every maximal-reconvergence profile.

The fixture's companions and Metal's recording follow from the M3.
2026-11-23 16:00:37 -08:00
Anees Iqbal 72a52c85e9 Golden tables: blessed at the pin V 7360a148bb (SEMANTICS 2297 -> 2298)
The golden hash table last blessed at ff2b13cb96 under SEMANTICS 2297,
and the authored compile census at 7024d568df (SEMANTICS 2294). This
commit is the pin's bless of both at 7360a148bb.

Golden hash table (crates/metal2vulkan/tests/golden_hashes.tsv):
- 2,132 cells in 164 entries of 86 fixtures changed under unchanged
  keys, every one a fragment entry (air.fragment in its fixture's
  metadata): 1,079 .ll cells, compared on every host, and 1,053 .air.ll
  cells, compared on the Mac. Cause: 7360a148bb states the
  maximal-reconvergence mode on a fragment only in a loop a back edge
  re-enters from inside a selection (SEMANTICS 2298).
- 4 new rows, 28 entries, 420 cells: the reconverge_sample and
  reconverge_select fixtures (.ll and .air.ll) of the reconvergence
  conformance cases (62ab49b966).
- No vertex, kernel or mesh cell moved; no key changed; no row went.

Authored compile census (corpus/authored-compile.tsv), 92 rows, 418
cells:
- 5 cases go from not_supported{unsupported:not_implemented
  IdentityDomains} to compiled on all 9 profiles (45 cells less the
  equal ones): ed4b0ecd76 lowered storage textures read or written at a
  run-time level, after the census's last bless.
- The rest are compiled cells whose artifact hash moved with the
  translator changes since 7024d568df (SEMANTICS 2294 -> 2298).

Verified: bless job m3-max-72253 on the M3 at 7360a148bb (inventory,
golden, printouts, opened chains and the census, each exit 0); this
commit is its patch, applied unchanged. The tip's suites (m3-max-72242)
failed only golden_hashes_match_the_table, the bless due named here; the
quick check (m3-max-72240) passed every step. The planner named
7360a148bb pin V on that quick check.
2026-11-23 15:00:13 -08:00
Anees Iqbal 7360a148bb Translator: a fragment's derivatives state the reconvergence mode only in a loop a back edge re-enters from inside a selection
A fragment entry whose only tangled instructions that depend on reconvergence take derivatives
(dfdx, dfdy, fwidth, implicit-LOD samples, LOD queries) no longer states MaximallyReconvergesKHR
(or SubgroupUniformControlFlowKHR), records Reconvergence::Guaranteed and carries no
DeviceReconvergence, on every device, except where its emitted module holds such an instruction,
itself or through a call, in the construct of a loop whose continue target two or more blocks of
the construct branch to (a continue from inside a selection, or two latches). There it takes the
mode the profile gives a tangled entry, and the note where the profile has no maximal
reconvergence. Entries with group operations or barriers keep today's behaviour.

Why: MSL 6.11.1.1 leaves derivatives undefined within nonuniform control flow, and an implicit
level or LOD query is the derivative of its coordinate, so such an instruction is Metal's only
where the quad reaches it together. Without a mode SPIR-V reconverges invocations at the merge of a
construct they entered together and all leave by it (2.2.5, Uniform Control Flow); only the
continue target of a loop entered from several blocks needs SPV_KHR_maximal_reconvergence to
rejoin the quad for the next iteration. AMDVLK 2025.Q2.1 miscompiles a large fragment function
under the mode (an 8x8-cell grid on the 780M, blockiness 9.15 against RADV's 2.87; the same play
with the mode stripped reads 2.92, job m3-max-71921), and the note logged on every device without
the feature for a case Metal leaves undefined.

How: SelectCx::derivatives marks the derivative and implicit-LOD tangled values; simd::finish
defers a fragment entry with only those to SimdPlan::quad_loops; lower::simd::quad_loop::settle
decides on the emitted module, before verification, and declares the mode with
TypedModule::declare_modes where it applies. The PrecisionNote and Reconvergence docs, the
docs/API.md catalogue entry and its Precision sentence, and the simd module doc say the same.
SEMANTICS_VERSION 2298.

Verified:
- Metal-defined reconvergence cases with the mode stripped equal them with it, and Metal, on the
  780M under AMDVLK 2025.Q2.1 and RADV (m3-max-72068), the RTX 5080 (m3-max-72069), the RTX 3090
  (m3-max-72071), the Iris Xe (m3-max-72070) and lavapipe (m3-max-72077): 0 of 4096 pixels differ
  from Metal either way. Each entry under this change reads one of the two.
- The lettering play on the 780M under AMDVLK to frame 4016 (m3-max-72116, this change against
  its base ff2b13cb96): blockiness 2.92 against the base's 9.15 and RADV's 2.87. In the same job
  under AMDVLK, the runtime's device suite (717 tests, one process each) reads 714 passed and the
  same 3 failed for base and change, 0 verdicts differing; `conformance replay --gpu` gives
  identical verdicts and lines.
- Lowering diff, card-free (m3-max-72134), on every committed profile over five recordings,
  base against change: only fragment-stage modules differ (22514 of 43708 render states, from
  906 fragment entry points); 0 vertex modules and 0 of 16160 compute modules differ; on
  nvidia-pascal-linux and runtime-floor no module differs and only the reconvergence and the
  note move. The golden table's 1079 changed cells are 83 fragment entries (!air.fragment) on
  the 13 profiles with maximal reconvergence (m3-max-72117); its bless is due at the next pin.
- Reach (m3-max-72028, m3-max-72101, m3-max-72194): on the 780M RADV profile, standing for the
  13 maximal profiles, 229 fragment entry points of the lettering recording, 906 of five other
  recordings and 3108 of fifteen more lose the mode; none still states it.
- Timing, base / change / base, each play from empty caches, GPU busy against the base mean:
  the 780M under RADV, 4017 frames (m3-max-72164), +0.07% whole play, +0.06% from frame 250, at
  most +0.96% in any 250-frame window after it; the RTX 3090, 751 frames (m3-max-72163), +0.82%,
  +1.08%, at most +1.71%, clocks alike per arm; the Iris Xe, 751 frames (m3-max-72202), -0.07%,
  -0.04%, at most -0.01%. The RTX 5080's run (m3-max-72128) read noise: its base arms' GPU
  busy stood 3.0-8.5% apart in four of five windows.
- Release translation of the largest row, the 357,837-word lettering fragment module, through
  the command line with spirv-val: 0.28 s and 43.6 MiB, as the base's 0.29 s and 43.5 MiB
  (m3-max-72178). The slowest single pipeline of a recording compiles in at most 0.5 s on a loaded
  host, and its process peaks at 436 MiB (m3-max-72169, m3-max-72177); five recordings' batch,
  75 runs a side interleaved, takes 0.44% longer than the base's (m3-max-72134).
- Tests (engine_quad_loops): derivatives in selections, after merges, after a loop and in a
  one-latch loop state no mode and no note on every committed profile; a two-latch loop around a
  sample or dfdx takes the profile's mode and, without maximal reconvergence, the note; a
  fragment quad operation keeps the mode. With the routing switched off,
  derivatives_outside_a_re_entered_loop_state_no_mode_and_no_note fails and the other two pass
  (m3-max-72117). Gate at this commit (m3-max-72200): fmt, clippy in every configuration, Rustdoc,
  the suites, the doctests and lavapipe's quad_control pass, but for the golden table's bless;
  `conformance replay --cpu` on lavapipe, reconvergence cases included, reads the same as on
  62ab49b966 line for line, and holds the ledger.
2026-11-23 14:19:33 -08:00
Anees Iqbal 62ab49b966 Conformance ledger: the reconvergence rows on the Iris Xe
The Iris Xe (RPL-P, Mesa ANV; job m3-max-72186) answers the four
trilinear sites of reconvergence-handle-choices exactly as every AMD
venue does: 1128, 1136, 2240 and 490 elements, each one step of a half,
on the second source only. Everywhere else it matches Metal, so four
rows are scoped to "Iris(R) Xe". The llvmpipe diagonal rows now list
every GPU replayed that answers Metal's there. CONFORMANCE-COVERAGE.md
regenerated.
2026-11-23 13:59:31 -08:00
Anees Iqbal 17802357be Conformance ledger: the AMD trilinear rows hold on every AMD venue
The four trilinear rows of reconvergence-handle-choices were scoped to
the 780M. The RX 550 (POLARIS12, job m3-max-72170) and the RX 7900 XTX
(NAVI31, job m3-max-72171) under RADV answer the same four sites with the
same counts (1128, 1136, 2240 and 490 elements, each one step of a half)
as the 780M under RADV and AMDVLK, and match Metal everywhere else. So
the rows are now scoped to "AMD Radeon", which every one of those venue
names holds. The RTX 2080 (job m3-max-72171) matches Metal on both cases.
CONFORMANCE-COVERAGE.md regenerated.
2026-11-23 13:59:31 -08:00
Anees Iqbal baae603de4 Conformance ledger: the llvmpipe diagonal rows say what differs, and point at nothing private
The two level-and-pair rows on llvmpipe (rc_loop, rc_break) pointed at
a bug list outside the repository. Each now says, on its own, what
differs: the fine pair along the full-screen triangle's diagonal
x + y = 62 to 63, the same with and without MaximallyReconvergesKHR. It
also says where it was measured (LLVM 23.1.1, 256 bits, AVX2) and which
drivers answer Metal's. Only the text field changed, so neither row's
identity (case, verdict, site, answer) moved. CONFORMANCE-COVERAGE.md,
which quotes the rows, was regenerated.
2026-11-23 13:59:31 -08:00
Anees Iqbal 957961d8d5 Conformance: reconvergence's module doc states its loops' real bound
rc_break runs up to 6 + 2 = 8 iterations, so "a data word below 7" was
wrong. Every loop in the fixtures runs at most eight iterations.
2026-11-23 13:59:31 -08:00
Anees Iqbal 2a8cfdec04 Docs: CONFORMANCE-COVERAGE.md regenerated for the reconvergence ledger rows and declarations
The doc derives from the ledger and from each module's declarations as
well as from the recordings. It went stale at dbcc0a89df (the
reconvergence module stopped declaring notices: modules declaring a
notice 43 -> 42) and at 853a406696 (18 ledger rows, 7969 -> 7987).
884a70ab0d's body says coverage.py --check still passed there. That is
wrong: the check failed there, for these two causes. It passes at this
commit.
2026-11-23 13:59:31 -08:00
Anees Iqbal c505deb3be Conformance: Metal's times for the reconvergence cases, kept in their recordings
`conformance times --runs 8 --write reconvergence-constructs
reconvergence-handle-choices` was run on the reference M3 Max (job
m3-max-72159). It added one time record to each recording and changed
nothing else, which a comparison of the JSON keys before and after
confirmed. Without it, times::every_case_is_timed failed (gate
m3-max-72143). coverage.py --check still passes.
2026-11-23 13:59:31 -08:00
Anees Iqbal 12f2440aff Fixtures: reconverge_sample's and reconverge_select's golden printouts
Written by tests::air_input::bless_engine_goldens under the pinned LLVM
on msi-laptop at dbcc0a89df (job m3-max-72157). These are the only two
files it changed. Without them, engine_fixtures_match_their_golden_printout
failed (gate m3-max-72143).
2026-11-23 13:59:31 -08:00
Anees Iqbal 9a2f2b81a9 Conformance ledger: the reconvergence cases' rows on llvmpipe and the 780M
Replayed at dbcc0a89df/7bb5681381 with the carried conformance binary:
- RTX 3090 (m3-max-72150): both cases compared and matched; only native notes differ.
- RTX 5080 (m3-max-72151): the same.
- M3 Max under KosmicKrisp (m3-max-72149): the same.
- 780M under RADV (1002:1900, m3-max-72150; 1002:15bf, m3-max-72156)
  and under AMDVLK v-2025.Q2.1 (1002:15bf, m3-max-72156):
  reconvergence-constructs matches; reconvergence-handle-choices differs
  only in the trilinear site of its four draws. Each sample of the second
  source (values 21 + n) is one step of a half from Metal's. The counts
  are the same on both drivers and both parts, so the rows are scoped to
  780M.
- llvmpipe (LLVM 23.1.1, 256 bits, x86-64 AVX2; m3-max-72151): the
  trilinear site of every draw differs (rule 1, device-sampling). The
  level-and-pair site differs only on rc_loop (14 elements) and rc_break
  (17 elements), along the diagonal x + y = 62 to 63. That is lavapipe's
  diagonal, which the lane earlier saw the same with and without
  MaximallyReconvergesKHR (job 72077) and on no GPU. Its row points at
  the development bug list's row.

No level-and-pair difference on any GPU. The Iris Xe replay waits for
ms01's hold.
2026-11-23 13:59:31 -08:00
Anees Iqbal dc8d05b37b Conformance: reconvergence declares no notice
device-reconvergence and quads-split-by-clipping fired on no venue: the
M3 (KosmicKrisp, m3-max-72149), the RTX 3090 and the 780M under RADV
(m3-max-72150), and the RTX 5080 and llvmpipe (m3-max-72151). Every
other notice those runs announced is one of the suite's native notes.
2026-11-23 13:59:31 -08:00
Anees Iqbal 0c21266c14 Conformance: reconvergence's hash model lives in its tests, the one place that reads it
The release build of the library warned that hash was never used (job
m3-max-72147): only the tests' model calls it.
2026-11-23 13:59:31 -08:00
Anees Iqbal 1680e7ffd1 Conformance: Metal's answer for reconvergence-constructs' eight draws, recorded on the M3
Recorded on the reference M3 Max (macOS 27.0.1, 26A434) by
`conformance record reconvergence-constructs` at 2cf4666ddc (job
m3-max-72146, after the build m3-max-72145). It ran 3 times with 1
distinct outcome, and the validated leg ran.

A script over the recordings checked Metal's nearest samples against
the module's hash model: all 4096 pixels match on every draw of both
cases, as does the fine pair on the rc_pick draws (896 pixels for the
small triangles).

docs/CONFORMANCE-COVERAGE.md was regenerated after the drop. It is
byte-for-byte what 7ad44c4561 committed, because the counts it derives
(modules, recordings) did not move, and coverage.py --check passes at
this commit.
2026-11-23 13:59:31 -08:00
Anees Iqbal 03b0e094f4 Conformance: reconvergence holds only constructs Metal defines; rc_return and rc_continue dropped
The suite compares only what Metal defines: where MSL leaves a
derivative undefined, Metal's answer is no contract, and a recorded
match would make a device's luck a contract. The class rule says a
derivative is undefined after an early return inside a selection, after
a break or continue to a construct around the innermost one, and inside
a construct a quad entered diverged. Draw by draw:

Kept (defined):
- rc_if: after an if/else that closed; every lane of the quad arrives.
- rc_loop: after a loop of the pixel's own trip count, exited through
  the loop's own merge.
- rc_break: after a break to the loop's own merge.
- rc_switch: after a switch of one label per case that closed.
- rc_discard: after a discard, which Metal runs as a demote, so the
  discarded lane stays a helper for the quad's derivatives.
- rc_grid: inside selections and a loop uniform over 8x8 blocks, so
  every quad runs them together.
- rc_continue_quad: the continue goes to the loop's own continue target,
  not to an enclosing construct; the sample is in the next iteration,
  which every lane enters together after the loop's back edge.
- rc_latches: after an if/else whose two arms both end the iteration;
  the sample is in the next iteration, as above.
- rc_select, rc_select_quad, rc_pick, rc_pick_cells: inside a selection
  uniform over 8x8 blocks; only the texture chosen differs per pixel or
  per 4x4 block, and MSL's default allows a non-uniform choice.

Dropped (undefined):
- rc_return: after a callee's early return inside a selection.
- rc_continue: after a continue from inside a switch to the loop around
  it, which is a continue to an enclosing construct.
Both matched Metal on every card the lane ran; that stays lane evidence.
rc_return_entry and rc_diverged were already left out for the same rule.

The earlier count of 15 counted the cases where the Metal-defined bar
applied as the lane first reported them. Under the class rule the suite
holds 12 draws: 8 constructs and 4 handle choices.

reconverge_sample drops the two entries and the callee rc_return used,
recompiled by scripts/regen-air-fixtures; its four inventory rows go too.
reconvergence-constructs' recording is removed here, and a new recording
comes in the next commit. reconvergence-handle-choices' inputs did not
change, so its recording stays.
2026-11-23 13:59:31 -08:00
Anees Iqbal 5216a5cde1 Conformance: Metal's answers for the reconvergence cases, recorded on the M3; coverage regenerated
reconvergence-constructs and reconvergence-handle-choices were recorded
on the reference M3 Max (macOS 27.0.1, 26A434) by `conformance record`
at a1ffe24d32 (job m3-max-72140, after the build m3-max-72139). Each
case ran 3 times with 1 distinct outcome, and the validated leg ran.

A script over the recordings checked Metal's nearest samples against
the module's hash model, and rc_pick's fine pair too: every draw
matches. That is 4096 pixels for each full-screen draw and 896 for
rc_pick over the small triangles. The module's test makes the same
check in Rust.

docs/CONFORMANCE-COVERAGE.md was regenerated by
scripts/conformance-coverage/coverage.py.
2026-11-23 13:59:31 -08:00
Anees Iqbal 148ad25af0 Conformance: reconvergence binds pick only for the draws whose fragment reads it
Metal's API validation stopped the handle-choices case's validated leg
at render: "unused fragment binding in render encoder at Buffer index 1"
for rc_select and rc_select_quad, which declare no buffer 1. Each draw
now says whether it binds pick, and the draws input fingerprints that.

Seen in the first recording on the M3 (job m3-max-72137). In that
recording Metal's nearest samples, and rc_pick's fine pair, match the
module's hash model on all 14 draws (checked by a script over the
recording; 896 pixels written by the small triangles).
2026-11-23 13:59:31 -08:00
Anees Iqbal 4ba24d6e23 Conformance: reconvergence, implicit-LOD samples and a fine pair after each construct a fragment reconverges from
Two cases over the owned fixtures reconverge_sample and reconverge_select.
Each fragment writes (the nearest sample, dfdx(v), dfdy(v), the
trilinear sample) over a 64x64 RGBA16Float target cleared to -1.
reconvergence-constructs draws ten fragments: if/else, a loop of the
pixel's own trip count, a break, a switch, a discard, a callee's early
return, a continue from a switch, block-uniform selections and a loop,
and the two uniform-loop iteration cases. reconvergence-handle-choices
draws three handle ternaries (per pixel, per 4x4 block, by a constant
the draw shares), the last also over 64 small triangles.

Each draw's row has two sites over its texels. level-and-pair holds the
nearest sample and the fine pair, which is what reconvergence decides.
trilinear holds the trilinear sample, whose bits are the device's filter
(rule 1), so a venue whose filter answers other bits gets a ledger row
for that site alone. The module's tests check the recorded nearest
samples (and rc_pick's pair) against the fixtures' hash model, and read
recordings only.

Not recorded yet: Metal's answers come from the M3 next.
2026-11-23 13:59:31 -08:00
Anees Iqbal 0f87d64fb7 Fixtures: reconverge_sample and reconverge_select, implicit-LOD samples and a fine pair after each construct a fragment reconverges from
reconverge_sample: ten fragment entries and one covering vertex function.
Each fragment writes (the nearest sample, dfdx(v), dfdy(v), the
trilinear sample) of an r16_float 1024x2 source of 11 levels, level n
holding n + 1, at a coordinate whose scale is 2^q texels per pixel for a
quad-uniform q, so the nearest sample reads level q exactly. The
constructs: an if/else on data, a loop of the pixel's own trip count, a
break to the loop's merge, a switch of one label per case, a discard, a
noinline call that returns early in a selection, a continue from a
switch, selections and a loop uniform over 8x8 blocks, and a uniform
loop's second iteration after one pixel per quad ended the first early
(by a continue, or by an if/else at the body's end).

reconverge_select: the same tail through a texture a ternary on two
texture handles chooses (the second source's level n holds 21 + n),
inside a selection uniform over 8x8 blocks: per pixel, per 4x4 block,
and by a constant the whole draw shares; rs_cells draws a small triangle
in each 8x8 cell of a 64x64 target.

Two shapes Metal leaves undefined (an early return of the entry, and a
selection a quad entered diverged) are not included.

Compiled by scripts/regen-air-fixtures with the pinned LLVM 21. The
inventory rows say ok on every profile; the gate has not checked them yet.
2026-11-23 13:59:31 -08:00
Anees Iqbal 9633841114 rt test: the loop-flag test compares the flags' raw values
ash's PipelineCreateFlags is not Debug under the features the runtime takes, so assert_eq! on the
flags themselves did not compile under --cfg m2v_gpu (landing build m3-max-72091, E0277 at
tests/draw.rs:3036). The test compares their raw values instead; what it checks is unchanged.

Verified: the gate and the device runs follow on this commit.
2026-11-23 13:11:44 -08:00
Anees Iqbal ca674b6dcf rt README: AMD's Windows driver is expected to take the loop; the feedback usage's price on AMDVLK
The floor's attachment-read section says, in one sentence, that AMD's Windows driver is expected
to take the feedback loop, not verified in the lab: public reports of that driver list
VK_EXT_attachment_feedback_loop_layout from 2.0.250 on.

The render encoders' known gaps record the price the loop's image usage has under AMD's open
Linux driver (AMDVLK 2025.Q2.1) on the Radeon 780M: the harness's draw_full (64 draws over a
512 x 512 RGBA16Float target of shader-read and shader-write usage, reading no attachment) takes
413.8 us against 404.7 us on an image without the usage (2.2%; m3-max-72026 B against A, and
m3-max-72033's probe with the usage and no flag against A), a render-target-only target the
same either way, and the flag itself no time measured there (72033) or on RADV (m3-max-72020).

Verified: text only; the docs gate follows.
2026-11-23 13:09:40 -08:00
Anees Iqbal 445738a962 rt: a content's pipelines take their create flags from one field, and a test holds every render pipeline to the loop's flag
RenderCompiled::flags holds the create flags every VkPipeline of a content takes (its primary,
its named class's and each one made at a later draw): the feedback loop's colour flag where
device creation enabled the attachment feedback loop, none otherwise. make() reads it for every
pipeline it creates.

The device test every_device_makes_every_render_pipeline_with_the_loop_s_flag_where_it_has_the_loop
checks it on every device of the cfg's kind for a state whose fragment function reads no texture
and one that reads its pass's attachment through one. Where the device has the loop, it then
draws with both in one pass, the second writing the attachment after the first read it, and
checks one loop read, no copy and every pixel the second draw's colour. Without the form (no
flag on the pipelines) the first assertion fails on every device with the loop; the validation
layer does not catch a missing flag (the attachment-read tests all passed under it at a probe
with no flag on any pipeline, lavapipe, m3-max-72084).

Consumer search (main, at the consumer's development b7a376f2a): zero hits for
feedback_loop_dynamic, ATTACHMENT_READ_EXTENSIONS and attachment_feedback_loop_dynamic_state;
it reads Capabilities::feedback_loop, kept.

Verified: the gate and the device runs follow on this commit.
2026-11-23 13:09:40 -08:00
Anees Iqbal 9875546154 rt README: the UHD 630 is expected, not verified, to lack the feedback loop's layout extension
The copy-route gap names the UHD 630 (Windows driver 101.2145) as a device without
attachmentFeedbackLoopLayout. That is now the only condition for the copy route, so the claim says
what it rests on: no public report of that card on Windows lists the extension (Intel's earliest
Windows driver that does is 101.4146, on Gen12). It was not read from the lab's card.

Verified: nothing beyond the text; docs only.
2026-11-23 13:06:27 -08:00
Anees Iqbal 22ca6271eb rt: every render pipeline takes the feedback loop's colour flag; the loop's dynamic state goes
The attachment feedback loop needed two extensions: VK_EXT_attachment_feedback_loop_layout and
VK_EXT_attachment_feedback_loop_dynamic_state. A device that lists the layout extension without
the dynamic state (AMD's open Linux driver on the Radeon 780M) read every attachment through the
counted copy into the image's shadow.

Now the loop needs the layout extension and its feature alone. Every render pipeline is made with
VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT where the device reads attachments
through the loop. A render state is made before any draw binds its textures, so the flag goes on
every pipeline, and a draw that reads no attachment is valid with it (the flag says a pipeline may
be used with a feedback loop; no VUID ties it to a read). The encoder no longer sets the loop's
enable at its first draw and where it changes (its LOOP dirty bit is gone), and device creation no
longer enables the dynamic-state extension or its feature. The copy stays for devices without the
layout extension. RADV and ANV read only the depth/stencil bit of the flags; a colour image's
compression follows the feedback layout, which is unchanged.

Breaking change of metal2vulkan-runtime: floor::Features loses its public field
feedback_loop_dynamic, and floor::ATTACHMENT_READ_EXTENSIONS lists the layout extension alone
(api_signatures.tsv blessed). The consumer's checkout at 9f0bfa296 has zero hits for
feedback_loop_dynamic and ATTACHMENT_READ_EXTENSIONS (grep over the tree); it reads
Capabilities::feedback_loop only. docs/REFUSALS.md regenerated with no change; no refusal or
translator name moved, so api_surface.rs is unchanged.

The floor test the_attachment_reads_take_the_feedback_loop_where_reported_and_a_copy_elsewhere
now takes a device listing the layout extension alone to the loop, and enables no dynamic state
where the device lists it too.

Verified: nothing yet; this commit's compile, test and timing jobs follow.
2026-11-23 13:06:26 -08:00
Anees Iqbal ff2b13cb96 Tests: bless the golden table at the pin e483982c8d (SEMANTICS 2295 -> 2297)
The golden table last blessed at 79af862d87 under SEMANTICS 2295. The
ballot readers and the quad-free subgroup requirement (Q) moved SEMANTICS
to 2297 and changed output under unchanged keys in 72 rows, 644 cells:

- Q: 44 rows x 7 Q profiles = 308 cells (24 .ll + 20 .air.ll rows). Four
  .ll fixtures have no .air twin: kernel_quad_ops_linear,
  kernel_quad_variant_leftovers, kernel_quad_vote and
  kernel_three_way_and_shuffle_math.
- Ballot: 28 rows x 12 quad-control profiles = 336 cells (14 .ll + 14
  .air.ll rows).

By kind: 336 .ll cells, which the test compares on every host, and 308
.air.ll cells, which need metal-as and are compared on the Mac alone. No
key changed; no other row moved.

Verified: bless job m3-max-71906 on the M3 regenerated the table at
e483982c8d; this commit is that output. The pin's round at e483982c8d
(47.4 min, 41 of 42 items exit 0) failed only
golden_hashes_match_the_table in core (3616/3617, job m3-max-71976), the
bless due named here. The planner named e483982c8d the pin on that round.
2026-11-23 13:02:47 -08:00
Anees Iqbal e483982c8d rt: a stale heap texture takes part until its next write, whether or not a link is left
A texture's staleness outlives its links. When U, written over T's bytes, was released, its
release took T's last link and set T's part to false. `uses()` keeps only placements that take
part, so T's next write added no check, T never moved from undefined, and its stale flag was
never read again. Vulkan's aliasing rule does not end when the other resource is destroyed.

Now a placement takes part while it has a link, or while it is a texture that owes a move (stale,
as the submit thread has staged the segments). A release leaves a stale texture taking part. The
submit thread, as it stages a write that clears a texture's staleness, ends its part where no
link is left, and with it its count in the device's placements that take part, which keeps the
heap-free fast path. Both changes are O(1): the release's own walk of its links, and one test
under the written placement's links lock, which the stage already took.

A texture placed over another's bytes is stale from its placement. It now keeps taking part
through that other's release until its first write, which moves it.
2026-11-23 12:10:16 -08:00
Anees Iqbal e47eba9230 rt test: a heap texture written over by an alias since released still moves at its next write
T, an RGBA16Float heap texture, is written and read. U is placed over T's bytes and written. Then
U is released: its command buffer complete, every handle dropped, and the test waits until T
holds no link. T's next write, of its first half of rows, is to move T from undefined first
(heap_moves 1), and T's read is to hold those rows.

Vulkan's aliasing rule does not end when the other resource is destroyed. U's write made T
stale. U's release took T's last link, and with it T's part: `uses()` keeps only placements that
take part, so T's next write adds no check and T never moves. This commit holds the test alone,
which is to fail here (heap_moves 0); the fix follows.

write_rows (tests/heap_alias.rs) is write of a texture's first rows alone, and floats is
pub(crate).
2026-11-23 12:10:16 -08:00
Anees Iqbal 05f71f54c1 rt: a quad-only kernel's ragged grid runs on its partial-threadgroups variant, checked on every device
On the profiles the quad-free tier changes, a quad-only kernel's partial-threadgroups variant was
refused before it (the emulated tier has no partial variant), so a ragged dispatchThreads grid of
such a kernel is a path that never ran there, and it runs at a size the device picks.

every_device_runs_a_quad_only_kernels_ragged_grid_on_its_partial_variant: quad_edge (inline AIR: a
quad_shuffle to the next quad lane and a quad_ballot of g % 3 != 0) over grids of 2 x 64 + 22 and
61 threads in threadgroups of 64 (or the variant's largest multiple). Each grid adds one to
partial_variant_ragged_grids and none to emulated_simdgroup_dispatches; every thread's ballot is
its quad's threads in the grid, every shuffle whose source thread is in the grid reads it (a read
past the grid is not promised, MSL 4.1 section 6.10.2), and the words past the grid keep their
fill. Where the device takes the quads at its own size the variant has no pinned size,
ALLOW_VARYING_SUBGROUP_SIZE and REQUIRE_FULL_SUBGROUPS, whole groups of maxSubgroupSize. Prints
which and the ragged grids it ran. quad_sizes is the existing quad test's device query, shared.

Verified by the jobs named in the landing line (lavapipe at 8 and 4 lanes, the Iris device leg).
2026-11-23 12:02:56 -08:00
Anees Iqbal 69b5f58dde Validation: the runtime guard's hash for the quad-free subgroup requirement
device/subgroup.rs and lower/dispatch.rs are runtime guard inputs. Their change is compile-time:
SubgroupRequirement gains `varying`, quad_free and quad_requirement pick a quad-only kernel's
requirement, add_device_facts asks the stage flag ALLOW_VARYING_SUBGROUP_SIZE for it, and
plan_kernel takes that requirement. The requirement and its stage flags are in the pipeline the
artifact digests (the codec carries `varying`), and a requirement without `varying` runs as before,
so no run of a given artifact changes: the hash alone moves
(5f611d76cc7fe24cedb2197787d0796be5a8eb5a228d33aecb08e4a0e7d1a302, the value the guard test printed
in the suites job m3-max-71763 at 6f2b064366).
2026-11-23 12:02:56 -08:00
Anees Iqbal b9ff87830f Tests: lavapipe's quad-only kernels take their quads from its subgroups
The quad-free Direct tier applies on lavapipe (8 lanes, 4 under a 128-bit native vector width), so
the tests that held every quad kernel there to the emulated tier now say which tier each takes:

- engine_simd_emulated: validate, run_kernel_under and barriers compile a kernel whose own plan is
  quad-free (SimdPlan::quad_free, asserted Direct) as its emulated-simdgroups variant, the module a
  dispatch whose threadgroup is not a multiple of lavapipe's size runs; every other kernel keeps
  its own inputs. The module doc says so.
- engine_simd: float_group_arithmetic_without_fast_flags_keeps_signed_zeros names each profile's
  simdgroup tier and quad tier (lavapipe: Emulated and Direct).
- engine_quad_ops: a kernel whose lockstep order needs emulated simdgroups (an inserted barrier of
  Origin::LockstepEmulated) stays Emulated, as select.rs decides before the quad-free test;
  quad_ops_divergent is one on lavapipe. The new test counts the kernels that took the varying
  size and asserts some did, and runs at 32 lanes only a plan pinned at 32.

Found by the suites job m3-max-71763 at 6f2b064366 (product: 7 of these tests failed on lavapipe's
profile; nothing else but the golden table, blessed at the pin). Verified by the compile job named
in the landing line.
2026-11-23 12:02:56 -08:00
Anees Iqbal 932ef756df Lowering: a quad-only kernel takes its quads from the subgroup at the size the device gives below 32
The 32 lanes of a Metal simdgroup are needed only by operations that read outside a quad. A kernel
whose every cross-lane operation is a quad operation (lower::simd::quad_only: some group operation,
each of quad scope, and no simdgroup-scope operation, AGX or matrix multiply-add, or subgroup-scope
barrier or fence) now takes the Direct tier with full subgroups and no required size where the
kernel stage runs full subgroups of its operations and its narrowest subgroup is below 32 lanes
(device::subgroup::quad_free, read from the stage's size range alone). Its requirement
(quad_requirement) sets ALLOW_VARYING_SUBGROUP_SIZE where the stage can take a size, and a local
size that is a multiple of the stage's largest size (VUID-VkPipelineShaderStageCreateInfo-flags-02758);
a threadgroup that is not runs the emulated-simdgroups variant, as a pinned kernel's does. Such a
kernel pins nothing, so the widest-pin rule does not weigh it. The pin to 32 stays where 32 is the
device's narrowest size.

Why it is exact: a quad is four subgroup lanes from a multiple of 4, all in one subgroup (Vulkan
9.27.9), and a compute dispatch runs one subgroup size (9.5.2); the kernel's simdgroup builtins
derive from the linear index (SubgroupId * SubgroupSize + SubgroupLocalInvocationId, reading the
SubgroupSize builtin where no size is pinned), and its quad operations from SubgroupLocalInvocationId
& 3 and & ~3, so every size of 4 lanes or more gives Metal's quads.

The guard min >= 4: a quad must be four lanes of one subgroup. A stage whose narrowest subgroup is
1 or 2 lanes could split a quad across subgroups, so such a stage keeps the tier its class takes.

A kernel with compute derivatives keeps the tier its class takes: their quads need its
two-dimensional local size, which the flattened tiers refuse (ComputeDerivativesWithSimd). Without
this exclusion lavapipe's quad kernels with derivatives, which run emulated today, would be refused.

Where it applies among the committed profiles: the four Intel ANV profiles (8 to 32: multiple 32,
varying), lavapipe and gate-lavapipe-x86_64 (8: multiple 8) and gate-lavapipe (4: multiple 4). Not
on NVIDIA (32), RDNA (32 to 64), moltenvk-m3 (its kernel stage takes no size, so it runs the API's
32 alone) or runtime-floor (no quad class).

Measured on the Iris Xe (RPL-P, ANV), job m3-max-71702, the lane-only form of this change (E: the
base at eda92e1207, Q: this form, E2: the base again; cold plays of the consumer's recording to
frame 345): the regression row's kernel took Q in all 21 of its constant sets (15832 dispatches,
100%); per dispatch E 1.6018 ms, Q 0.7314 ms, E2 1.6006 ms (Q/E 45.7%); values E/Q and E/E2 0
differing of 261 buffers; translation 18 s and 0.92 GiB peak against 17 s and 0.92 GiB. The
driver's executable statistics (job m3-max-71726): Q compiles at SIMD8 (SIMD16 for one state),
15 to 50% fewer instructions than the emulated form, against about 2800 spills a state when pinned
to 32.

SEMANTICS_VERSION 2297 (modules change on the profiles above); ARTIFACT_FORMAT_VERSION 595
(SubgroupRequirement gains `varying`).

Tests: device::tests::subgroup (the predicate over size ranges, the guard, and the committed
profiles it takes), engine_simd (a quad-only kernel's requirement on every committed profile, and
the flattened kernels' constraint), engine_quad_ops (the quad fixture's kernels in the Direct tier at
8 on lavapipe and at 8, 16 and 32 on an Intel profile; the emulated variant on lavapipe),
engine_dispatch (derivatives beside a quad keep lavapipe's emulated tier), and the runtime's
every_device_runs_a_quad_only_kernel_at_the_size_it_gives under a device cfg.
2026-11-23 12:02:56 -08:00
Anees Iqbal 3f6f66463b rt README: what placing a heap resource costs the runtime
A new heap buffer looks at the heap's live textures, a new heap texture at all
its live placements, and a release takes out only its own entry (the two
commits before this one). The README now says so beside the heap calls, so the
cost of placing is stated where a consumer reads how to place.
2026-11-23 11:57:00 -08:00
Anees Iqbal 048f1204f7 rt README: a heap buffer's possible write makes the textures over its bytes stale
The heap form counts a use that may write a heap buffer (a bound slot its
function does not read only, or a declared write) as a write of the whole
buffer, so every texture placed over its bytes goes stale and its next write
moves its whole image out of undefined. A guest that writes only part of such a
buffer, or none of it, can lose what such a texture held on a device whose move
resets an image. The known gaps now say so.

How the gap was weighed: a card-free model of the form's marking at c553ebbfcb,
replayed in commit order over three recordings (a discrete-made and an
integrated-made run of a GPU compute benchmark, and a 4,028-frame app walk; jobs
m3-max-71817 and m3-max-71825), counted the textures made stale only through
buffer write-uses and then read or written in place: zero on all three. Kernels'
access came from the compiled interface; no draw whose stage the model could not
read binds a linked texture or buffer. The model links at each format's least
size, so a device's larger images can only add meetings it did not count.

This lands with the two commits before it, which end the heap form's measured
regression (c553ebbfcb played +7.8% GPU busy and +34% wall on an RTX 3090, and
+40% wall on a Radeon RX 7900 XTX, on the discrete-made recording). The cost was
rt's own CPU in placing and releasing heap buffers, not the moves. Card-free
model, job m3-max-71838, placements examined per new placement, mean (largest):

  recording   kind      new      at c553          now
  discrete    buffers   48,555   1,412.2 (4,914)  0.1 (31)
  discrete    textures   3,382      26.3 (207)    26.3 (207)
  integrated  buffers   48,646   1,409.7 (4,914)  0.0 (9)
  integrated  textures   3,741      25.0 (185)    25.0 (185)
  walk        textures   1,121       2.4 (7)       2.4 (7)

In the discrete recording's frames 325-349 the scans fall from 68,541,756 to
2,000 and the links made and dropped from 21,265,001 to 600. Scope: the model
lets a placement go at the guest's release, while rt holds one while a command
buffer in flight holds it, so rt's own counts are at least the model's.

Measured, the same recording played cold to frame 344, base acda405b30 against
fec822fe72 (these two commits' runtime sources), arms alternated in one job:
RTX 3090 (m3-max-71842) GPU busy +0.53% mean, wall +0.5%, player CPU user
119.9 s against 123.9 s; RX 7900 XTX (m3-max-71841) GPU busy -0.19% to +0.01%,
wall -0.2%, player CPU user 30.0 s against 29.9 s; heap_moves 1,561 in every
form arm on both cards.
2026-11-23 11:56:20 -08:00
Anees Iqbal a40f1d87d8 rt: no link joins two heap buffers, a buffer looks only at its heap's textures, and a release takes its own entry
The heap form's CPU cost on the XTX (kernmap 71811: player CPU user 30.0 s base against 56.9 s with
the form and 55.4 s with the texture-links fix, in frames 325-349, where the recording places
48,555 heap buffers with 21.3 M buffer-buffer meetings) sat in three places, none of which the
form's moves need:
(a) every meeting stored two links, buffer-buffer meetings included;
(b) a release walked each link, locked the other and retained over its whole lists;
(c) each placement and each release retained over every placement of the heap.

Now:
- A meeting of two buffers makes no link. Nothing used one: only a texture is ever moved, a
  write stales only its texture links, and a texture's check before its move looks only at the
  texture's own links, its links to buffers among them.
- A heap's live placements are kept by kind, in maps keyed by address (`alias::Places`): a new
  buffer looks at the heap's textures alone, a new texture at every live placement, and a release
  removes its own entry, with no pass over the others.
- A release drops its link from each linked placement's list of its own kind alone.

The same textures move before the same writes: the links from textures are the ones they were.

Test: the buffers test also asserts that two meeting buffers hold no link and that each holds one
link, to the texture, once a texture is placed over them. A new device test counts the entries a
new placement looks at (a test-only count): a new buffer's equal the heap's live textures, with
none, 100 and 10,000 live buffers; a new texture's are at most the heap's live placements. Before
this change a new buffer looked at every live placement of its heap, so its count grew with the
live buffers.
2026-11-23 11:56:20 -08:00
Anees Iqbal bfc2155820 rt: a heap placement walks only its links to textures on a write, and a buffer whose bytes meet no texture's takes no part
The heap form's write of a linked placement walked every link, buffers included, twice: on the
encoding thread (Marks::used, a mark and a Weak a link) and under the submit thread's work lock
(alias::stage, a store a link). Only a texture is ever moved and only a texture's staleness is
read, so a placement now keeps its texture links apart from its buffer links, a write walks the
texture links alone, and a buffer whose bytes meet only buffers' takes no part (uses() skips it,
and the device's count of placements that take part leaves it out). A check still looks at every
link's read before a move, buffers' included. The same textures move before the same writes.

The RTX 3090's discrete-made recording read +7.8% GPU busy with the form (kernmap 71767): this is
the CPU candidate; its gate and the 3090 arm follow.
2026-11-23 11:56:19 -08:00
Anees Iqbal c8eb19196a validation: the dump compare test expects the compute-bound texture among the compared dumps
The dump extension (1944b82e20) writes each texture a listed command buffer's compute
encoders bind; the covered-word test's encoder binds texture #5, so its compare reads two
dumps. The test's count assertion said so; its expected summary line still said 1.

Verified: gate m3-max-71853 at 1944b82e20 failed only this line (1305 of 1306 passed); the
rerun gate is the one named in the land line.
2026-11-23 11:55:37 -08:00
Anees Iqbal c54fa438a2 Player: a dump holds each texture a listed command buffer's compute encoders bind
--dump-command-buffers wrote every buffer a listed command buffer's
encoders named and every colour attachment its render passes stored, so
a texture a compute pass wrote showed only through a later pass that
sampled it. A play that parts between two drivers in a render pass that
samples a compute pass's textures could not say which of the two passes
parted first.

dumps::Stores now keeps the compute encoders made and not yet ended,
and each texture such an encoder binds (setTexture:atIndex: and
setTextures:withRange:, a nil one left out) is a part to dump: its first
level and slice, read once the command buffer completed, as an
attachment's parts are, into cbC-objT.bin with the cover "-". A texture
both stored and bound holds each part once, in Part order. An argument
encoder's setTexture:atIndex: is none: its receiver is no compute
encoder. docs/REPLAY-STREAM.md and the module docs say what a dump holds.

Test: a_listed_command_buffer_dumps_the_textures_its_compute_encoders_bind
(one bound texture, a range with a nil, a texture bound twice, a render
encoder's fragment texture and an unlisted command buffer's compute
texture left out).
Verified: clippy -D warnings over the workspace with all features, and
the validation suite, the new test among them (job in the land line).
2026-11-23 11:55:36 -08:00
Anees Iqbal 5cc3efc5bb rt README: the indirect draws' NVIDIA execution cost as measured, unstamped, with a command buffer boundary per render encoder ruled out
The known gaps of indirect command buffers now record what an execution costs on NVIDIA's driver,
each figure with its job and card:
- A guest's frame: +13.6% on an RTX 3090 (3.446 against 3.034 ms, the consumer's jobs
  m3-max-64069 and m3-max-64113) against -1.5% on a Radeon RX 7900 XTX (4.305 against 4.372 ms,
  m3-max-64076 and m3-max-64084).
- The light frame (a timing test at 2,260 quads a command): +69.0% on the 3090 (1,868.8 against
  1,105.9 us, job m3-max-71730) against +28.9% on the XTX (719.7 against 558.4, job m3-max-71686).
- The 3090's 735.5 us over direct, split by a probe (job m3-max-71730):
  - each execute call's preprocessing, about 28 us a call (about 4.0 on the XTX), 41%;
  - per-draw cost inside the executes, 26%;
  - the splits and the parts at the bound, 22%;
  - tokens, 9%.
- Explicit preprocessing (`vkCmdPreprocessGeneratedCommandsEXT`) gains on NVIDIA (1,896.7 against
  1,909.8 us) and loses on RADV (808.1 against 745.1), so it is not taken.
- A command buffer boundary per render encoder added 18.4 to 52.2 us a frame on the 3090 (job
  m3-max-71784, the same draws direct, two builds alternated), so no form adds one.

The figures job 64194 stamped (timestamps around each piece) are replaced by the unstamped ones of
job m3-max-71730. Docs only; the docs check (workspace Rustdoc -D warnings and the doc tests)
follows.
2026-11-23 11:46:56 -08:00
Anees Iqbal 06c8ebccd6 Player: a tessellation factor scale of 1 plays as nothing, any other is a skipped render command
The player refused setTessellationFactorScale: ("not played on a render
encoder"), so a recording that sets the scale stopped at its first
setter. The runtime's render encoder has no scale setter: Metal reads
the scale only in a patch draw through a post-tessellation pipeline
state that enables it (tessellationFactorScaleEnabled), and the runtime
refuses every such state at its making (RenderPipelineKind::Tessellation),
which the play counts as a skipped render pipeline state.

render::factor_scale reads the setter's scale: Metal's default of 1
plays as nothing, and any other scale is a skipped render command of
kind TessellationFactorScale, counted in the report's headline with its
first frame and call. This is faithful only while the runtime refuses
every scale-enabled state; once it builds the scale, its encoder takes
the setter and the player passes the scale on. The code comment and
docs/REPLAY-STREAM.md say so.

The recording that met it (m3-max-71779, read in place, no card): 185
scale setters, every one at 1, the first in frame 409; 0 of its 1668
render pipeline records enable the scale, so no state there is refused
for it.

Test: a_tessellation_factor_scale_other_than_1_is_a_skipped_render_command
(1 as a float and a double, 2 and 0.5, and a scale that is no float).
Verified on msi: clippy -D warnings over the workspace with all features,
and the validation suite, the new test among them.
2026-11-23 11:18:21 -08:00
Anees Iqbal 1f81d53c30 Player: a compute pipeline record's stage input plays as the kernel's
The player refused every compute pipeline record whose stageInput was not
nil ("a stage input"), so a recording that makes a kernel with a
[[stage_in]] parameter stopped at that state's frame. The runtime takes
the stage input (ComputePipelineDescriptor::stage_input); only the player
lacked it.

translator::stage_input reads the record's stageInput, {layouts,
attributes, indexType, indexBufferIndex}, into the translator's
StageInputDescriptor the way vertex_descriptor reads a vertex descriptor:
layouts and attributes at their indices, a stride of 2^64 - 1 as
MTLBufferLayoutStrideDynamic, Metal's raw step functions, attribute
formats and index type through their enums, and Metal's unset layout for
a buffer an attribute reads that no layout names. Nil stays no stage
input. A raw value the enums lack, or a key the form does not hold, is
the player's refusal. A descriptor the runtime refuses is the runtime's
typed error: a gap or a translation refusal counts as a skipped compute
state in the play's report, any other error ends the play with it.
docs/REPLAY-STREAM.md states the form.

Test: a_compute_pipeline_record_s_stage_input_is_read (the record form,
a dynamic stride, a buffer no layout names, nil, and an unknown key).
Verified on msi: clippy -D warnings over the workspace with all features,
and the validation suite, the new test among them.
2026-11-23 11:03:24 -08:00
Anees Iqbal c553ebbfcb rt: a device with no heap placement of links looks at none, and a command buffer keeps no alias state until it touches one
The instruction bench (job m3-max-71736, lavapipe burst_2000, 2,000 one-dispatch command buffers a
run, A acda405b30 against B 867e059aaf alternated A B B A A B) read own_per_run 50,646,700 against
51,286,684, +1.26%, about 320 instructions a commit: each dispatch walked its slots for placements,
and Building and Segment carried the marks and the part inline. Now the heap ids count the
placements with links (HeapIds::any_linked), and a dispatch, a pass's begin, a draw and a blit
look at their resources' placements only while one has links; Building's marks and a segment's part
are boxed, made at the first touch.
2026-11-23 10:53:22 -08:00
Anees Iqbal 867e059aaf validation: the player counts heap_moves among the runtime's summed metrics
A play's counters carry Metrics::heap_moves, the heap textures' moves from undefined before a
write after an alias's write, so a timed recording shows the path ran on its card.
2026-11-23 10:43:30 -08:00
Anees Iqbal ec6fe47a06 rt: the alias wiring names its object traits where two apply 2026-11-23 10:43:30 -08:00
Anees Iqbal 07be8848ea rt: the resources' heap placements are read through placement(), apart from TextureObject::place 2026-11-23 10:43:30 -08:00
Anees Iqbal 0324368d4d rt: the alias module's placement is Placement, apart from places::Place 2026-11-23 10:43:30 -08:00
Anees Iqbal 9d2eb08985 rt: a draw's heap moves leave its pass's own attachments, which stay in the layout the pass renders them in
An attachment of the pass the draw is in is in the pass's layout, not its home: a move from
undefined to home in the pass's interruption would leave it there. Its write at the pass's begin
already took its move where one was owed.
2026-11-23 10:43:30 -08:00
Anees Iqbal 20ddd2daad rt: a heap texture moves from undefined before its next write after an alias's write
Vulkan's memory aliasing asks that an image over bytes another resource wrote move from
VK_IMAGE_LAYOUT_UNDEFINED before it is used. rt moved a heap texture only once, at its making, so a
device that keeps a compression state beside an image's bytes read the alias's state: on the Iris
Xe (ANV, Mesa 26.2.6) a 512x512 RGBA16Float array written through a 2D view after eight aliased
arrays read 8152 of 262144 texels wrong (job m3-max-71690, the test c26698712c).

The form (crate::alias):
- Each heap texture and heap buffer is a Place, linked at placement with the placements of its heap
  whose bytes meet its, both ways and weakly; a release drops its links. A placement with no links
  pays one test at each use.
- A write of a placement makes its links stale. A stale texture's next write moves its whole image
  from undefined to home, in one barrier from every command's writes to every command's reads and
  writes. Reads move nothing; a buffer is never moved. A declared write counts as a write.
- Inside a command buffer, encode order is run order: Building's marks keep each touched
  placement's state (fresh, stale, untouched) and the segment its commands last read it in. A write
  of a stale one moves in place: before a dispatch, a pass's begin or a blit; inside a rendering,
  through the pass's interruption.
- A write of an untouched one adds a check at its segment's head; where the segment read one of its
  links before, the segment ends first. The submit thread resolves a segment's checks as it stages
  it, in the order the device's one queue runs segments (so a command buffer committed out of its
  encode order, or held by an enqueue, is decided where it runs), recording the moves owed into a
  command buffer of the cb's recorder staged just ahead of the segment's, in its submit info and so
  its vkQueueSubmit2; then it applies the segment's writes. A failed record loses the device as a
  failed submission does.
- A texture placed over another's bytes is stale from its making, and its making move waits for
  every earlier write (ALL_COMMANDS / MEMORY_WRITE in place of NONE).
- Metrics::heap_moves counts the moves, in place and leading.

No upload piece: a heap texture sits on a Private block and Metal gives a heap's textures the
heap's storage mode, so no Metal-valid replaceRegion reaches one (TextureBytesPrivate).

The README's gap line now says what remains: a read of a stale texture, writes rt cannot name, a
declared write taken whole, the making move's effect on a live alias's bytes, the move's whole
image, and a draw's check at the head of its pass's segment.

Tests: src/tests/alias.rs holds the state machine on every device of the cfg (commit order against
encode order, the segment ended before a check behind an alias's read, moves in place, a draw's
write through the pass, apart placements with no check or move); the red test is
heap_alias.rs's array test. Gate and device runs follow in the next commits.
2026-11-23 10:43:30 -08:00
Anees Iqbal a7a86b22b6 rt test: a program's shapes over one heap, 2D arrays of RGBA16Float each written and read through 2D views of their first slice
Eight arrays of 1 to 312 layers (256x256 a4 down to 1x1 a8) and a 512x512 array of one layer,
all ShaderRead|ShaderWrite, Private, at offset 0 of one heap: each written through one 2D view of
its first slice with rows_write and read through another with rows_read, in one command buffer and
with the last array's steps in a second. The shapes are a guest's on the device whose run read the
wrong bytes; the six 2D textures of the first tests pass there at base (job m3-max-71636, Iris Xe,
Mesa 26.2.6).
2026-11-23 10:43:30 -08:00