Commit Graph
1735 Commits
Author SHA1 Message Date
Anees Iqbal f1e7a97d56 Give 64 threads count shards of their own
What: shards::SHARDS goes from 16 to 64, the most the owners' bitmask
holds, as the encoders' tallies have. Threads past the owned shards
share one by an atomic add: the recorder's command counts and the
counts made with no encoder's core at hand.

Why: a process where more than 16 threads have counted (a consumer's
walk threads beside its other encoding threads) put every later thread
on the shared shard, each of their commands an atomic add the others
contend for. Memory: 48 more shards of 512 bytes (24 KiB) a device for the
core-less command counts, and 24 KiB more for each of the recorder's 8
slots (static).

Verified: neutral in the lanes once the tallies took the per-draw
counts: game_draws_threads beside 16 idle threads that drew, 5080
(pinned, 5 rounds) 589 -> 582 ns a draw, M3 703 -> 695, both within the
rounds' spread; four threads alone 5080 538 -> 562, M3 684 -> 604, the
same. tests::recorder_shards (at 64: 67 threads where some share) pass
on the M3 (nextest), lavapipe and the 5080 (one process, one test at a
time).

(cherry picked from commit e7e0c189e7de72c9faba60df76a7e65400c5695c)
(cherry picked from commit dec97514e41c7a430d2866be0e0ace5f45b1a853)
2026-11-05 18:59:19 -08:00
Anees Iqbal 630deb9385 Count each command into a tally its encoder owns while it is open
What: the 58 counts a draw, dispatch, tile dispatch or bind adds as its
encoder records it (the 23 that were sharded by thread, draws_rebound,
stage_tables_read, stage_tables_read_in_part, draw_states_recorded,
set_zero_writes_pushed and resident_uses_* among them, and 35 that were
one shared AtomicU64 each, set_zero_sets_reused/found, no_copy_lies_read,
draw_shapes_*, graphics_pipelines_looked_up, draws_settled and the rest)
move into one struct, CommandCounters, kept in shards (shards.rs):

- by encoder: each EncoderCore takes one of 64 tallies as it opens
  (Tally::take; a process-wide bitmask, lowest free bit) and gives it
  back as it drops. Where the count is made with the core at hand
  (EncoderCore::counts, Counters::of), it adds into that tally by a
  plain load and store: no thread-local lookup and no atomic
  read-modify-write. An encoder is recorded by one thread at a time
  (EncoderCore is not Sync; under the Worker policy its lowering sits
  behind a mutex, render/deferral.rs), so the tally has one writer.
  Encoders past the 64 open at once share one more by an atomic add.
- by thread: counts made with no core at hand (a no-copy buffer's lie
  read, a pipeline lookup, a bound offset moved, the ycbcr binds, ...)
  go into the calling thread's shard (Counters::thread), as the draws'
  sharded counts did. The lowering thread takes its own shard as it starts.

The fold point is the read: Device::work_counts() sums every tally and
every thread shard, open encoders' included, so a count is whole whenever
it is read. Lanes and tests read the counts while encoders are open
(dispatch_work, dynamic_multi_variable, neutral_zeros_shared,
uniform_bind_offsets among others), so a fold at an encoder's end would
leave those reads short. A tally given back keeps its counts; its next
owner adds on top (release on give-back, acquire on take).

Why: the consumer's profile of game_draws-like frames (about 12k draws a
frame on several walk threads) spent 0.094 samples a frame in the work
counts, 0.077 of them in draws_rebound: each count took two calls on
macOS for the thread-local shard, and the shared ones were atomic adds
every walk thread contended for. Nobody read the counts in that run.
No public item changes: WorkCounts keeps its fields.

Verified, release builds of the runtime_lane game_draws lane (two object
passes of 6,001 draws each, 12,002 a frame; a measurement branch carries
the lane), ns of the encoding thread's CPU a draw, median of 5 rounds,
before (e1b342d1b9) -> after -> a floor build with every per-draw count
left out:

- RTX 5080 Laptop host (Core Ultra 9 275HX, encoding pinned to P cores
  by taskset, a sitting of its own): bytes 437 -> 423 (floor 425),
  8605 -> 8536 instructions a draw (floor 8446); chunks 532 -> 523
  (floor 517), 10900 -> 10867 (floor 10738); four threads encoding at
  once 669 -> 538, their chunks 763 -> 661; four beside 16 idle threads
  that drew once 903 -> 589 (the floor's 660, 728 and 687: the floor
  build's layout is no bound there).
- M3 Max (macOS 27.0.1, unpinned, other jobs on the host; 3 rounds
  single-threaded): bytes 416 -> 414 (floor 400), chunks 565 -> 566
  (floor 550), within the runs' spread there (another round read 462 ->
  473, floor 467); four threads 760 -> 684, their chunks 957 -> 779,
  beside 16 idle threads 1143 -> 703.
- frame_costs_plain (402 draws a frame): 5080 2.12-2.14 -> 2.11-2.23 ms
  of CPU a frame, M3 2.42-2.44 -> 2.38-2.44.
- Every count a frame of game_draws bytes, chunks and threads is equal
  before and after on the M3.

Tests, with the next two commits' changes on top: the runtime's
device tests that read a moved count (draw_again, dynamic_multi_variable,
neutral_zeros_shared, no_copy_lies, resident_uses, set_zero_at_offsets,
uniform_bind_offsets, deferred_calls, recorded_at_the_call and the rest,
with the shard tests and the new command_counts) pass on the M3 under
--cfg m2v_gpu (297 of 297) and on the 5080 (296 of 296), and the lane
modules that read one (dispatch_work, draw_work, frame_costs,
replayed_frames, provoking, line_widths and others) on the M3 (251 of
251); on lavapipe, 295 of 296 before command_counts' first precondition
was loosened. The three new tally unit tests pass on all three; under
a control where every encoder shares tally 0 all three fail (lost
additions), and under one where a read sums only given-back tallies (a
fold at the encoder's end) the two that read fail. clippy --all-targets
--all-features -D warnings on metal2vulkan-runtime is clean in the plain,
m2v_gpu and m2v_cpu_icd cfgs (Linux, the final tree; plain and m2v_gpu on
macOS too), and so is rustdoc -D warnings.

Resolved onto stack 35 (3e3eb3981f): resident_keys_settled, which stack
33 added to the draws' thread shards, joins CommandCounters and counts
into the encoder's tally at both of its draw paths (render.rs,
draw_again/rebound.rs); resident_uses_geometry_checked keeps stack 33's
walked count, now through the tally. host_alias_lookups stays the alias
table's own atomic: it counts only a lookup under that table's mutex
(host_aliases.rs augment_into), which a command whose keys are quiet
skips, so the add rides with the lock it counts. Two module docs that
still said a draw's counts went into its thread's shard now say its
encoder's tally (draw_again.rs, rebound.rs).

