Commit Graph
7083 Commits
Author SHA1 Message Date
Anees Iqbal 71a22fc2be command-replay: a play that ends with differing IDs exits 3 with an ids line, apart from a stopped run
A run that played every frame but whose objects' gpuResourceID differ from
the recording's exited 1 with an 'error ids' line, the status of a run that
stopped: two clean plays read as crashes. It now ends 'ids: played to the
end; ...' and exits 3; docs/REPLAY-STREAM.md says so.
2026-11-18 09:01:28 -08:00
Anees Iqbal 8cf2084a6a rt tests: two held-group tests read whether a completion came by the completion thread's progress, once the submit thread staged their work
Both tests count what a held group does only on a try where no busy submission completed
before the submit thread decided, and both read that wrongly under load (four loops of the
held tests beside the device suite on an RX 7900 XTX):

- The submit-infos test read the progress when the mix's last commit returned, but a commit
  returns before the submit thread stages it. Staged after a busy one completed, the mix's first
  command buffer went alone with fewer than three in flight: three submit infos, not two
  (job m3-max-46906, 1 failure in about 160 runs). It now waits until every command buffer of
  the mix has left Committed before it reads, as the second-queue test waits for its held ones.
- The second-queue test read the busy ones' status, which turns Completed only after the
  completion thread has raised its progress, and the submit thread counts a queue's submissions
  in flight by that progress. Between the two, a held fill went alone while the test still saw
  every busy one running: four lone submissions, not three (job m3-max-46985, 1 failure in about
  85 runs). It now compares the progress with its value before the busy work, as the
  submit-infos test does.

On a try where the progress has not moved once everything is staged, no staging decision can
have seen a completion. Product unchanged.
2026-11-18 09:00:18 -08:00
Anees Iqbal 5a13db2af3 rt README: the copy form's cost as built, a copy of a cleared target costing more
The known gap gave the old runtime's times against the copy form's proxy rows, whose passes all
load their target. The built form was timed on the UHD 630 (harness, release, four rounds, GPU
p50 a pass, old and new runtimes in one exclusive job, m3-max-46957, on the probe rows over
a20271ce5b): at 3648 x 2038 it is faster than the old runtime after a barrier (4,652.6 against
5,438.8 us) and at the first read of a pass that loads its target (3,750.9 against 4,247.8 us),
and slower at the first read of a pass that clears it (4,635.1 against 4,195.7 us; 1,118.8
against 1,099.2 us at 1920 x 1080). Against the same pass reading another texture (2,341.0 and
668.5 us), a copy of a target its pass cleared costs about 81 and 57 us a MiB, above the 53.5
and 39.0 us of a loaded one. The README says so, and that the r3 and b3 frame figures assume no
copied target was cleared by its pass.
2026-11-18 08:57:14 -08:00
Anees Iqbal 710f44f74d rt: the shadow image is bound as a texture's image is
Image::shadow's doc said device-local memory; the shadow is made and bound like any texture's
image: a texture block, else memory of its own where it spills. Doc only.
2026-11-18 08:57:13 -08:00
Anees Iqbal dcc1b7affe rt tests: the copy form's held-strip read and its draw's eighth barrier
The covering-area host test expected a read over nine held strips to copy all of it. The ninth
strip, at the read's end, is still held after the first went past eight, so the plan copies the
read less that strip, one area: [0, 64] by [0, 8].

The attachment-read device test expected seven barriers on the copy form. The new shadow is homed
by the next submission's upload, whose end barrier counts too: eight.

Verified: the UHD 630 leg of a20271ce5b (job m3-max-46933) failed exactly these two assertions,
62 of 64 passing, with attachment_read_copies 2 printed.
2026-11-18 08:57:13 -08:00
Anees Iqbal 9f2ca244ff rt: attachment reads through a copy into a shadow, on a device without the feedback loop
A device whose descriptor limits hold set 1's second elements but that does not report
attachmentFeedbackLoopLayout and attachmentFeedbackLoopDynamicState (the UHD 630 on Windows, driver
101.2145) refused every draw that reads an attachment of its own pass through a texture. It now
reads through a copy: the one form left on that device, recorded as a known gap.

The query: floor::Capabilities::attachment_reads is the descriptor room alone, and the new
feedback_loop is the room plus both extensions and features; device creation enables the
extensions, features and dynamic-state loader only where feedback_loop holds, so the extension
device test's expected list (core().feedback) follows the query unchanged.