(cherry picked from commit 834354cb55a139b7ce01fb83ff30d7ced45742b6)
(cherry picked from commit 777714ca010d0bb476a8457596c4fc54030cd6b5)
2026-11-05 18:59:19 -08:00
Anees Iqbal b18b105cc0 Let a thread's own pass take the ready heads not behind, as the scheduler's does
A committing thread's pass (commit_and_submit) and a waiting thread's took
only the line head committed first of all (Order::take_first, and
claim_check's first_mut): any earlier commit held on any queue, its checks
waiting for a signal to land or run by the scheduler's thread, sent every
later commit to the scheduler's thread, a wake and a hop each, even a ready
one on another queue. A consumer's video round (5080, 1 s windows) showed it:
879 commits, 741 passes at commit, 358 batches submitted there, the other
~521 batches the scheduler's (batches_held_past_a_look 522, heads held for
checks 718, for check signals 129, for earlier commits 46; no event-value,
host-step or binary-semaphore holds), scheduler_wakes_host 668.

submit_plain_ready now takes its heads with Order::next and is_behind, the
scheduler pass's own selection: the first ready head in commit order that
waits behind no earlier commit keeping its place. claim_check takes the first
head in commit order whose checks the thread may run and that is behind no
earlier commit (no check before the batch it waits behind is submitted, as
check_heads keeps). A held head so holds back only the later commits that
wait behind it: its own queue's, and another queue's whose footprint runs in
commit order with it. Order::take_first and first_mut, now unused, go with
their two unit tests; the scheduler's next is tested by the rest of
tests::scheduler.

Test: commit_and_submit
a_head_held_for_its_check_holds_back_only_the_commits_behind_it holds queue
A's check on the scheduler's thread, then commits B (same buffer, behind A)
and C (another buffer) with commit_and_submit: C is checked and submitted on
the committing thread inside its call while A's check runs, B on the
scheduler's thread after A; handlers in submission order C, A, B; one batch
checked and submitted at commit. Before this change C's check ran on the
scheduler's thread after A's (expected; the run's evidence goes with the
landing report).

(cherry picked from commit ff664020a1c7fe171ff15422e17b3c846624d94c)
2026-11-05 18:59:00 -08:00
Anees Iqbal 217961dd48 Measure commit_and_submit's way to its submission in the latency lane
runtime_commit_to_submission (ignored, a measurement): a device under
RenderLoweringPolicy::Worker, checked command buffers committed with
commit_and_submit 2 ms apart, 500 of each shape in a row: a fill alone on its
queue; a fill on queue 0 right after queue 1's head was committed waiting for
a shared event that queue 2's 64 MiB fill signals, so that head's check waits
for the signal to land; and a render pass whose end the lowering thread has
not lowered at the commit. It prints commit -> return and commit ->
submission handler percentiles, which threads the handlers ran on, and what
the scheduler's work counts moved by over each shape (passes and batches at
commit, wakes, heads held for checks and landing signals, holds).

The second shape is the consumer's fallback: the at-commit pass looks only at
the head committed first of all, so another queue's head waiting for its
check sends every later commit to the scheduler's thread.

(cherry picked from commit 5667b2a735db82a8d287a6ae6ee7d02194778b54)
2026-11-05 18:59:00 -08:00
Anees Iqbal 8a516f2255 Submit a queued commit_and_submit on the thread that runs its commit
Under RenderLoweringPolicy::Worker a commit whose last render encoder's end
the lowering thread has not lowered returns at once and leaves its own work
to the thread that lowers the end (render/queued_commits.rs). That run
committed with Hand::Wake whatever the call was, so a commit_and_submit left
so lost its inline pass: the scheduler's thread was woken for it and ran its
checks and handlers.

The queued commit now keeps the call's hand (State::queued_commit is
Option<Hand>), and commit_queued makes commit_and_submit's pass on the thread
that runs it (the lowering thread, or a program thread that settles it before
a wait), with Hand::Wake on a thread command buffers' completion depends on,
as commit_and_submit does there. The pass's submission checks and handlers
then run on that thread. A render encoder opened there (by such a check or
handler) lowers its calls at their calls: one that handed them to the
lowering thread could wait for itself in reserve_end or wait_for_room.

Test: deferred_calls
a_commit_and_submit_after_an_end_in_flight_is_submitted_by_the_lowering_thread
holds the slot so the end is in flight at the commit, then checks the check
and handler ran on metal2vulkan-lowering, one pass at commit submitted and
checked the batch, and an encoder the handler opened lowers at its calls.
Without the hand kept the check runs on metal2vulkan-scheduler and
scheduler_passes_at_commit stays 0; without the guard lowers_at_call is false.

(cherry picked from commit bed9dc881cc1e6f18df708796da144a9072b9fb1)
2026-11-05 18:59:00 -08:00
Anees Iqbal 21a1cf7218 Give the commit hand-off's cost from idle too, and name commit_and_submit its inline form
docs/FAST-PATHS.md gave the scheduler thread's wake as 5 us on the RTX
5080 Laptop GPU, true for commits back to back, where the thread is
awake. From idle it is far longer: with one fill committed every 2 ms
(the completion latency lane), a commit's batch was watched 140 to 165 us
after the call at the median on that GPU, against 5 us for vkQueueSubmit,
and a parked thread's wake took 80 to 105 us at the median on that host.
The row gives both, and names CommandBuffer::commit_and_submit as the
inline form a program that needs the latency takes.

(cherry picked from commit 880ffe3b551b585a7593784165a7b4ac11bc50ec)
2026-11-05 18:58:59 -08:00
Anees Iqbal 10cb2efa05 Trace a commit's way to its submission in the latency lane
The runtime lane timed commit -> watched as one span: 140 to 165 us at
the median on the RTX 5080 against 5 us for vkQueueSubmit. The trace now
marks the steps between, in device-test builds only: the commit posted to
the scheduler's inbox, the scheduler's thread woken by it and waking, the
commit taken in by a pass, and the driver's submission called and
returned (relay.rs submit_logged, which every batch's submission goes
through). The lane commits a third shape, the completion-seen handler
alone with commit_and_submit, between the other two, and prints each
shape's commit call return and the split of its way to the watch.

A measurement change only (an ignored test and test-only trace points).

(cherry picked from commit 60905d60311824b51aaa077bd7baaa7227b095da)
2026-11-05 18:58:59 -08:00
Anees Iqbal 777ddc1285 Re-bless the authored compile census at stack 35's build
The census on the stack 35 tree (corpus-triage --audit authored-compile, 2262 cases, 47502 cells,
49326 compiles, none cached) found no failed cell, no difference and no regression: 46395 compiled,
1107 refused, 327 uncovered. 154 cells of 13 authored mesh cases moved their SPIR-V digest, every
one a case with an object or mesh function (object grids, payloads, mesh barriers, generated
partners): the object stage now carries its threadgroup's own thread count and the payload takes
the descriptor's length (SEMANTICS_VERSION 1972). No cell's outcome moved. --bless wrote those
digests and the table's artifacts_at line at this build. Slowest compile 2023 ms, peak worker RSS
232 MB.

Verified: the audit ran on the M3 (potluck m3-max-2413, then the bless m3-max-2473) with the main
checkout's private corpus; failed=0, differences=0, regressions=0.
2026-11-05 18:03:17 -08:00
Anees Iqbal 557f0e535b Re-record the conformance costs at stack 35's tree
The two mesh-object-draws-partial-threadgroup cases now run their draws where they were refused
before, so their records gain the shader modules, stage entries, render passes, runs and queue
sharing a drawn case makes. The other moved fields are the scheduler's (passes, sleeps, host wakes,
host-step head holds, spared wakes, waiter passes) and a few cases' command buffers begun and draw
states recorded. A whole-set run (`conformance cost --runs 8 --write`), then each changed case
alone (`cost --runs 8 --alone --write`), re-recorded 292 cases on the Apple M3 Max. No case gained
a first record.

Verified: both runs exited 0 on the M3 (potluck m3-max-2448). The conformance suite and
`conformance cost --check` rerun on this tree next.
2026-11-05 17:54:36 -08:00
Anees Iqbal 919012a3da Re-bless the golden hashes for the mesh object stage's partial threadgroups
The six engine fixtures with an object function (icb_mesh_template, mesh_barrier, mesh_draws,
mesh_object_grid, mesh_order, and their .air.ll twins) translate to new SPIR-V: an object
function's dispatch now carries its threadgroup's own thread count, so a partial object threadgroup
runs as Metal runs it. No other fixture's digest moved.

Verified: bless_golden_hashes on stack 35's tree (potluck m3-max-2399) moved only these 12 rows,
and golden_hashes_match_the_table passed after it.
2026-11-05 17:23:25 -08:00
Anees Iqbal 3e3eb3981f Bump RUNTIME_VERSION to 1774: completion-seen handlers where seen, mesh pipeline limits
A command buffer's completion-seen handlers run where its completion is seen, even beside completed
handlers. Mesh render pipelines take Metal's descriptor limits, answer its state queries, refuse
what Metal refuses with typed problems, and run a partial object threadgroup. Both change what the
runtime does for the same calls, so warm records made before them are not reused. The runtime
sources' pin is recomputed at this tree.

Verified: the pin is pin-compute.py's at this tree; the stack 35 gate runs next.
2026-11-05 17:15:12 -08:00
Anees Iqbal 7d813def6f Regenerate the derived tables at stack 35's picks
The private-doc-link mend shortened the degradations! macro's note link and a refusal's doc link
to in-scope paths, which moves the macro's template in api_signatures.tsv and one row of
docs/REFUSALS.md; no item's signature changed for a consumer. The mesh change runs a partial object
threadgroup, so the two mesh-object-draws-partial-threadgroup cases leave the conformance ledger
(1378 rows to 1376) in docs/CONFORMANCE-COVERAGE.md, whose conflict the pick resolved to the
earlier text.

Verified: signatures.py --check, refusal_surface.py --check and conformance-coverage --check pass
on this tree; metal-coverage is current.
2026-11-05 17:14:20 -08:00
Anees Iqbal 11ed058377 Expect an emulating device's Metal3 payload row to follow its workgroup memory
mesh_rows_follow_how_the_device_runs_mesh_stages asserted the mesh payload row exact on every
profile that runs mesh stages as compute work; the M3 run (m3-max-2232) failed it on
roadmap-2022, whose 16384 bytes of compute workgroup memory cannot hold Metal3's 16384 payload
bytes beside the object wrapper's 12. The row's refusal there, naming
maxComputeSharedMemorySize, is right; the test now expects it wherever the memory falls short
and the exact row elsewhere.

(cherry picked from commit 00580a43e543ef12d75b0c25210ba7f327e020d2)
2026-11-05 17:12:38 -08:00
Anees Iqbal 00b1974975 Answer a mesh state's grid limit as Metal does whatever the object function's attribute
The probe's new cases on the M3 Max (macOS 27.0.1, plain and with MTL_DEBUG_LAYER=1) show
that an object function's [[max_total_threadgroups_per_mesh_grid(4)]] changes nothing Metal
answers: maxTotalThreadgroupsPerMeshGrid is 1048576 without a descriptor maximum, and the
descriptor's 8 or 2 with one, above the attribute too. So the grid limit is the descriptor's
maximum, else 2^20, and the kernel fact that carried the attribute
(KernelFacts::max_mesh_threadgroups) goes, with its codec field. ARTIFACT_FORMAT_VERSION 489
and SEMANTICS_VERSION 1972 for the changed artifact and answers.

The same run confirms the rest of the rules the previous commit refuses and answers: a mesh
function's [[max_total_threads_per_threadgroup(64)]] beside a descriptor mesh maximum of 32 or
128 is code 3 ("Kernel specified ... must match ..."), as the object stage's is, and of 64 is
made; a required mesh size of 32 beside the mesh function's 64 alone is made, answering 64; a
required size equal to its stage's maximum is made. The probe's header now records every case's
answer. engine_mesh's tests follow: the object function's 16 threadgroups change no grid, and a
required mesh size beside the function's own maximum alone is made.

(cherry picked from commit b3be29725befbd7bfcdfdfb23b3a7a4207a527c2)
2026-11-05 17:12:38 -08:00
Anees Iqbal 4872534486 Judge Metal3's mesh rows by how the device runs mesh stages
The mesh shading, indirect mesh draw arguments and ICB mesh draw rows asked meshShader and
taskShader of every device, so a device that runs both stages as compute work (MoltenVK, ANV on
the Iris Xe) was refused for features it never uses. They now ask them only where the device
runs the stages natively (DeviceProfile::emulates_mesh_shading). On an emulating device the
mesh grid, object grid and payload limit rows answer by the compute stage's limits.

The rows stay refused on every device: a drawMeshThreads partial object threadgroup of an object
function that waits at a threadgroup barrier is not built (NotImplemented(MeshShading)), so
Metal3 stays false; the MeshShading row's doc says so and what each kind of device needs before
it.

Test: mesh_rows_follow_how_the_device_runs_mesh_stages over every committed profile, printing
each profile's Metal3 blockers. Not yet built.

(cherry picked from commit 4ec3136921d7d06e129944eb8f183b4f043e0a1f)
2026-11-05 17:12:37 -08:00
Anees Iqbal c305c66a7f Give mesh pipelines Metal's descriptor limits, state queries and refusals
The mesh descriptor gains Metal's fields, with Metal's defaults:
max_total_threads_per_{object,mesh}_threadgroup, max_total_threadgroups_per_mesh_grid,
the two threadgroup-size-is-multiple-of-width flags, payload_memory_length,
max_vertex_amplification_count (1) and required_threads_per_{object,mesh}_threadgroup. The
descriptor key reads every one.

A compiled mesh pipeline carries MeshPipelineMetalInfo (RenderPipeline::mesh_info), and the
runtime's RenderPipelineState answers Metal's five mesh queries from it, plus the two required
sizes. Each thread limit is the descriptor's maximum, else the function's
[[max_total_threads_per_threadgroup(n)]], else 1024, held to the device's own limit where that is
lower: the task and mesh stages' invocations with VK_EXT_mesh_shader, the compute stage's where
both stages run as compute work. The widths are 32. The grid limit is the descriptor's, else the
object function's [[max_total_threadgroups_per_mesh_grid(n)]], else 2^20, held to
maxMeshWorkGroupTotalCount where mesh functions run natively. Without an object function the
object stage answers 0 and 0, where the M3 Max answers 3 and 32 (an accepted difference).
DeviceProfile::emulates_mesh_shading says how a device runs the stages, so a consumer no longer
copies the compile layer's rule; with the getters, no separate per-stage query is needed.