The form (crate::shadow): an image a draw may read so gets one shadow, same format, extent, levels
and layers, made at its first reading draw, homed by the next submission's upload, freed with the
image (Free::Shadow) and counted in Gauges::shadows and shadow_bytes. A texture reaching the
rendered level and layer reads its own view of the shadow at its second element (index + 65,536),
written under the owner rule (Arrays::place_shadow); one reaching neither reads the image at home.
The points are the feedback form's: the pass's first reading draw, and a reading draw after a
memory barrier after draws (which leaves every shadow holding nothing). At any reading draw the
planner copies what the shadow does not hold, as one area per read where what is new is one, with
no look-ahead: an own-pixel slot reads the scissor a pixel wider each way, clamped; any other every
level and layer its texture reaches. The copy ends the rendering, records one barrier (a global
memory barrier, the image's copied ranges to transfer source from the attachment layout or home,
the shadow's to transfer destination), the copies and one barrier back, and begins again. Each
copy counts in Metrics::attachment_read_copies and attachment_read_copy_bytes, and in
bytes_copied.

Docs: the rt README (set 1's second elements, the render encoder's copy form, the floor's
attachment reads and extension table, the chosen-by-a-query note, and the known gap with the UHD
cost: 39.0 to 53.5 us a MiB plus 3 to 8 us a copy, about 12 to 16.5 ms a frame for r3 and 4 to 5.5
ms for b3, from the census's 298.0 and 93.4 MiB a frame), DrawKind::AttachmentRead, REFUSALS.md
regenerated and the public signatures blessed.

Tests: host unit tests of the planning (tests::shadow) and of the floor's two answers; the device
test of attachment reads now runs the copy form where the device has it, asserting its barriers
(7), copies (2) and bytes, the live shadow, and the texels, and printing the counters; the level
test runs it too, one copy a level. Checks are run on the potluck legs after this commit.
2026-11-18 08:57:13 -08:00
Anees Iqbal 2e855c4814 rt tests: each sampling test reports its gauges under a label of its own
Five on-device tests in tests/sampling.rs passed the same label, "sampling", to each_device, so every device leg printed M2V-MATRIX gauge sampling/<kind>@drop five times, and the matrix (scripts/matrix/results.py) failed every leg with "recorded twice" (matrix 3309532960: 9 of 10 legs). Each test now has its own label. Test-only; no label is now shared by two tests (checked over tests/ by grep).
2026-11-18 08:56:12 -08:00
Anees Iqbal 1cf0507911 Authored compile census: the product fingerprint at SEMANTICS 2176, no cell moved
Blessed on the M3 at 98efd4de50 (potluck m3-max-46972, census-exit=0). Only the artifacts_at product fingerprint changed; every case's compile cell is unchanged. The golden hashes at the same sha (m3-max-46971) are green with no row added or removed.
2026-11-18 08:54:03 -08:00
Anees Iqbal 98efd4de50 rt tests: the busy rounds go up to 4,096 fills
behind_busy and the two tests with their own rounds commit busy command buffers of more fills
each round until the work outlasts the check. With each busy one now committed after the one
before it is submitted (3309532960), the first runs longer before the check, and under load the
last round, 1,024 fills of 16 MiB (16 GiB, about 17 ms on the RX 7900 XTX), was outlived by the
host once in about 530 runs of the three held-group tests beside two loops of the device suite
(m3-max-46831: every_device_sends_the_held_group_a_command_buffer_without_a_submission_retires_behind,
'the busy work ended before every check'; no wait timed out). One round more, of 4,096 fills, runs
only where the 1,024 one ended first.

Verified: the compile job and the XTX load run, named in the hand-off.
2026-11-18 08:31:33 -08:00
Anees Iqbal 79ae83e8db rt: a pass that opens its command buffer records no first barrier, and one that moves nothing owes its second
A render pass recorded a barrier before it and one after it, so a command buffer of one pass took
three (the 2,000-draw harness row's stream on the RTX 2080: a pre-pass ALL to ALL barrier, the
rendering, a post-pass barrier, the end timestamp and the segment's end barrier).

The first orders the pass after every earlier command. Where the pass opens its command buffer (the
command buffer's first command, or the first after an event's signal or wait) and no attachment
moves to another layout, every earlier command is in a command buffer that ended with a barrier
reaching every later command on the queue (record::end), as a copy-in already relies on
(crate::capture). The pass then records none: Building::opens_command_buffer decides it, after the
copies a pass may record before itself, so a pass behind those keeps its barrier.

The second orders the pass before later commands. Where no attachment moves home it is owed
instead (Building::owe_pass): the segment's next command records it first, and a barrier owed
after a pass is recorded as Reach::Commands whatever reach the paying command names
(Building::barrier), so a dispatch after a pass, whose own barriers reach only compute, is still
ordered after the pass's attachment and shader writes. A blit or a pass after it records its own
first barrier, which pays it; where nothing follows, the segment's end barrier is it. A pass that
moves an attachment (a shader-read texture's, home shader-read-only) or moved one to the feedback
layout records both barriers as before.

A command buffer of one pass whose attachments render at home is one barrier, its end's; two such
passes are two; a pass then a dispatch is two. The rt README and the module docs state the rule;
the draw tests' counts move from 3 to 1; pass.rs's test adds the cases at home, the second pass
loading what the first cleared.

Verified: clippy under --cfg m2v_gpu and all 228 rt tests on lavapipe (jobs named in the hand-off);
the GPU legs and timing follow.
2026-11-18 08:29:49 -08:00
Anees Iqbal 3309532960 rt tests: each busy command buffer a held-group test runs behind is a submission of its own
The held-group tests commit IN_FLIGHT busy command buffers back to back and take the queue to
hold its next commit. Under load the submit thread can wake once for two of those commits and
send them as one group. The queue then has one submission fewer in flight than the test counts.
The next commit goes at once and nothing is held behind the busy ones.

On the RX 7900 XTX under the parallel suite (m3-max-46710, 4 of about 100 runs),
every_device_sends_the_held_group_a_command_buffer_without_a_submission_retires_behind read
`before + 3` submissions when its fill left Committed. At the 60 s timeout all five of its
command buffers were Completed and the count had not moved: four command buffers with GPU work in
three submissions. The empty command buffer behind them retired behind the work in flight with
no submission, as rt does when no group is held, so the wait for a new submission could never
end. rt was right; the test's precondition was not.

busy_alone commits a busy command buffer and returns once the submission counter has passed its
value before the commit. The next one is committed after that submission and cannot join its
group. behind_busy uses it, which covers three tests whose checks rest on IN_FLIGHT separate
submissions:
- every_device_sends_the_held_group_a_command_buffer_without_a_submission_retires_behind (the
  timeout above);
- every_device_sends_a_held_group_when_a_submission_completes (asserts AHEAD + 1 submissions);
- every_device_sends_a_held_group_at_the_wait_hint (counts AHEAD before the hint).
every_device_keeps_three_submissions_in_flight_and_holds_the_fourth (waits for exactly before + 3)
and every_device_counts_what_a_second_queue_adds (counts AHEAD lone submissions) commit their busy
ones through it too. Every other behind_busy test gets the same exact precondition.

Verified: the compile job (m2v_gpu clippy and the tests on lavapipe) and an XTX run under load,
named in the hand-off.
2026-11-18 07:57:53 -08:00
Anees Iqbal d392d453d6 translator tests: the old render key's pin at SEMANTICS_VERSION 2176
The old runtime's render descriptor key hashes SEMANTICS_VERSION: at 2176 over the tip's tree it is
eeff4686..., from eda47054... at 2175; only the version it hashes changed. m3-max-46715 (f24b447f65,
um870) gave the key, and with it written in, the_old_render_descriptor_key_keeps_its_value and
golden_hashes_match_the_table passed (2/2).
2026-11-18 07:47:24 -08:00
Anees Iqbal f24b447f65 translator: SEMANTICS_VERSION 2176, above the meter's 2175; api_signatures blessed for the tip
The identity set 1's storage array of 65,536 is a binding-plan fact rt's pipelines key on, so the
version moves past development's 2175 (identity's meter). The bless writes the table the tip's
sources derive: this branch's removals (IndexClass::StorageTexture, Refusal::IndexInUse) and the
items development's table lacked (floor::ATTACHMENT_READ_EXTENSIONS, the OPTIONAL_EXTENSIONS value,
Capabilities.attachment_reads, Features.divisor, feedback_loop and feedback_loop_dynamic,
DrawKind::DividedBaseInstance). This supersedes the 2174 and the old render key bf8e7821... of
the branch's earlier commits; the key the combined tree gives is pinned next.
2026-11-18 07:44:31 -08:00
Anees Iqbal 1763e871be rt tests: the owner test's write through the index expects sample_down's texels into a texture of the source's side
sample_down samples at the target's texel centers scaled to the source: into a texture of the
source's side (B) it writes each source texel of the first half of each side, not the mean of
four. m3-max-46660 (3090, c10808af0d) showed the write reaching B with exactly those texels.
2026-11-18 07:43:28 -08:00
Anees Iqbal 5c23deb974 rt tests: the owner test's B holds texels of its own, so a read through the index tells it from D and the source 2026-11-18 07:43:28 -08:00
Anees Iqbal bdefcb5c70 rt tests: the owner test's slot counts, and the extensions test's attachment-read extensions
The owner test counted three held indices before D where it holds four (the source, the target,
the sampler state and the index): every leg of 1177568059 failed it at its first count (left 4,
right 3; m3-max-46592 RX 550, 46593 780M HawkPoint, 46594 RTX 2080, 46596 Iris Xe).

every_device_of_the_cfgs_kind_enables_the_consumers_extensions_it_offers expected no
attachment-read extension, which device creation enables since 1524689478 where the device takes
the attachment reads; the same four legs failed it (VK_EXT_attachment_feedback_loop_layout and
VK_EXT_attachment_feedback_loop_dynamic_state enabled, not expected). It now expects
floor::ATTACHMENT_READ_EXTENSIONS after the optional ones where the device took them.
2026-11-18 07:43:28 -08:00
Anees Iqbal 739d183fb3 api_signatures: the attachment reads' floor items, which the table lacked on development
1524689478 added floor::ATTACHMENT_READ_EXTENSIONS, Capabilities::attachment_reads and
Features::feedback_loop{,_dynamic} to rt's public surface without the table's rows; the bless adds
them. No consumer break: the items are new.
2026-11-18 07:43:28 -08:00
Anees Iqbal ab3eb55cc6 rt: the old render key's pin at SEMANTICS_VERSION 2174; a test closure's borrow and a doc link
The old runtime's render descriptor key hashes SEMANTICS_VERSION, so the bump to 2174 moves it
(bf8e7821..., from 98be3009...; only the version it hashes changed). The owner-rule test's pass
closure names its argument's type, so each call borrows its textures alone; the compute pipeline
doc links Device::new_texture by its path.

Verified: m3-max-46522 (fdeb5c21fc) named the three: the key's new value, E0505 at the two drops,
the unresolved link.
2026-11-18 07:43:27 -08:00
Anees Iqbal fe23decd1b rt: a constexpr sampler's index under the owner rule, and an object released with work pending
A constexpr sampler's numbering is a placement like any other. Where a sampler state took the
index from it, a later pipeline state that numbers the constexpr sampler there took nothing back:
it sampled through the program's sampler. Now it places the constexpr sampler there again with
every element it holds (Arrays::hold_samplers: under the grants' lock, the owner's additions where
it still owns the index, else a placement), and the constexpr sampler keeps its elements' samplers
to write them. The consumer chooses constexpr indices and keeps them from the program's sampler
states while a state numbering one lives; rt does not check it (rt README, compute pipeline
docs).

An object the program released while a command buffer that used it is pending is displaced like
a live one: a placement at its index takes it at once, and its teardown once the command buffer
retires touches nothing it no longer owns (one owner compare for both). Nothing empties an
element at the program's release: a committed command buffer still reads the object through its
index, which Metal allows. The owner's teardown nulls it. RESOURCE-ID.md states the duty (no work
in flight reads a displaced or released object through its ID) and what an element no object owns
holds: every element is written at device creation, a null descriptor (nullDescriptor, on the
floor) or the array's default sampler, and written back to that when its owner goes.

The replay player gave constexpr samplers the lowest free sampler index, the range the stream's
named sampler IDs come from, so a program's sampler state could take a constexpr sampler's index.
It now gives them the highest free one, outside that sequence (Indices::highest; REPLAY-STREAM.md).

Tests:
- sampling::every_device_gives_a_constexpr_sampler_s_index_to_the_object_placed_there_last: a
  nearest sampler state over sample_up's linear constexpr sampler reads nearest; a later state
  numbering it takes the index back (linear, for both states); the sampler state's going touches
  nothing; the slot gauge counts the index once.
- sampling::every_device_gives_a_released_object_s_index_to_the_next_at_once: a command buffer
  samples A through SA, signals and waits on the host; A and SA are released and B and SB made at
  their indices while it is pending (asserted); another queue reads B through SB; after the first
  command buffer retires, and A and SA with it, the index still reads B through SB. The writes are
  valid under UPDATE_UNUSED_WHILE_PENDING with PARTIALLY_BOUND (vkspec: "as long as they are not
  dynamically used by any shader invocations"): A's dispatch completed before its signal.
- replay a_constexpr_sampler_takes_no_index_of_the_sequence.
2026-11-18 07:43:13 -08:00
Anees Iqbal fd916e7f99 rt: an index has one owner, the texture or sampler placed there last
The consumer's program places a texture at an index a live texture of its own still holds, and
releases the older one later (179 placements in one recorded stream, 92 in another). Metal takes
it: the later texture takes the ID. rt refused it (IndexInUse).

Now Grants keeps one owner word per held index (a HashMap per class, the word given at placement
and never again on the device; no list of holders, no refcount, no second bitset). A placement at
a granted index always succeeds and makes the placed object the owner; a release vacates the index
and empties its elements only where the releaser still owns it, so a displaced object's going
touches nothing. Placement and element writes happen under the grants lock in one step
(Arrays::place_texture, place_samplers, add_samplers, vacate_texture, vacate_samplers), so the
elements always belong to the owner. Where a placement displaces another object, a texture with
no storage view writes its storage element null and a sampler writes the arrays it does not use
back to their defaults, so nothing stale answers. The descriptor-slot gauge counts held indices:
a displacing placement adds none.

The same occupancy serves textures, sampler states and constexpr samplers. Constexpr samplers are
kept by (index, state words), each with its owner word; a later pipeline state of the same words
adds its arrays where the constexpr sampler still owns the index. Refusal::IndexInUse is deleted:
nothing Metal refuses remains. A texture now takes its index after its image and views are made,
so an index not granted is refused after the image is made and freed at once.

The duty: no work in flight reads a displaced object through its ID, as Metal's. rt does not
check it. RESOURCE-ID.md and the rt README state the rule and the duty.

The harness takes the next index round each class's range (its workloads make far fewer objects
than a range holds). The replay player keeps the object placed last per index: a named index an
object holds is taken, and the earlier object's release leaves it; with no index free for a
constexpr sampler it answers IndicesNotGranted past the range.

Tests: grants' an_index_has_one_owner_the_object_placed_there_last (both classes);
sampling::every_device_gives_an_index_to_the_texture_placed_there_last (a storage-capable D at 3,
a sampled-only A over it, whose placement empties D's storage element: a write through 3 is
dropped and D keeps its texels; B storage-capable over A, A dropped; sampling through 3 reads B,
writing through 3 writes B; B dropped, sampling through D's ID reads zero; the slot gauge counts
3 once); the sampler states' test places a state over a live one; replay's indices test.
REFUSALS.md regenerated, api_signatures loses IndexInUse.
2026-11-18 07:43:13 -08:00
Anees Iqbal cc9ab54b86 rt: one texture index class, 1 to 65,535, and a storage array as long as the sampled
The consumer hands each guest process texture IDs from one pool (1 to 16,320) and places every
texture at its own ID whatever its usage. rt split textures into two index classes by usage
(StorageTexture 1..4095 with shader-write usage, Texture 4096..65535 without), so every named
sampled-only texture below 4,096 and every storage-capable one above it was refused
(IndicesNotGranted), where Metal takes them: 4,818 makings in one recorded stream and 5,707 in
another.

Now there is one texture class, IndexClass::Texture, 1 to 65,535, with one grant bitset and one
occupancy; IndexClass::StorageTexture is deleted. Set 1's storage-image array (binding 1) is as
long as the sampled-image array, 65,536 (floor::TEXTURES replaces SAMPLED_IMAGES and
STORAGE_IMAGES). A texture with a storage view writes both elements at its index; any other writes
its sampled element alone and its storage element stays null; a texture that goes writes both
null. Samplers keep their class.

Why every floor device holds it: Vulkan's Required Limits (vkspec 56.1, Table 75 and Table 76)
give maxPerStageDescriptorUpdateAfterBindStorageImages, maxDescriptorSetUpdateAfterBindStorageImages,
the two SampledImages limits, maxPerStageUpdateAfterBindResources and
maxUpdateAfterBindDescriptorsInAllPools a minimum of 500,000 on a device that supports
descriptorIndexing. The floor's own sums become 2 * 65,536 + maxColorAttachments (131,080 at 8)
and 2 * 65,536 + 3 * 4,000 = 143,072, both below 500,000. Every lab capture (2080, 3090, XTX,
780M x2, HawkPoint, RX 550, Iris Xe, UHD 630, lavapipe) reports descriptorIndexing and 1,015,808
or more for each of the six limits. The floor's limit check stays the one gate: no query-chosen
size, no second form.

Translator: link.rs's identity set 1 sizes binding 1 by IDENTITY_TEXTURES (65,536), the same
constant as binding 0, so rt's of_the_device check still matches it. Nothing else in the pipeline
interface, binding plan or resource-ID decode assumes a storage index below 4,096: the identity
handle is the low word (masked only of bit 31 where the alpha flag rides it), indexing each
array's runtime-array variable. The identity domains are reached only from Device::from_queries'
profile (rt sets PointerDomain::Identity; the old runtime never does), so Device::new's modules,
refusals and notes do not change. SEMANTICS_VERSION 2173: the identity set 1 layout is a
binding-plan fact that changed under unchanged keys.

Consumers in the tree: the harness and the replay player grant and place every texture in the
one class; the player reserves a texture ID in it.

Docs: RESOURCE-ID.md's class table (nil, texture, sampler), the rt README (set 1, grants,
textures, the fault paragraph, the floor's limits table), IndicesNotGranted's doc (an object at an
index not granted, as well as a release) and IndexRange's basis; REFUSALS.md regenerated;
api_signatures loses the variant.

Tests: sampling::every_device_makes_a_texture_of_any_usage_at_any_index grants the whole texture
range, makes a shader-read texture at 2 and a shader-write one at 5,000, and checks one
sample_down dispatch against the CPU mean. arrays' fill-past-capacity fills every texture index
(a storage texture at 1, views of it at 2..65,535, 128 made again).
2026-11-18 07:43:12 -08:00
Anees Iqbal da02260f2b 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-18 07:41:26 -08:00
Anees Iqbal f332a4c4a0 WIP meter: the old render key's pin under SEMANTICS 2175 2026-11-18 07:39:02 -08:00
Anees Iqbal 9ebdd62923 WIP meter: SEMANTICS_VERSION 2175, the indices lane taking 2174 2026-11-18 07:39:02 -08:00
Anees Iqbal ffb30ab2b1 WIP meter: SEMANTICS_VERSION 2174 on top of the old key fix 2026-11-18 07:39:02 -08:00
Anees Iqbal 3b80feff38 WIP meter: the specialize and select weights inside the stage functions, for every caller 2026-11-18 07:39:02 -08:00
Anees Iqbal 8d97464d56 WIP meter land tree (check) 2026-11-18 07:39:02 -08:00
Anees Iqbal 0c6d48aa7b replay: the player zeroes each block and heap of the stream once at its making
The live system zeroes a heap's memory once when it is made, so a buffer
placed there reads zero where nothing wrote it. The runtime's take_block
leaves a block's bytes undefined, and a block it takes again holds a
released block's bytes: placed buffers read them where the program read
zeros, a resource ID among them. zero_block zeroes [from, len) of a new
block through buffers zeroed from their start; from is the extent the
runtime zeroed itself, none yet. The device test writes a placed buffer,
releases it and its block, and reads zeros from a buffer placed in a block
of the same length; the bytes zeroed show both blocks went through it.
2026-11-18 07:33:33 -08:00
Anees Iqbal bc3cf8961d rt docs: the deep-row link in choose's doc names the pipeline's Constant::Deep
cargo doc --document-private-items failed on dev (job m3-max-46581, at 1524689478): the link
resolved to nothing in encoder.rs.
2026-11-18 07:32:05 -08:00
Anees Iqbal 8653b625bb rt: a draw or a dispatch whose push bytes the command buffer holds pushes nothing
The new runtime pushed its draw's 16 bytes before every vkCmdDraw of draw_2000: 2,000
vkCmdPushConstants of the same bytes (VK_SHADER_STAGE_ALL, offset 0), where the old runtime binds
once (api_dump of both runtimes on the RTX 2080, job m3-max-46567). The 16 bytes are the vertex
function's two buffer slots' addresses (positions and colours), which change only with a
set_vertex_buffer. wide_bindings' dispatches each pushed their 224 bytes the same way.

Every pipeline has the device's one layout and push range, so a push stays across pipeline binds
and both bind points: the command buffer's recording keeps the bytes its pushes left (Pushed,
reset with each segment's new command buffer), and a draw or dispatch whose push bytes are
already held records none. A filter on the bytes is less code than pushing at each bind: a
pipeline change moves every field (each pair's fields are dense by link), so a bind-time push
would still need the pipeline's own layout of fields at each change.

Counters::metrics gains pushes and pushes_held. The push-window device test asserts the 24-buffer
kernel's three dispatches of the same bindings push once, and the 30-buffer kernel's push each
(its parameter block's address changes); a unit test checks the record.
2026-11-18 07:30:26 -08:00
Anees Iqbal e7943e2272 rt README: the feedback-move gap against the old runtime's same passes on the two RADV cards
The planner closed the RX 550's attachment read as a known gap: a guest pays the pass, and a pass
that reads its target takes no longer under this runtime than under the old one, on the RX 550
and the RX 7900 XTX, at 3648 x 2038 and 1920 x 1080. The gap now gives both runtimes' passes,
reading the target and reading another texture, with the difference. The old runtime's increment
over its plain pass is the smaller on the RX 550 (417.3 against 606.4 us at 3648 x 2038) because
its plain pass there takes 1,135.7 us against 516.5.

Measured in the same exclusive runs, four rounds each, the median over rounds of each round's
median: jobs m3-max-46562 (RX 550, RADV, Mesa 26.2.6) and 46563 (RX 7900 XTX). This runtime's arm
is harness 14f80dd773 (rt at development's 1524689478); the old runtime's is the probe harness
cac97bbab3 --runtime old (the frozen old runtime of c459695b88), whose reading draw binds the
target as a fragment texture after a render-target barrier, fragment to fragment. Both probes
never land. The old runtime's CPU per draw in the reading row at 3648 x 2038 on the RX 550 was
327k ns against this runtime's 106k ns.
2026-11-18 07:28:35 -08:00
Anees Iqbal c763978c6f rt: free each idle allocation at a fixed idle age of 250 ms, whatever the queues do
The pool's idle rule was a 3 s window of peak bytes in use gated on 20 ms with
no commit or submission, so a program that kept committing (every frame) kept
its idle allocations; replays showed GiBs idle under steady frames. It is now
one rule on the existing block-maker thread: an allocation's idle time starts
when its last live block comes back, nothing resets it but a take that lands in
it again, and at 250 ms (one constant, every device, no query) the thread frees
it, one at a time, between the allocations it makes, after the hook of each
block kept in it. Commit activity plays no part. Each class's reserve made
ahead of need (the idle allocations its free bytes need to stay at 8 MiB or
more: one 16 MiB allocation at most) is not weighed or freed, as before.

The clock is `memory::idle_due(since, now)`, kept so a later trim of an idle
recorder's command pool can hang off the same clock (idle since its last use,
trimmed past the age).

Removed: Peaks, surplus, WINDOW_SECS, the quiet gate (Pool::worked, freed,
quiet_in, QUIET_NANOS in the pool; the cache keeps its own 20 ms constant) and
the test clock skew. Added: Metrics::idle_frees_by_age (idle time at each
free's start, 6 buckets) and Metrics::idle_reuses_by_age (idle time of each
idle allocation taken again, 7 buckets); Gauges::shared_idle_age_nanos and
private_idle_age_nanos (the oldest weighed idle allocation's age). The replay
player reports all of them. README, Device::release_block's doc and the counter
docs state the rule; api_signatures rows added.

Tests: the window unit test becomes the idle clock's; the idle-age test (four
16 MiB Shared allocations freed at 250 ms, oldest first, within 50 ms of due
and the frees ahead; one taken again at 50 ms counted as a reuse and freed
250 ms after its second give-back; the reserve kept past the age, its age
gauge 0); the steady-commit test (a commit every 2 ms for 3 s: blocks given
back at 0.5 s and 1.5 s are freed at their idle age during the commits and the
Shared idle bytes return to the made-ahead 16 MiB; a submission during a held
free counted, one after it not); the teardown test's long block now freed at
its idle age; the places test expects the released block's allocation freed.

Verification: the check job (clippy in four configurations, rt and harness suites,
API tables, rustdoc) and the device legs run on this commit.
2026-11-18 07:27:07 -08:00
Anees Iqbal 8a72cfb472 rt: Refusal::ArgumentPlace names the one way Metal meets it
The refusal's doc and the rt README's known gaps of memory blocks now state the
exact condition: Metal's offset rules keep indirect arguments at a multiple of 4
and indices at a multiple of their size from the buffer's start, so only a buffer
that starts off that multiple meets the refusal, a no-copy buffer over a pointer
not aligned to 4 (indirect arguments) or to the index size (indexed draws),
which documented Metal does not allow (the pointer is page-aligned). The
consumer places every other buffer aligned. The buffer is still made; only the
dispatch or draw is refused, as landed, with no copy.

No behaviour change. docs/REFUSALS.md regenerated: unchanged (its row takes the
doc's first sentence, which did not change).
2026-11-18 07:26:20 -08:00
Anees Iqbal f0df30b6ba AGENTS.md: rule 2 lists unified memory and the attachment feedback loop as query-chosen forms
Owner rule 2 named five features whose query may choose a second form. The owner allowed two
more on 2026-11-18, relayed verbatim by the planner from the Telegram bot:

- "I allow it", answering whether unified memory, decided by the Vulkan device type, may be a
  query-decided form. That is the one-or-two-copies choice for Managed buffers that
  Device::has_unified_memory answers. It is decided by the physical device type alone, never by
  a vendor or device ID. The earlier sixth form (explicit pitch) stays dropped.
- "Wait never mind, copying is fine if the gpu/driver genuinely doesn't support it", reversing
  the typed refusal for attachment reads on a driver without the feedback-loop features. On
  such a device a draw that reads its own render target goes through a counted copy of the
  target, as the last form there, reported as a known gap. The Copies rule is unchanged: this
  is not leave for a copy on any device that has the feature.

The rt test that enforces rule 2 (tests::one_path) forbids identity names, environment reads
and policy types. It does not list the allowed queries, so it does not change.
2026-11-18 07:23:04 -08:00
Anees Iqbal e549310f7d rt README: the move into the feedback layout after a move home, a clear and a draw, on RADV
The feedback-move gap's table times a pass that clears its target. The move in on RADV costs
differently with what the image's last rendering left: at 3648 x 2038 it takes 203.3 us on the
RX 550 and 5.2 us on the RX 7900 XTX where the pass loads an image the last pass moved home from
the feedback layout with no draw between, 370.6 and 19.6 us after the pass's clear, and 477.3 and
22.7 us after a draw over the image in the same pass. So the RX 550 still pays 203 us where
nothing was rendered since the last move home.

Measured with the probe harness cac97bbab3, which never lands (rows mv_cons_big and
mv_after_big, timestamps around the move's barrier), on development's rt of 1524689478: jobs
m3-max-46562 (RX 550, RADV, Mesa 26.2.6) and 46563 (RX 7900 XTX), exclusive, four rounds each.
The spans were identical to the nanosecond across rounds on the RX 550.
2026-11-18 07:21:23 -08:00
Anees Iqbal c13864b420 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-18 07:21:12 -08:00
Anees Iqbal e42a3cf079 rt: the step rates through VK_EXT_vertex_attribute_divisor on a device that lists only it
The UHD 630 (Windows) lists VK_EXT_vertex_attribute_divisor and not the KHR, and reports
vertexAttributeInstanceRateDivisor (vulkaninfo, job m3-max-45649), so the floor enabled no divisor
there and its leg (m3-max-46513 at 65ad678984) refused a step rate of 2 at creation, where the
device lacks only a nonzero first instance. The KHR was promoted from the EXT with the same feature
and pipeline structures (VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT and
_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT alias the core values), so it is the same one
form: OPTIONAL_EXTENSIONS takes the EXT too, the feature structure is read and chained where either
is listed, and the translator is told ExtVertexAttributeDivisor, whose profile reads
supportsNonZeroFirstInstance as false (the EXT has no such property). A draw from base instance 0
then runs there, and one from another base instance is refused (DividedBaseInstance), as on
lavapipe.

the_step_rate_feature_is_enabled_where_reported gains the EXT-only device; the README's extension
table gains the EXT row, which the_readme_states_the_floor holds.
2026-11-18 07:20:24 -08:00
Anees Iqbal b527ae9f68 rt, translator: a step above 1 on a device without supportsNonZeroFirstInstance runs from base instance 0
Vulkan's divisor needs firstInstance 0 where the device does not report supportsNonZeroFirstInstance
(VUID-vkCmdDraw-pNext-09461): lavapipe and the UHD 630 among the lab's devices. The translator
refused the step there under the identity domains, as a Metal draw may carry a base instance, so
those devices lost every draw through such a state, base instance 0 included. The WebGL divisor
stream draws 462 times through its two stepped states, every draw at base instance 0 (it calls no
baseInstance form and draws nothing indirectly).

Now, under the identity domains, fetch_as takes the divisor wherever the profile has
vertexAttributeInstanceRateDivisor and the rate is within maxVertexAttribDivisor; outside them the
step is pulled where the property is missing, as before, so the old runtime's path is unchanged.
divided() names the feature or the limit; its not-implemented arm had no caller left and is gone.
The new runtime marks such a state where the device lacks the property
(Draws::first_instance_zero) and refuses a draw through it at a base instance other than 0,
Gap::Draw { DividedBaseInstance }, before anything is recorded; a draw of no vertices or instances
still records nothing. Indirect draws are not built in the new runtime.

Tests: from_queries_divides_an_instance_step_where_the_divisor_feature_is_enabled (lavapipe and
moltenvk-m3 profiles, with and without the property: an instance-rate binding of divisor 2, both
modules L3-valid; rate 5 past a limit of 4 refused naming it). The device test
every_device_with_the_step_rates_fetches_per_instance_at_rate_2_from_the_base_instance draws from
base instance 0 on every device with the step rates (every texel the first mark) and from base
instance 1 where the property is reported (the second mark), expecting DividedBaseInstance where it
is not, and prints which path ran.

docs/REFUSALS.md regenerated (scripts/refusal-surface/refusal_surface.py): VertexStepRate has one
site. The rt README names the draw refusal on those devices; docs/API.md the identity-domain rule.
2026-11-18 07:20:24 -08:00
Anees Iqbal 6f8d3ebc14 conformance: record and time vertex-step-rate-instances on the M3 Max
Record mode (job m3-max-46378 at 37f73671dd, an Apple M3 Max, macOS 27.0.1 26A434) took the case's
Metal answer: plain Metal ran the pass with no error. Every instance fetched element
base + (iid - base) / rate, its count starting at the draw's base instance:
- rate 2 from base instance 0: elements 0, 0, 1, 1 (words 0x10, 0x10, 0x11, 0x11);
- rate 2 from base instance 5: 5, 5, 6, 6 (a count from instance 0 would read 2, 3, 3, 4);
- rate 3 from base instance 0: 0, 0, 0, 1;
- rate 3 from base instance 5: 5, 5, 5, 6 (from instance 0: 1, 2, 2, 2).
That is Vulkan's divisor, firstInstance + (instanceIndex - firstInstance) / divisor.
conformance times --runs 8 --write (same job) wrote both legs' figures: within the 10x margin, the
margin reported unjudged (the instrument's floor read 17.77 instrument costs on Metal's leg). The same
job's replay on the M3 Max (the old runtime over MoltenVK) reads exact.

docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py).
2026-11-18 07:20:24 -08:00
Anees Iqbal 6d78c2a54b rt: Metal's per-instance step at a rate above 1 is a binding's divisor, where the device has it
A WebGL stream draws instanced quads at vertexAttribDivisor 2 and 3, so the step joins the runtime
in one form. The floor enables VK_KHR_vertex_attribute_divisor where the device lists it and its
vertexAttributeInstanceRateDivisor where the device reports it (floor::STEP_RATES, a list of its own:
the feature is not one of the five that choose a second form; the zero divisor beside it stays off),
and hands both to the translator. The translator already builds the step as an instance-rate binding
of divisor n where the profile has the feature, n is within maxVertexAttribDivisor and the device
reports supportsNonZeroFirstInstance (a Metal draw may carry a base instance), and refuses it
(VertexStepRate) elsewhere; that refusal is the one answer on a device without them. A render
pipeline chains VkPipelineVertexInputDivisorStateCreateInfoKHR with each binding's divisor other than
1, and nothing where there is none.

The device test every_device_with_the_step_rates_fetches_per_instance_at_rate_2_from_the_base_instance
draws instances 1 and 2 at rate 2 from base instance 1 and expects both to read the second mark, the
element the conformance case vertex-step-rate-instances records from Metal; it expects the refusal
where the translator's profile lacks the feature, the property or the limit, and prints which path
ran. The constant step's test shares its descriptor and draw (marked, two_instances); the signed
attribute test no longer asserts that a step rate of 2 is refused on every device.
the_step_rate_feature_is_enabled_where_reported checks the floor's answer and the translator's
enables, and the README's floor tables gain the extension and a "Step-rate feature" table, which
the_readme_states_the_floor holds equal to the code.
2026-11-18 07:20:24 -08:00
Anees Iqbal 0bb8cf40e1 conformance: vertex-step-rate-instances, Metal's per-instance step at rates 2 and 3 from a base instance
The cases that step a vertex layout per instance do so at rate 1, where an instance fetches its own
element under any count. At a rate above 1 the count's origin shows: Vulkan's divisor fetches element
firstInstance + (instanceIndex - firstInstance) / divisor, counting from the draw's base instance,
and a count from instance 0 would divide the instance index whole. The runtime's divisor (the next
commit) is right only if Metal counts as Vulkan does.

This case draws one index of four instances through the rasterization-disabled fixture
vertex_fetch_reach (it writes (v, vid + iid) at out[(vid + iid) & 3]) with its uint attribute
stepped per instance, stride 4, over a buffer holding 0x10 + w at word w: at rates 2 and 3, each from
base instance 0 (the controls) and from base instance 5, where the two counts name different
elements (rate 2: 5, 5, 6, 6 against 2, 3, 3, 4; rate 3: 5, 5, 5, 6 against 1, 2, 2, 2), all inside
the buffer.

metal_counted_the_step_from_the_base_instance holds Metal's recorded answer to that: every instance
fetched element base + (iid - base) / rate. The cost coverage bill names the case until the next
whole-set cost run.

The recording follows from record mode on the M3 Max.
2026-11-18 07:20:24 -08:00
Anees Iqbal abd8bb69f7 rt: a recorder's pool is reset keeping its memory again, on every device
This reverts 3dff069f08 (the reset with VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT and its
device test). On the UHD Graphics 630's Windows driver the release cost about 170 us per command
buffer: every reset gave the pool's memory back and the next recording allocated it again.

UHD 630, one exclusive job m3-max-46545: harnesses cross-built at each arm, rt rows, in the order
A B C D D C B A, 100 runs each, p50 us, both passes. A = da2f870467, B = 802679449e (the pipeline
cache), C = 3cbf244329 (3dff069f08's parent), D = 3dff069f08:

  row            A                B                C                D
  burst_160      2199 / 1851      1841 / 1848      1852 / 1842      28446 / 28637
  burst_2000     19979 / 22292    19803 / 20087    19788 / 19880    369590 / 368967
  burst_2000x5   33319 / 33470    33665 / 33775    33469 / 33982    401500 / 363078
  frame_5cb      248 / 187        235 / 229        229 / 267        757 / 758
  wide_bindings  774 / 738        774 / 774        773 / 774        1178 / 1177
  draw_2000      146 / 165        157 / 157        156 / 156        246 / 245

The matrix times of frame (C 345 / 353, D 447 / 482), frame_5cb, wide_bindings and draw_2000 rise
with D alone too, so the matrix's smaller UHD rises have the same cause. The pipeline cache (B)
moves nothing. The old runtime's rows ride arm A's runs as the node's own control.

The NVIDIA hold that commit cured (a submission held for a vkFreeMemory of host-visible memory
beside it) showed no guest-visible gain: the paced harness held 15 of 15 frames with the release
in, and the block-maker frees only in a 20 ms quiet gap either way. The paced hold table on the
2080 and the 3090 with this revert is still to run. Returning an idle recorder's memory goes to
vkTrimCommandPool on the idle-age clock, separately.

give_back's doc says why the reset keeps the memory. The test went with the release.
2026-11-18 07:19:23 -08:00
Anees Iqbal ac17439b12 rt README: the feedback layout's moves, with their measured cost a pass on four devices
The known gap of a shader-read render target's moves now says when the attachment reads move it
(to the feedback layout at the pass's first reading draw, home at its end, also between two
reading passes over it) and gives their GPU cost a pass as measured: one cleared draw a pass over
a BGRA8Unorm target at 3648 x 2038 and 1920 x 1080, reading its own pixel of the target against
reading another texture of the same size, and the move in and the move home timed alone by
timestamps around their barriers.

Measured on probe branches that never land, on b93fe01869 (development's 1524689478): totals from
harness 14f80dd773, spans from 4230f49e99 (timestamps around the two barriers), four rounds each
on an idle node, the median over rounds of each round's median. Jobs m3-max-46501 (RX 7900 XTX,
RADV, Mesa 26.2.6), 46502 (RTX 3090, NVIDIA 620.70.06), 46503 (RX 550, RADV) and 46504 (Iris Xe,
ANV). The memory_barrier bullet's long line is reflowed, its words unchanged.
2026-11-18 07:09:55 -08:00
Anees Iqbal 1524689478 rt: a draw reads an attachment of its own pass through a texture, through the attachment feedback loop
Metal lets a draw read, through a texture, a render target its own pass renders; the streams do so in
about 16k (r3) and 13k (b3) passes, always a shader-read colour render target of Private storage, from
the fragment function. The runtime refused every such draw (DrawKind::AttachmentRead).

Where the device lists VK_EXT_attachment_feedback_loop_layout and
VK_EXT_attachment_feedback_loop_dynamic_state, reports both features and its descriptor limits hold
2 x 65,536 sampled textures (floor::ATTACHMENT_READ_EXTENSIONS, ATTACHMENT_READS, feedback_room;
Capabilities::attachment_reads), device creation enables them, and:
- a shader-read, render-target colour image with no storage view and home SHADER_READ_ONLY_OPTIMAL
  takes ATTACHMENT_FEEDBACK_LOOP usage (where the format query allows it with that usage), and each
  texture of it a second element in set 1's sampled array at index + 65,536, written in
  ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT;
- every render pipeline takes ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT as dynamic state; the encoder sets
  it at its first draw and where it changes, so a pass of no reading draw pays one call;
- the pass's first draw that reads such an attachment ends the rendering, moves the whole image to
  the feedback layout in one barrier (the rendered level and layer from the attachment layout, the
  rest from home) and begins again; until the pass ends, draws push the feedback elements of that
  image's textures, and the pass's second barrier moves the whole image home;
- a memory barrier after draws that only rendered, in a pass that moved an image, is owed to the next
  reading draw, which pays it by ending the rendering, one global barrier and beginning again. That
  orders every pixel, the draw's own and any other, as Metal's render-target barrier does.

One form for that barrier: the probe pair 395a2a5225 (a BY_REGION barrier inside the rendering, for
draws whose every read is at their own pixel) and 8ee6a1865a (end, barrier, resume at every owed
barrier), on two 1920x1080 BGRA8 rows with a barrier before every reading draw (fb_small, 200 draws
under 64x64 scissors; fb_full, 32 full-screen draws), 4 rounds alternated, GPU p50 resume against
by-region: XTX -0.0% / +0.1% (m3-max-46321), 3090 +0.2% / -0.1% (46322), RX 550 -0.1% / +0.0%
(46324), Iris +0.1% / -0.0% (46323). CPU per draw: XTX +0.1% / -0.1%, 3090 -16.6% / -0.4%, RX 550
-1.2% / +2.6%; Iris's spread within an arm is about 40% and is re-timed alone. So
VK_KHR_dynamic_rendering_local_read is not part of the condition, and the by-region branch is not
built.

A device without them refuses such a draw as before, and is otherwise the same (the UHD 630 lists
none of the three).

Tests: every_device_reads_its_attachment_through_a_texture_after_a_memory_barrier (own pixel and
another pixel after a barrier, 5 barriers and 1 pass, or the refusal) and
every_device_samples_a_lower_level_while_its_pass_renders_the_next; tests::floor holds the README's
new extension rows and "Attachment-read feature" table. At the wip form of this change (8bc8d14b3c):
check m3-max-46312 green (clippy x3, rustdoc, rt tests, lavapipe tests); legs 46329 (XTX, 2080),
46331 (3090, 780M), 46332 (RX 550, 780M, lavapipe), 46333 (Iris) printed the read path, 46334 (UHD)
passed 37/37.

Known gaps, in the README: a read through an argument buffer's texture of a moved image is not
seen; the image moves to the feedback layout and back in every pass that reads it so.
2026-11-18 06:59:02 -08:00
Anees Iqbal 3d1216b069 validation fixtures: three fragment functions that read a render target through a texture
own_pixel_fragment reads its target at its own pixel (target.read(uint2(in.position.xy))),
first_texel_fragment reads the target's first texel from every pixel (target.read(uint2(0, 0))),
both adding the vertex colour, and first_level_fragment samples a chain's level 0 with a nearest
constexpr sampler at the pixel's position over 4 while its pass renders level 1. The new runtime's
attachment-read device tests draw them (the next commit).

runtime_examples.ll, .air.ll and TOOLCHAIN regenerated with
scripts/regen-air-fixtures/regen-air-fixtures.sh --dir examples runtime_examples (LLVM 21).
2026-11-18 06:59:02 -08:00
Anees Iqbal b56b7c10d0 rt tests: the constexpr-refusal test records its gauges under a label of its own
every_device_refuses_a_constexpr_sampler_past_its_samplers (dd52afe31e) passed each_device the
label "sampling", the same as every_device_samples_through_runtime_and_constexpr_samplers, so
both printed M2V-MATRIX gauge sampling/<kind>@drop and the matrix failed every leg with
"record gauge sampling/...@drop: recorded twice" (matrix 1262e7ae7c). Its label is now
sampling_constexpr_refused; no other each_device label repeats (git grep, sort | uniq -d).

Verified: the label list has no duplicate; the device-cfg compile runs on the next matrix.
2026-11-18 06:51:56 -08:00
Anees Iqbal 7f8e02c40c rt tests: the index-place test expects the place its index buffer takes in the block
every_device_takes_indices_only_at_a_multiple_of_their_size_in_their_block placed its indices
2 bytes past the Buffers block's next multiple of 256, after the vertex buffers (byte 514), and
expected the refusal at place 2. It failed on the 2080, the XTX and lavapipe (jobs m3-max-46415,
46416, 46417 at ee17bd828e). The test now expects the place it made, and its docs say where the
indices lie.
2026-11-18 06:43:09 -08:00
Anees Iqbal cecc252f26 rt: refuse indirect arguments and indices a placement puts off Vulkan's multiple
The consumer places buffers at any byte of a block, so a buffer's place in its block's VkBuffer
plus a Metal-valid offset can miss the multiple Vulkan reads at. Metal's own rules (an indirect
offset a multiple of 4, an index offset a multiple of the index size) assume a buffer that starts
at an aligned address, as every Metal buffer does; here the absolute offset is what Vulkan sees:

- VUID-vkCmdDispatchIndirect-offset-02710: the offset in the VkBuffer is a multiple of 4.
- VUID-vkCmdBindIndexBuffer-offset-08783: the offset plus the base of the memory range backing
  the VkBuffer is a multiple of the index size. A block's VkBuffer is bound at a multiple of the
  pool's granule (64 KiB) or at 0 of its own allocation, so the place in the VkBuffer decides it.

dispatch_threadgroups_with_indirect_buffer and draw_indexed_primitives now check the place in the
block (the device copy's, for a Managed buffer with one, which is what the GPU reads) after
Metal's own checks and refuse with the new Refusal::ArgumentPlace { place, alignment }, basis
ours. Nothing is copied to an aligned place: a copy is not a design answer here.

Tests (device cfg): every_device_reads_indirect_arguments_only_at_a_multiple_of_4_of_their_block
places a buffer 2 bytes into a Shared block and shows offsets 0 and 16 refused at places 2 and 18,
then dispatches from a buffer placed at byte 4100 and checks the result;
every_device_takes_indices_only_at_a_multiple_of_their_size_in_their_block places indices 2
bytes into a block and shows 32-bit indices at offset 0 refused (place 2, alignment 4) before
anything is recorded, then draws 16-bit indices from there and checks the texels and the pass's
counts. README's placement contract names the rule; docs/REFUSALS.md regenerated; the API table
gains the variant.
2026-11-18 06:41:16 -08:00
Anees Iqbal 4c14d57217 rt: a runtime thread holds its gauge slot before its start returns
Gauges::threads counted a thread only once it ran: start() spawned it and returned, and the new
thread took its slot as its first act. So a reading right after Device::new could miss the
submit and completion threads. every_device_keeps_its_gauges_flat_under_ten_thousand_empty_commits
read its baseline after settled(), which waits only for the block-maker, and on a loaded node
that came before the last two threads held their slots: the gauges then never matched the
baseline and the test failed after its 60 s patience (XTX job m3-max-46269; UHD 630 job
m3-max-46278: [5456, 8240, 17284, 5400] against [5456, 8240]). The race is in the gauge since
the own-thread gauge, not in the commits the test makes.

start() now waits on a channel the new thread drops once it holds its slot (or as it unwinds,
so a panic cannot leave the caller waiting), and returns after that. Every thread the runtime
starts goes through start(): the device's four in Device::new and the cache store's removal
thread. The gauge is exact as soon as Device::new returns, with no test-side wait.

Test: every_device_counts_its_four_threads_as_it_is_made reads the gauge as Device::new returns
and expects four slots held.
2026-11-18 06:39:55 -08:00
Anees Iqbal 3aec33fe24 translator tests: the old render key's pin over a committed AIR fixture, the same on every host
the_old_render_descriptor_key_keeps_its_value pinned the old runtime's key of a descriptor whose
stages came from stage_io.ll, which the host's llvm-as assembles. The key hashes the AIR bytes
(Library::from_air's content hash), and llvm-as writes other bytes of the same .ll in each LLVM
release: 23.1.5 (gem10, um870, um790), 23.1.4 (ms01) and 23.1.1 (msi) gave three bitcode digests
of stage_io.ll (30091f56, b2f50f5e, 66a891b8; jobs m3-max-46350 to 46354). The golden table
already keys its rows on the fixtures' source text for this reason. So the pinned value
was the value of the host that pinned it: under SEMANTICS_VERSION 2172 msi gives de648091 (the
pin of 328da5cc5e, which passes there at 328da5cc5e, job m3-max-46369) and um790 gave a5ca094a
(m3-max-46272); under 2173 um790 gives 5d351787 (the pin of 243145d7b1, job m3-max-46407) and msi
gave dcc45dbd (m3-max-46286). No input of the key moved between 328da5cc5e and 3cbf244329, and no
old-path output did, hash-level: the golden table (a hash per module) is unchanged between them
and passes at 328da5cc5e (m3-max-46369).

The descriptor's stages now come from the committed fbl_fetch_dual.air (fbd_vertex,
fbd_dual_float), whose bytes are the same on every host, and the test pins those bytes' digest
too, so a regenerated fixture fails with its own message instead of as a key change.

Verified:
- m3-max-46419 at this tree on b0175c0234 (um790, llvm-as 23.1.5): clippy of the translator, all
  targets and features, warnings denied; the test and golden_hashes_match_the_table pass.
- That build's test archive, run with no build on msi (23.1.1, m3-max-46440), ms01 (23.1.4,
  m3-max-46441) and um870 (23.1.5, m3-max-46442): both tests pass on each, so the pinned key is
  the same under the three llvm-as releases.
- Between b0175c0234 and this commit's parent, development changed no translator source, profile
  or engine fixture (the harness workloads fixture and the signature table only).

Other pinned values computed from a tool's output at test time: none found. The golden table keys
on source text and hashes the translator's output; the forwarding test's spirv-as comparison
assembles at a fixed target environment with preserved ids and ignores the generator word; the
other 16-digit and longer literals in the tests are digests of Metal's recorded answers or of
data, not of assembled bytes.
2026-11-18 06:35:58 -08:00