What Metal refuses is refused as Metal's rule, DescriptorError::MeshPipeline with a
MeshPipelineProblem, measured on the M3 Max (mesh_pipeline_limits.m, plain and under
MTL_DEBUG_LAYER): a required size with an axis of 0, past 1024 threads or past its stage's
maximum, or for an object stage without an object function (process ends); a maximum past 1024,
a function maximum other than the descriptor's, a mesh stage's required size of other threads
than its maximum, and a payload past 16384 bytes (creation errors, codes 3 and 2). An
amplification count of 0 is VertexAmplificationCount, as a render pipeline's; one above 1, which
Metal makes, is NotImplemented(VertexAmplification), recorded in FAST-PATHS' known gaps.

payloadMemoryLength widens the object and mesh functions' payload arena past the declared type
(LoweringInputs::object_payload now reaches the object stage too); an object stage compiled on
its own without it is NeedsInput(ObjectPayload). SEMANTICS_VERSION 1971 and
ARTIFACT_FORMAT_VERSION 488 for that and the new artifact field; the runtime's warm record
format 4 for the descriptor's fields.

Docs: the new_mesh_render_pipeline_state doc now says how each device runs mesh stages, and
what it refuses; API.md's accepted differences gain the mesh pipeline rows. api_signatures
blessed (it also records RuntimeFact::PartialObjectThreadgroups from the partial-threadgroup
commit), api_surface lists MeshPipelineMetalInfo and MeshPipelineProblem, REFUSALS.md,
METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md regenerated.

Tests: engine_mesh's a_mesh_pipeline_answers_metals_mesh_queries_within_the_device and
a_mesh_descriptor_metal_refuses_is_refused_as_its_rule over every committed mesh and
emulating profile; the validation lane's
a_mesh_state_answers_metals_queries_and_refuses_what_metal_refuses on a device. Not yet built:
the next steps are the M3, lavapipe and RTX 5080 runs.

(cherry picked from commit d6934967fad363ca2185c49935204141f253b416)
2026-11-05 17:12:37 -08:00
Anees Iqbal a3990476a0 Probe a mesh function's own thread maximum and an object function's grid maximum
Adds cases to the mesh pipeline limits probe: a mesh function of
[[max_total_threads_per_threadgroup(64)]] beside descriptor maxima of 32, 64 and 128 and a
required size of 32; an object function of [[max_total_threadgroups_per_mesh_grid(4)]] with
and without a descriptor grid maximum; and a required size equal to its stage's maximum. The
functions of the new attributes compile apart, so a refusal of theirs leaves the other cases.

Not yet run; the results go into the header with the next probe commit.

(cherry picked from commit b27179d7a36fd9c841f95dcff7d195365a6566a1)
2026-11-05 17:12:37 -08:00
Anees Iqbal 427fc82943 Add a Metal probe of a mesh render pipeline's limits and queries
What: probes/mesh_pipeline_limits.m makes one mesh render pipeline a
process with a descriptor's thread maxima, mesh-grid maximum, payload
length, vertex amplification count or required threadgroup sizes, and
prints Metal's error or the made state's eight queries.
Why: the mesh descriptor's new fields follow Metal's creation rules and
the state's queries answer as Metal's; this measures them on the M3.
Verified: run on the M3 Max in the commits that use its answers.

(cherry picked from commit 4296206a64bc7502ec045c50980a68310ef0660b)
2026-11-05 17:12:37 -08:00
Anees Iqbal 00cf6f5f33 Give the binder's mesh test template its partial_groups field
What: the bind::graphics tests' mesh_template sets MeshTemplate's new
partial_groups field (false), which the previous commit added.
Why: the lib test target did not compile without it.
Verified: the potluck clippy and test run that follows.

(cherry picked from commit 44b6ece8ac97963372952413978c196707588bfb)
2026-11-05 17:12:37 -08:00
Anees Iqbal ead2c31249 Run a partial object threadgroup of drawMeshThreads as Metal does
What: a drawMeshThreads with an object function whose threads leave a
partial object threadgroup now draws instead of failing with
NotImplemented(MeshShading). The binder launches the object threadgroups
the threads fill, rounded up, at their whole size, under MultiRegion 1,
with Metal's threads in region[1].xyz and the new flag
lower::dispatch::NONUNIFORM in region[1].w (a folded variant's record
carries it in word 7). An object function whose body holds no workgroup
barrier (lower::mesh::plan_partial_groups, RuntimeFact::
PartialObjectThreadgroups) reads the flag: its threadgroup answers
min(L, threads - group * L) per axis as threads_per_threadgroup and in
its simdgroup counts, its thread position is lin unflattened over that
size, and its invocations past it return before the body. The emulated
wrapper's payload copy strides by the dispatched threads so those
invocations still copy. A body that holds a barrier keeps the uniform
form and its partial draws stay NotImplemented(MeshShading), since the
returned invocations would not reach the barrier (FAST-PATHS known gap).

Why: Metal (M3 Max, macOS 27.0.1) draws these: 6 threads in object
threadgroups of 4 run a threadgroup of 4 and one of 2 whose
threads_per_threadgroup is 2, as dispatchThreads runs a kernel.

Tests: lower::dispatch's partial_object_threadgroups_match_metal (each
Metal thread live once with Metal's builtins, Spec and Flat forms);
the binder's object_draws_specialize_each_stage_within_its_limits (the
flagged region, MultiRegion 1, refused without the fact); engine_mesh's
emulated and native partial draws and
a_partial_object_threadgroup_of_a_body_with_a_barrier_is_not_implemented;
the lane test object_draws_store_metals_words now requires Metal's words
for both Threads rows; the conformance ledger's two partial rows are
removed. SEMANTICS_VERSION 1970. Verification in the following commits'
potluck runs.

(cherry picked from commit 1707d3428bcd641faba462d4c35b13148df83a91)
2026-11-05 17:12:36 -08:00
Anees Iqbal ee8cd191b0 Arm the latency lane's armed waiter ahead of its submission, and count late arms
The raw lane's armed variant asked its waiter thread to wait just before
the submission, so on the RTX 5080, whose 4 KiB fill ends 16 to 35 us
after vkQueueSubmit, the waiter's own wake (80 to 100 us at the median on
that host) often came after the GPU end: in one of the two rounds its
wait entered 55 us after the GPU end at the median, which is the woken
variant's shape, not the armed floor. It now asks a millisecond ahead.

Each raw and runtime line now also counts the waits entered after the
GPU end, where the time to the wait's return holds the waiting thread's
wake and not only the driver's.

A measurement change only (an ignored test).

(cherry picked from commit 782b3e90151195baaf69a2533204dca67c644de2)
2026-11-05 17:12:28 -08:00
Anees Iqbal 5878ad9847 Build the completion trace only with the device tests that read it
The trace of the queue waiters' steps was compiled into every test build,
but only the completion latency lane reads it, and that lane is a device
test (m2v_gpu, m2v_cpu_icd). In a plain test build its fields and its
start and stop went unread, which clippy -D warnings refuses. The module
and its hooks now take the lane's cfg.

Verified: clippy --all-targets --all-features -D warnings in the plain
configuration on the M3 (it failed with six dead-code errors before).

(cherry picked from commit 7bfc5f56e37ead4fd8aadeb6721e63f65047d4ce)
2026-11-05 17:12:27 -08:00
Anees Iqbal 60622e6b51 Hold completion_here to the completion-seen handlers' new thread
With a completed handler besides, a command buffer's completion-seen handler
now runs where its completion is seen (at least once of the rounds, as
without one: an earlier transition may hold the context), still before the
completed handler, which runs on the queue's handler thread.

(cherry picked from commit 75d71b2edb211e1b8ac6ee082f3b0c3f7be968f8)
2026-11-05 17:12:27 -08:00
Anees Iqbal 1f2b0f2d39 Run a command buffer's completion-seen handlers where seen even with completed handlers
A command buffer with completed handlers ran its whole transition to
Completed on its queue's handler thread, its completion-seen handlers
included, so they started a thread wake after the queue waiter's turn: the
consumer's handler_cost bench (a completion-seen and a completed handler on
each 4 KiB fill) put that wake into the completion-seen latency. On an idle
M3 Max (MoltenVK 1.4.2) the turn-to-handler time was 22 us at the median
with a completed handler against 1 us without.

Now the waiter runs such a transition to its completion-seen handlers
(To::Seen: its status final, those handlers run) where its queue's context
is idle, and posts the rest (To::Rest: follow release, completed handlers,
slot, releases, gate) to that context while it still runs it, so the queue's
later items stay behind the rest. The rest holds its own Hold, so the gate,
and wait_until_completed, open only after the completed handlers and once
the context is done with the rest (the order a10704b730 set). A command
buffer with a Follow (it signals at its end an event another queue's
command buffer may wait for) keeps the whole transition on the handler
thread, so the cross-queue order (follow.rs) is untouched. Where the waiter
cannot run it here (the line busy, a deallocator held), the transition goes
whole, as before (Item::whole).

complete() is split into complete_seen() and complete_rest(), unchanged in
order. Docs: add_completion_seen_handler, completion.rs, the runtime README
and RUNTIME-PORTING.

Not yet run on a device.

(cherry picked from commit e1f36ec2f08735c92872a3d5eed8689b398373ce)
2026-11-05 17:12:27 -08:00
Anees Iqbal 582d3ba040 Test the orders a command buffer's two handler kinds run in
Each command buffer with a completion-seen handler and a completed handler:
its status reads Completed in its completion-seen handler, which returns
before its completed handler starts, and its wait returns after that one
returned; on one queue, an earlier command buffer's completed handler
returned before a later one's completion-seen handler starts; and a command
buffer that waited on the GPU for another queue's end-of-command-buffer
event signal runs its completion-seen handler after the signaller's, the
signaller reading Completed there. Also that at least one completion-seen
handler of such a command buffer ran where its completion was seen
(WorkCounts::completion_seen_handlers_where_seen), which fails today: with a
completed handler, the whole transition goes to the handler thread.

Not yet run.

(cherry picked from commit a79dd6cbbb438c8e57171f55c3b500fff39337fd)
2026-11-05 17:12:26 -08:00
Anees Iqbal 9420639401 Interleave the two handler shapes in the runtime lane
A host's wake costs move with its load (an M3 Max's turn-to-handler time fell
from 22 us idle to 2 us beside another build), so the shapes alternate
command buffer by command buffer and meet the same host.

(cherry picked from commit dc32082f78a064637e22df508218dc92d79d3faf)
2026-11-05 17:12:26 -08:00
Anees Iqbal fbea282fd7 Time the runtime's completion with and without a completed handler
A command buffer with a completed handler runs its whole transition, its
completion-seen handlers included, on its queue's handler thread, a thread
wake after the waiter's turn; one with completion-seen handlers alone runs
it on the waiter. The lane times both shapes, and splits the turn over the
turns that marked both ends of each step.

(cherry picked from commit 90394fe9832bd1588b25831a4560a8659280975c)
2026-11-05 17:12:26 -08:00
Anees Iqbal 74768ebea1 Split the turn by each step's first mark after it
A turn of batches that end no command buffer can follow a command buffer's
turn before the next one's, so its steps are not all the command buffer's own:
take the first mark of each name after the turn.

(cherry picked from commit 68b114b10312e843b96d7b1cb6c5c86b166baab9)
2026-11-05 17:12:25 -08:00
Anees Iqbal 02ca2a2c20 Trace the completion turn's steps in the latency lane
finish() marks, in test builds only, where its events were reached, its fences
settled and its GPU times placed, so the lane splits the time from the turn
to the completion-seen handler.

(cherry picked from commit 66ecc26c9ce04f92e7747c8f873e04fcbca18641)
2026-11-05 17:12:25 -08:00
Anees Iqbal 587d155705 Measure the plain driver's untimed fence wait too, and every wait from its submission
On MoltenVK the runtime's command buffers write no timestamps (GPU times from
the host) and a timestamp costs a pass of its own, so the plain driver's fill
with no timestamps, waited for at its fence and timed from vkQueueSubmit, is
the floor the runtime's commit-to-seen time compares with there.

(cherry picked from commit 9bc2b4cdaaf7553bb358414735aec945ee760978)
2026-11-05 17:12:25 -08:00
Anees Iqbal 1f0a6dc285 Measure the completion latency: the plain driver's floor and the runtime's steps
A measurement lane (ignored by default): RUNS fills of 4 KiB submitted 2 ms
apart, timed from the GPU's calibrated end to each wait's return, on a plain
Vulkan device of the test's own (timeline, fence, sync_fd, a waiter armed
before the submission, one woken after it, a spin on the counter), and on the
runtime: GPU end to the completion-seen handler, with the queue waiter's steps
between from a test-only trace (watch, the driver's wait entered and
returned, the turn's seen time).

Not yet run.

(cherry picked from commit 2466895c03e6923172d6c549ff362550eb5299b5)
2026-11-05 17:12:25 -08:00
Anees Iqbal 8e65408e85 Resolve the runtime's broken private intra-doc links, and lower its ceiling to 0
CI's private intra-doc link step reported 148 for metal2vulkan-runtime on
macOS and 149 on Linux at 3b176b8bd4, against a ceiling of 70, so the step
was red on both runners:

- 119 links whose explicit target is the item their label already
  resolves to (`redundant_explicit_links`): 73 from the `degradations!`
  macro, one per precision-note kind's `PrecisionNote::<note>` link, and
  46 written by hand. The target is dropped; the rendered link is the same.
- 17 links to `RenderCommandEncoder::<method>` for methods that are the
  lowering's (`RenderLowering`) since the program's encoder was put in
  front of it: assemble, begin_current_draws, begin_inline_split,
  finish_replay, flush_inline, gathering, group_turn, inline_begin (2),
  inline_split, plan_one, replaying, settle_draw, settle_draws,
  snapshot_fallback, snapshot_wanted and watched. Each links
  `RenderLowering::<method>`.
- render.rs: `check_tile` (a `ShapeInputs` method) linked
  `Self::kept_imageblock_bytes`, and `kept_imageblock_bytes` (a
  `RenderLowering` method) linked `Self::pass_sample_length`; each links
  the other type's method by its type. The `plain_drawn` field linked its
  sibling field `replay_plain` by its bare name; it links `Self::replay_plain`.
- scheduler: `Order::behind` is `Order::is_behind`.
- event_timeline.rs: `Signal::after` is the `after` field of the
  `Signal::Kept` variant.
- pipeline/libraries.rs: `GraphicsContent` is linked by its path in the
  sibling module (`super::graphics`).
- Items built for tests alone are named without a link, as the translator's
  `DIRECT_ARGUMENTS_FROM_AIR` is: `Allocations::limit_to`,
  `patched_slot_uses` and `state_locks`.
- exit_guard.rs: the module docs describe both exits, but `end_at_once`
  and `AT_ONCE_NOTICE` are built on Linux with the GNU C library alone and
  `BOUND` and `MAKING_BOUND` everywhere else, so each runner failed on the
  other's; the four are named without a link.

Docs only; no behaviour changes, so no version moves. The runtime-sources
pin moves with these files; the stack re-pins it.

Verified (potluck): the counts before are from `RUSTDOCFLAGS=-Dwarnings
cargo doc -p metal2vulkan-runtime --all-features --no-deps
--document-private-items` on the M3 (macOS 27) and msi-laptop (Linux).

(cherry picked from commit b4d88f87c6d6fa4c1dfc3fa9774b2fc540c6b297)
2026-11-05 17:12:18 -08:00
Anees Iqbal 4515a9ab3b Resolve the AIR crate's last private intra-doc links, and lower its ceiling to 0
CI's private intra-doc link step reported 3 for metal2vulkan-air at
3b176b8bd4 (macOS and Linux alike), against a ceiling of 3:

- abi/keys.rs: `Key::parse` linked `KEYS`, the spelling table its test
  holds the matches against, which is built for tests alone; it is named
  without a link.
- abi/core_image.rs and abi/visible.rs: two `AbiError` links carried an
  explicit target the label already resolves to; the target is dropped.

Docs only; no behaviour changes, so no version moves.

Verified (potluck, M3 and msi-laptop): `RUSTDOCFLAGS=-Dwarnings cargo doc
-p metal2vulkan-air --all-features --no-deps --document-private-items`
reported 3 before; the count after this commit is in the next job's log.

(cherry picked from commit dde8a1cd07867b6fa9f71ac6c9cf8a7442f85b11)
2026-11-05 17:11:57 -08:00
Anees Iqbal b10227d09f Re-bless the authored compile census at stack 34's build
The census on the stack 34 tree (corpus-triage --audit authored-compile, 2262 cases, 47502 cells,
49326 compiles, none cached) found no failed cell, no difference and no regression: 46395 compiled,
1107 refused, 327 uncovered. --bless wrote the table's artifacts_at line at this build, whose
product fingerprint moved; no cell's outcome or SPIR-V digest moved. Slowest compile 1600 ms, peak
worker RSS 232 MB.

Verified: the audit ran on the M3 (potluck m3-max-2161, then the bless m3-max-2377) with the main
checkout's private corpus; failed=0, differences=0, regressions=0.
2026-11-05 17:02:07 -08:00
Anees Iqbal d3b40aa488 Re-record the conformance costs at stack 34's tree
The moved fields are mostly the scheduler's: its passes, sleeps and host wakes, host-step head
holds, spared wakes, waiter passes and sleep slices, with a few cases' command buffers begun,
primaries begun ahead, pipelines looked up and draw states recorded. A completion pool that keeps
its hold until a command buffer's completion lines are done, and textures over IOSurface planes
taking more shapes, change when the scheduler runs a pass and what a few cases begin and record.
A whole-set run (`conformance cost --runs 8 --write`), then each changed case alone (`cost --runs 8
--alone --write`), re-recorded 378 of the cases on the Apple M3 Max. No case gained a first
record.

Verified: both runs exited 0 on the M3 (potluck m3-max-2343). The conformance suite and
`conformance cost --check` rerun on this tree next.
2026-11-05 16:54:23 -08:00
Anees Iqbal c60f324aae Bump RUNTIME_VERSION to 1773: a context done before its holds go, IOSurface plane shapes made
The runtime's behaviour changes in ways a stored runtime artifact can see: every runner of a
context's items marks the context done with an item before it drops what the item still holds, so a
command buffer's waiters return only once its queue's context finished its transition
(completion-order-race); textures over IOSurface planes that Metal makes (BC1 to BC7, texture
buffers, 1D and one-slice arrays) are made, and the other planar shapes are refused as
RuntimeGap::SurfacePlaneShape (iosurface-envelope).

The runtime-sources pin is recomputed with pin-compute over this tree:
189b123d61b61654634ec51cfd157c55b6143872ce5e55ef32abf6c81b4608bf.

Verified: api-signatures, refusal-surface and conformance-coverage --check pass on this tree; the
gate's legs run after this commit.
2026-11-05 15:27:45 -08:00
Anees Iqbal 122d2f53e6 Have the surface-shapes device test ask for the validation layer
The negative control that takes off the 2D-only guard of a shadow's
word and unorm views (texture.rs) made a TYPE_2D view of the 1D shadow
of oracle_surftex 116 over host pages on the M3 without any failure the
test saw (VUID-VkImageViewCreateInfo-subResourceRange-01021 is a layer
check). The test now asks for the validation layer, as layer_claim.rs's
tests do, and requires it to report nothing.

Verified: the M3 runs follow.
(cherry picked from commit 13c35becaaa457e8233f31cb0e474833fe34fea3)
2026-11-05 15:26:47 -08:00
Anees Iqbal 5080707c8c Document the surface shapes and BC textures the runtime makes
linear_plan.rs gains **Block-compressed surfaces** and **Beyond the
plane's rows** (the probe's measurements and what the runtime holds);
new_texture_with_iosurface_plane names the new shapes and the
SurfacePlaneShape refusal; TexelsPastBufferLength records where the M3
Max puts rows past a surface's end and that the x86 Macs' are
unmeasured; FAST-PATHS.md's known gaps record the refused shapes and
the taller-than-plane divergence on the x86 Macs, which IoSurfacePlane
cannot hold as it carries no plane height. Regenerated docs/REFUSALS.md
and api_signatures.tsv (RuntimeGap::SurfacePlaneShape).

Verified: refusal_surface.py (0 variants without reach or basis);
signatures.py --bless. Rustdoc runs in the next M3 job.

(cherry picked from commit d3bb1dfa2aab94728518529a0b2020da4a3e76aa)
2026-11-05 15:26:47 -08:00
Anees Iqbal 90adb7ce5f Move BC rows of blocks in blits; test surface shapes on devices
A blit naming a texture over a buffer copies the buffer's rows
(texel_rows, texel_layout), which counted a region's texels as rows of
units: for a BC texture over a surface (oracle_surftex 66 and its
family) that copied 64 texel rows of 512 bytes where the surface holds
16 rows of 128. Both now count the region in its unit's blocks; every
other texture over a buffer has a unit of one texel and is unchanged.
A unit test (a_bc_texture_over_a_buffer_moves_rows_of_blocks) checks a
16 x 64 BC1 over a plane at 32, 64 bytes a row.

tests/surface_shapes.rs (device test, m2v_gpu / m2v_cpu_icd): each
shape the probe measured (66, 67, 131, 147, 148, 125, bgrapad.bc1, BC3,
BC4, the x86 420v planes, texture buffers 121/129/128-wide, 1D 116,
one-slice arrays 117/127) over a Shared buffer and over host pages: a
kernel's reads, blit read, getBytes, replaceRegion and blit write each
against the surface's bytes, the surface's other bytes unchanged.

iosurface_planes_lie_where_metal_puts_them: a planar plane below its row,
of two slices or of two levels is PlaneShape now (Metal makes them).

Verified: device runs follow (next commits).
(cherry picked from commit 56b1444a07b29b57c3689d3a1ccba53619a361f0)
2026-11-05 15:26:47 -08:00
Anees Iqbal 5b21437f2a Take a BC shadow's bounded copies off with then_some
clippy's some_filter: the same value, the condition read first.
Verified: clippy on m3-max (this commit's job).

(cherry picked from commit 7a276252e1aa64764f4861692db3ec354a5640a2)
2026-11-05 15:26:46 -08:00
Anees Iqbal 1b39fb00f0 Test the surface-plane shapes and BC rows the probe measured
One test per family of oracle_surftex cases the probe settled: the
texture buffer (35, 121, 129), 1D (116) and one-slice 2D array (117,
127) over a plane lie as the 2D texture's rows; wider rows (17, 21),
levels (123, 42), slices (118), 3D (120), Cube (119) and multisample
(122) over a planar surface's plane are the runtime's PlaneShape gap,
where over a surface without planes Metal itself stops 136, 12, 25,
27 and 38. BC textures over a surface (66, 67, 125, 131, 147, 148)
lie a row of blocks a row; 132-135 are Metal's own RowPitch and
PastBuffer stops; ASTC and ETC2 stay NotLinear. A third test checks
the BC shadow's copy regions: row length in texels of the surface's
pitch, extent the texture's own texels.

Verified: cargo nextest on m3-max (next commit's job).
(cherry picked from commit 82b53463634701d4270cd905f4c790a08d7121c5)
2026-11-05 15:26:46 -08:00
Anees Iqbal 867c7e506e Make BC, texture-buffer, 1D and one-slice array textures over surfaces
The surface probe (surface_texture_envelope, potluck m3-max-1581, -1596,
-1598) measured which bytes textures over IOSurface planes reach on an AMD
5300M, an Intel UHD 630 and an M3 Max:

- BC over a surface's rows (oracle_surftex 66, 67, 125, 131, 147, 148): both
  x86 GPUs' blits, Private ones too, and getBytes take block row j at the
  plane's offset + j x bytesPerRow; the UHD 630's replaceRegion too. The
  runtime makes BC1 to BC7 there as a shadow image whose copies move those
  block rows (Texels::blocks, block-aware plane_copy_regions and copy unit).
  Over a surface without planes Metal's texel-row height check is kept.
- A texture buffer over a surface (35, 121, 129): contiguous from the plane's
  offset on the M3 and the 5300M. Over a planar surface it may run past a row.
  It now takes the descriptor's options, as a surface's other textures do.
- A 1D texture whose row fits (116) and a 2D array of one slice (117, 127):
  the 2D texture's bytes on all three.

Every other shape Metal makes over a planar surface's plane (wider rows, more
levels, other types) has no one layout across the three GPUs and the CPU
calls: refused NotImplemented(SurfacePlaneShape), where it was Invalid.

Verified: not yet built (next commits fix forward).
(cherry picked from commit a937933adfe5f451bd1d79e1605adb124c841dae)
2026-11-05 15:26:46 -08:00
Anees Iqbal d7edac4647 Probe the rest of the BC family over surfaces, and BC1 samples
Adds BC1 sRGB, BC2 to BC6H and BC7 sRGB over a surface without planes, BC7
over a plane, and BC1 over both planes of a 420v surface (at their offsets),
and a check of what a kernel's samples of a BC1 texture decode: the surface
filled with solid blocks naming their own offsets.

Verified: built and run in the next potluck jobs.
(cherry picked from commit 6c1aa895a3a92b44d4eee3065546560777a2d211)
2026-11-05 15:26:46 -08:00
Anees Iqbal 8daf48b5d3 Give the surface probe's write tag bytes no read-tag byte equals
A write of texture byte k to surface byte k changed only the marker byte, the
two tags sharing their index bytes, so every write read as one-byte runs of
other bytes (the first M3 run, potluck m3-max-1570). The write tag's index
bytes now lie over 0x40, the surface's over 0x80.

Verified: the M3 run of the fixed probe follows in the next potluck job.
(cherry picked from commit efe44e5c72e1af52042e0a5c16d8aabae615d7d1)
2026-11-05 15:26:46 -08:00
Anees Iqbal 715d2c3332 Add a probe of which surface bytes textures over IOSurface planes reach
oracle_surftex (reims-vgpu's Q20) records only that Metal makes textures over
a plane whose rows are wider or taller than the plane's, of several levels, of
types other than 2D, and of BC1 and BC7 over a surface's rows; not which bytes
they read or write. This probe tags every surface word with its own offset,
reads each level, slice and face back by blit, kernel and getBytes, writes a
second tag through blit and replaceRegion, and lists which surface bytes each
reached, one shape a process. Shapes whose rows at the plane's pitch would end
past the surface run only under --hazard.

Verified: not yet run (this commit is what the potluck jobs build).
(cherry picked from commit 530ea9b121d1c70a819a5d68866b20f23ee65bd2)
2026-11-05 15:26:46 -08:00
Anees Iqbal 2b85b05ff9 Mark a queue's context done with a transition before its command buffer's waiters return
What: a thread that ran an item of a queue's context (a handler thread, a completion turn running
a transition where it saw it complete, the scheduler running a plain transition to `Scheduled`
alone) now marks the context done with the item before it lets go of what the item still holds.
`Run::run` answers that (`Run::Held`; `Kept` for the device's items): a transition's hold of its
command buffer, whose going opens the command buffer's gate and so lets its waiters return. On a
thread other than a handler thread the hold still goes short of the command buffer's last
reference; `Hold::let_go_short_of_last` now answers the hold's place in the gate's count, which
the runner lets go of after the context is done.

Why: in stack 32's gate on the RTX 5080 (beside another job), `completion_order::a_command_buffer_
that_waited_for_another_queue_completes_after_it` failed once: A Both, B Seen, B committed first,
plain event, in 1 round of 50 A's status was not Completed when B's wait returned and A's
completion-seen handler ran after B's. The cause: the handler thread that ran a round's A dropped
the transition's hold inside `Item::run`, which opened A's gate (the program's wait for A
returned), and only then took the pool's lock to mark A's queue's line done. Where the host kept
that thread off the CPU between the two, the program went on to the next round with A's line
still marked running. The next A's transition to `Scheduled` was then posted behind it instead of
running alone, and its transition to `Completed` landed behind both, so `Follow::leads` saw it
behind another item and B's transition was not held behind it (`finish_here`): B completed
first. A plain event's wait goes to the GPU, so A and B complete close together. The contract is
unchanged: B waits only where A's transition leads its context, and a blocked handler of A's
queue still holds back A and not B (its test is unchanged and passes). The test read nothing
Metal does not promise: the round's A had completed, its handlers had run and its wait had
returned, so A's queue had nothing of the program's left to run.

A test-only pause (`Contexts::pause_after_items`, under the device-test cfgs) stands in for the
host taking the CPU from a handler thread once it let go of an item's holds.

Tests:
- `tests::completion_order::a_handler_thread_held_off_the_cpu_after_a_wait_returned_keeps_the_order`:
  each handler thread that ran a transition of A's queue pauses 100 ms once it let go of its
  hold, 8 rounds (A Both, B Seen, plain event); asserts the order and that the pauses ran.
- `tests::contexts::an_item_s_context_is_done_with_it_before_what_it_held_goes`: on the pool's
  thread, in `run_here` behind an earlier item and in `run_alone`, the item posted once what the
  first item held went leads the context.

How verified:
- M3 Max, MoltenVK 1.4.2, the runtime device suite at -j 6 (hazard tests left out): 1663 of
  1663 passed. The three completion_order tests, 10 runs: all passed; the paused-thread test made
  8 pauses a run and B waited behind A in 2 to 4 of its 8 rounds.
- The paused-thread test at development's tip (this test and its pause hook only, no fix): failed
  3 of 3 runs, A not Completed in 7 of 8 rounds and A's completion-seen handler after B's in 7 (the
  first round has no earlier A), the failure seen in the gate; 15 pauses a run, as each A's
  transition to `Scheduled` went to the busy context too. With the fix let go of before the
  context is done in the pool's loop and both other runners: failed 2 of 2 the same way.
- The contexts test fails with each runner's order reverted alone (pool thread, `run_here`,
  `run_alone`), and passes with the fix.
- clippy --workspace --all-targets --all-features -D warnings: plain, --cfg m2v_gpu, --cfg
  m2v_cpu_icd. RUSTDOCFLAGS=-D warnings cargo doc --workspace --all-features --no-deps. The
  runtime's private intra-doc diagnostics: 149 lines before and after (none in the lines this
  commit touches).
- submit_path (release) on the M3, base and fix alternately, 4 passes: commit-to-handler p50 at
  gaps 0 and 100 us 179 to 253 us for both; both builds show the same slower mode at idle gaps
  of 300 us and 2 ms in some passes (GPU end to handler about 20 us); B before A 0 of 2000 in
  every cross run of both.
- RTX 5080 before/after under load: in the branch's report.

(cherry picked from commit a10704b730194046d0048da1a2e5219abe7c55db)
2026-11-05 15:26:46 -08:00
Anees Iqbal 3b176b8bd4 Expect a GPU fill of logged pages to gate the next copy in to its pages
`a_gpu_write_of_the_pages_reaches_the_device_copy` expected the copy in after a blit fill of rows
40 to 47 of a buffer over logged host pages to copy every row (one gated copy, one whole), as when
the log could not say which pages the GPU wrote. shadow-sync reports the runtime's own writes of
logged pages to their log after they ran (`dirty_pages.rs`), so the next copy in is gated to the
pages the fill wrote and none is whole. The test now expects that, and bounds the bytes copied to
the fill's rows and the pages they lie in; its texel checks (the fill reaches the read, rows 40 to 47
read 0x5a) are unchanged.

Verified: at d363fe79d2 on the RTX 5080 (b5080 entries in stack 33's gate and alone, 5 of 5) the
copy in was gated 1, whole 0, and every texel check passed; this commit's run follows on the 5080.
2026-11-05 14:58:09 -08:00
Anees Iqbal 5b539542f3 Re-bless the authored compile census at stack 33's build
The census on the stack 33 tree (corpus-triage --audit authored-compile, 2262 cases, 47502 cells,
49326 compiles, none cached) found no failed cell, no difference and no regression: 46395 compiled,
1107 refused, 327 uncovered. The XR attachments that now link (SEMANTICS_VERSION 1970) moved no
cell's outcome or SPIR-V digest among the authored cases; --bless wrote the table's artifacts_at line
at this build, whose product fingerprint moved. Slowest compile 1169 ms, peak worker RSS 230 MB.

Verified: the audit ran on the M3 (potluck m3-max-1968, then the bless m3-max-2030) with the main
checkout's private corpus; failed=0, differences=0, regressions=0.
2026-11-05 14:25:54 -08:00
Anees Iqbal 74718ec101 Re-record the conformance costs at stack 33's tree
The moved fields are the scheduler's passes, sleeps and host wakes, host-step head holds, spared
wakes and the object churn (buffers and images destroyed and evicted, a few buffers made and bound).
Shadows over tracked Private buffers that stand across command buffers and copy back plainly, quiet
alias keys, resident sets settled by change and XR attachments that link change how many shadow
images and staging buffers a case makes and evicts, and when the scheduler runs a pass. A whole-set
run (`conformance cost --runs 8 --write`) then a run of each changed case alone (`cost --runs 8
--alone --write`) re-recorded the 541 cases on the Apple M3 Max.

Verified: both runs exited 0 on the M3 (potluck m3-max-2006); the conformance suite and
`conformance cost --check` rerun on this tree.
2026-11-05 14:10:35 -08:00
Anees Iqbal d363fe79d2 Bump RUNTIME_VERSION to 1772: XR attachments link, quiet alias keys, resident sets settled by change, standing Private shadows
The runtime's behaviour changes in ways a stored runtime artifact can see: BGRA10_XR attachments the
fragment function leaves unwritten or masks in part link (xr-attachments, SEMANTICS_VERSION 1970); an
encoder skips the host-alias lookup for keys found quiet until the aliases' version moves
(aliases-quiet); a draw's resident uses are settled by the keys that changed and the geometry barrier
walks a resident prefix once (icb-stall-fix); a shadow over a tracked Private buffer of the
runtime's own stands across command buffers and copies back plainly, and dirty-page reports run
twice per command buffer (shadow-sync).

The runtime-sources pin is recomputed with pin-compute over this tree:
06a0b5f74979b749b659ed81ace79c25f30d82eefd06eeaefeeb8e5ddec004e7.

Verified: api-signatures, refusal-surface and conformance-coverage --check pass on this tree; the
gate's legs run after this commit.
2026-11-05 13:15:37 -08:00