Commit Graph
5842 Commits
Author SHA1 Message Date
Anees Iqbal 155f97fbfd RUNTIME 2352: Host RAM: an object moves the window to its chunk only once it holds it
RamOnDevice::chunk moved the device's thread's window to an object's chunk
(take + notify) before the object marked the chunk's import in flight. The
window's first slot is the chunk just taken, so the woken thread could find it
not imported and import it By::Ahead in the object's place: counted as imported
ahead and marked untaken, with the object waiting for that import at the
thread's pace (SCHED_BATCH on Linux, utility QoS on Apple). Off Linux the thread
does no fault-in before an import, so it reaches the claims lock at once; that
is the failure seen once on the Windows mini under nextest -j 4:
a_chunk_bound_buffer_and_a_copy_of_its_pages_order_by_their_host_bytes saw ahead
imports 3 where 2 were expected (chunks 0 and 2 by the thread, then 3 within
settled()'s 300 ms).

Now the window moves (RamOnDevice::took) once the object holds the chunk: found
made, marked in flight by it, or held back. The thread, woken by the move,
finds the chunk in flight or made and imports the ones past it.

Test: an_object_holds_its_chunk_before_the_window_moves_to_it holds the
object's call 300 ms before it holds the chunk (RamSource::taking_pause, a new
cfg(test) pause beside making_pause) and checks the object imported its chunk
and the thread one past it alone.

Evidence (lane jobs, msi): m3-max-32427: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0;
lavapipe 78/78 (host_ram_device, host_ram_copy_device, host_ram:: units) incl. the new
an_object_holds_its_chunk_before_the_window_moves_to_it and the original a_chunk_bound_buffer_and_a_copy_of_its_pages_...
Negative control m3-max-32428 (the take back at the top of chunk()): the focused test fails, "the object imported its
chunk, the thread not in its place: left 0, right 1". The Windows mini runs follow in the lane.

Lane commit: 10dfe36dce.
2026-11-15 07:31:27 -08:00
Anees Iqbal 891307e5ac known-gaps: RADV's linear alignments and the XR mipmap ties hold on PHOENIX too
The PHOENIX replay of 9c438c6b72 (the Radeon 780M, RADV PHOENIX; job
m3-max-32387) failed on 27 rows the ledger lists for "RADV NAVI31" alone, as
nothing replayed PHOENIX regularly:
- device-linear-texture-alignments, 16 formats: Metal 16 (0x10), ours 256
  (0x100) at case/<format>/Ok, the same 16 formats and the same answer as the
  NAVI31 rows. The cause is RADV's: the smallest power of two from 16 at which
  the driver lays a linear image at the asked pitch
  (texture/linear_alignment.rs asks it per image), 256 on both chips.
- blit-generated-mipmaps-bgr10xr levels 1-5 (803, 232, 58, 13, 3 words; largest
  differences 1048577, 1049601, 1049601, 1049601, 1025) and
  blit-generated-mipmaps-bgra10xr levels 1-6 (58, 78, 46, 18, 5 fields of
  largest difference 64; level 6 Metal 0x7d00, ours 0x7d40): the NAVI31 rows'
  counts and differences exactly, and llvmpipe's. The cause is the runtime's
  bilinear compute filter in the device's float at ties
  (device-filtered-mipmaps), whose IEEE f32 rule gives these counts on any
  venue that computes it so.

So the 27 rows' venue widens from "RADV NAVI31" to "RADV", and the alignment
rows' words name both chips' measurement. No row's words change cause; the
llvmpipe and Apple M3 Max rows are untouched.

Verification: the PHOENIX and XTX replays at this commit, in the job reports
that follow.
2026-11-15 07:25:55 -08:00
Anees Iqbal 4b06d19b5e conformance: blit-copy-indirect-command-buffer declares staged-indirect-records
On a device that places indirect command buffer records by their first use (no
unified memory, a staging queue), the copy case announces
staged-indirect-records, and the XTX replay read it as an undeclared notice
(development a88823f8f4, and still at 45e6784e91, which removed the staging of
records the GPU never wrote).

The remaining staged accesses are the host steps' reads of records the GPU
wrote. Each copy of at least one command is the first use of its destination,
which the case makes and touches nowhere before, so the blit's write places the
destination's records in device-local memory. The execution after it takes the
host step (the case already declares host-replayed-indirect-commands for it),
and that step reads the records the copy wrote while their command buffer holds
them, through the staging queue: the documented, announced degradation, which
cannot be avoided where the GPU wrote the bytes in device memory and the host
never maps it. On the Apple chips the recordings were taken on there is one
memory and the notice cannot fire, so it is the venue's memory model, as
shared-in-system-memory is.

Measured on the RX 7900 XTX (RADV NAVI31), the case replayed alone and
`conformance cost --show --runs 1` at 45e6784e91's runtime (cfcdb2978, job
m3-max-32363):
- copy: host_steps_recorded 3, icb_records_staged_accesses 3 (the legs
  range-one-at-0, range-one-at-2 and range-whole; indirect_record_bytes_gpu_copied
  13488 = 6 commands of 2248 bytes), indirect_record_runs_read 1 (the
  range-none leg's commit read, in place);
- reset: host_steps_recorded 3, no staged access (its buffer is the CPU's
  first, so its records lie in host memory).
So every staged access is a host step's read of GPU-written records, and none
reads records the GPU never wrote.

The declaration: replay::staged_records_notice, beside shared_memory_notice,
with the venue's-memory-model reasoning, and the copy case names it alone
(Call::places_its_records_on_the_gpu), with a comment citing the run. It
loosens the notices site alone; every value still compares exactly. On unified
memory (the M3 Max, PHOENIX, lavapipe) it cannot fire and counts as a
declaration nothing on that run justifies, as shared-in-system-memory does
there.

Verification: in the job reports that follow (the XTX and PHOENIX replays).
2026-11-15 07:17:01 -08:00
Anees Iqbal b1eaad49c7 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-15 07:16:31 -08:00
Anees Iqbal 0ca24685d7 RUNTIME 2351: Textures over buffers: Metal's allocation bound counts the last texel, a heap's size and a no-copy buffer's pages
A texture over a buffer whose texels run past the length was answered nil
where its rows' padding ended past the length rounded up to 16 KiB. The
M3 Max (macOS 27.0.1, the consumer's limits runs, every buffer kind and
length bisected) makes more:

- A 2D texture and a texture buffer count to their last texel, not the
  last row's padding: a 2D R32Uint 64x64 from 256, rows 512 apart, over
  20000 bytes is made with its last texel at 32768 (rows' end 33024); a
  texture buffer of 32768 R8Uint texels at a bytesPerRow of 36864 over
  20000 bytes is made. Arrays keep their rounded slices' end.
- A heap's buffer is bounded by the heap's size, counted from the
  buffer's start, whatever its length or place in the heap (4 MiB heap:
  made to 4194304, nil at 4194305).
- A no-copy buffer is bounded by its pages: its pointer's offset in its
  16 KiB page plus its length, rounded up to 16 KiB, from its start
  (16384 bytes starting 4096 short of a page's end: made to 32768).

BufferFacts now carries the buffer's allocation (own, a heap's size, a
no-copy buffer's page offset), filled from Buffer::heap, host_backing and
contents; BufferFacts::allocation_end gives the bound. Buffers under
16 KiB keep no bound (the M3 Max answers nil past 128 KiB there, the x86
Macs make every end measured), and an array whose last texel lies inside
the length is still made: no new refusal.

Such a texture stays a copy, as before at the old bounds: a 2D texture or
array is a shadow image whose copies in and back go through its tail
(texture/route.rs Route::Past -> TextureShadowReason::PastLength,
announced shadowed-texture), a texture buffer's functions view its tail
(into_texture_buffer, staged-texture-buffer). The texels past the length
live in the tail, zero when made; the caller's bytes past a no-copy buffer
and a heap's other bytes are never read or written.

Tests: tests::linear_plan::a_texture_ends_where_metal_s_allocation_of_its_buffer_does
(each kind's and form's M3 boundary, made at it and nil one past; the
made rows past the old bound fail before this change); device tests in
buffer_tail_device (a heap's buffer to its 64 KiB heap's size, a no-copy
buffer at page offset 12288 to 32768, a padded 2D texture to its last
texel): made, every path reads and writes right, the buffer's CPU write
inside the length is read through the texture, shadow copies counted,
no other memory touched, one row more Metal's nil. docs/API.md's
accepted difference, REFUSALS.md regenerated.

Evidence (lane jobs, msi): m3-max-32369: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0;
linear_plan|buffer_texture 34/34 incl. tests::linear_plan::a_texture_ends_where_metal_s_allocation_of_its_buffer_does (the
M3's boundaries per kind and form, made at E, nil at E+1). m3-max-32370 (lavapipe): 13/13 buffer_tail_device + allocation
tests incl. a heap's buffer to its heap's size, a no-copy buffer to its pages, a 2D texture whose last texel ends at the
allocation: every path (get_bytes, blit, kernel) reads as made, writes coherent with the buffer's bytes inside the length
(shadow copies counted: such textures are shadows / staged texture buffers through their tail), neighbours untouched, one
row more Nil(PastAllocation). Negative control and the PHOENIX run follow in the lane.

Lane commit: 263219d515.
2026-11-15 07:15:50 -08:00
Anees Iqbal 58cbb48fca commands_recorded: a run of copies between the same two buffers is one vkCmdCopyBuffer
Since 43bb61c60e (RUNTIME 2344) consecutive copy_from_buffer_to_buffer calls between the same
two buffers with their destinations rising record one vkCmdCopyBuffer of a region each
(copy_run.rs), counted WorkCounts::buffer_copies_merged. runtime_lane::commands_recorded::
each_command_recorded_counts_once_by_kind still expected one call a copy, so it failed on the
XTX and PHOENIX in development round cc68beb2af-1115-0626 (xtx:lane 1/2, phoenix:lane 3/4):
"the fills' and copies' calls recorded: left [5, 0, 1], right [5, 0, 2]". Its two copies are
such a run (filled -> copied, word 0 then word 1), so it now expects one vkCmdCopyBuffer and
buffer_copies_merged + 1, and prints the merged count. The bytes checks are unchanged.

Test-only. Verification: the next development round's lane partitions (XTX, PHOENIX, 5080).
2026-11-15 07:14:17 -08:00
Anees Iqbal 7f429c8edb 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-15 07:13:22 -08:00
Anees Iqbal f59fa9b0b4 RUNTIME 2350: Host RAM copies: a chunk's ranges, the overlap check and the table in one pass, with no map lookup or sort a run for whole pages
record_host_ram_copy spent most of its encode on per-run bookkeeping (a profile of 8100
single-page runs on lavapipe, release, frame pointers): chunk_ranges' BTreeMap entry a piece, a
Vec and a sort a chunk (46%), in_imports' BTreeMap lookup a piece (14%), the scatter's overlap
check sorting every host range (14%), plan's BTreeMap entry a table entry (10%), and pieces'
binary search over the chunks a run (9%).

- touched_ranges: pieces of whole pages from a page mark their pages in a bitmap of their chunk,
  read back in order; only the other pieces (rows inside pages) are sorted. It gives the ranges
  chunk_ranges gives, byte for byte (so every use and barrier is as before), and whether two
  pieces share a host byte, exactly: a page marked twice, another piece's bytes in a marked page,
  or two other pieces that overlap.
- in_imports looks a piece's imports up in a vector by chunk.
- plan buckets its entries by array of imports and window in a vector, in the same order.
- pieces looks for a run's chunk first where the piece before it lies.

Test: copy::tests::touched_ranges_are_the_chunks_ranges_and_their_overlap_in_one_pass (whole
pages, rows sharing a page, overlaps of each kind, and 2000 random mixes over four chunks, against
chunk_ranges and share_a_byte). Timings: see the lane's report.

Evidence (lane jobs, msi lavapipe): m3-max-32324: clippy cpuicd -D warnings 0; host_ram tests 93/93 incl.
copy::tests::touched_ranges_are_the_chunks_ranges_and_their_overlap_in_one_pass (byte-exact ranges and overlap flag vs
chunk_ranges + share_a_byte: whole pages, rows sharing a page, each overlap kind, 2000 random mixes over 4 chunks).
Release medians, one job m3-max-32339, parent's copy.rs vs this, 200 CBs of copy_runs_to_host_ram with 8100 single-page
runs, call CPU: 1 chunk 750.6 -> 351.1 us (92.7 -> 43.3 ns a run); 128 chunks 1523.7 -> 1097.6 us (188 -> 135 ns a run).
Uses and barriers unchanged by construction. 3090 run: m3-max-32374.

Lane commit: 6c02be1492.
2026-11-15 07:12:41 -08:00
Anees Iqbal ae2982cfdf 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-15 07:11:45 -08:00
Anees Iqbal f851c07e52 SEMANTICS 2123 / RUNTIME 2349: Texture buffers past maxTexelBufferElements bound through views of their parts
Metal makes texture buffers of up to 2^28 texels on every Mac; one texel
buffer view holds at most the device's maxTexelBufferElements (2^27 on ANV
and lavapipe, 2^26 on MoltenVK), and the binding of a wider one was refused
(BindError::TexelBufferTooLarge).

The consumer now states with a texture buffer's binding the views its texels
take (BoundTexture::Buffer::parts, bind::texel_buffer_parts: 1 within the
limit), which its shape carries. A slot whose function only reads, writes,
updates by an atomic or asks the width of the texture buffer, on a device that
indexes texel buffer arrays NonUniform, states RuntimeFact::TexelBufferParts;
where the shape binds more than one part there, the plan asks for the parts
variant (VariantKey::texel_buffer_parts). Under it the slot is an array of
the parts' texel buffers: texel i is texel i - k*P of part
k = min(i / P, parts - 1), P the device's limit rounded down to its texel
buffer offset alignment (bind::part_texels), and the width (parts - 1) * P
plus the last part's. texel_ranges writes one range per part at its array
element (DescriptorRange::element), and the runtime views each.

Each part is the device's own view in the format one view takes, so a read
converts its texel as the one view does: no precision note. A texture buffer
one view holds keeps one view, no variant and its key. The families row
TextureBufferWidth is exact where the parts reach 2^28.

Still refused (TexelBufferTooLarge): a slot read through a sampler or used beyond read/write/atomic/width; a device
without NonUniform indexing of that kind of texel buffer array; formats with several texels a block. Argument-buffer
texture buffers past the limit stay the heap neutral (unnamed-texture-unviewable). New: WorkCounts::texel_buffer_parts_bound,
RuntimeFact::TexelBufferParts (appended), bind::part_texels / texel_buffer_parts, BoundTexture::Buffer.parts,
TextureShape::Buffer.parts (serde default 1), VariantKey/LoweringInputs.texel_buffer_parts (hashed only when non-empty),
DescriptorRange.element. SEMANTICS_VERSION bumped: input once refused now translates.

Evidence (lane jobs, msi): m3-max-32343 at 628264de17: clippy --workspace --all-features --all-targets -D warnings 0;
41 metal2vulkan tests incl. golden_hashes_match_the_table (every fixture's SPIR-V unchanged on every profile: one part is
byte-identical), the binder test (an under-limit slot: no parts entry, empty variant, layout counts 1), the interpreter
parts test (robust and unrobust), api_surface / api_signatures / refusal_surface; families::states_follow_their_sources;
lavapipe texture_buffer_width_device (R32Uint limit+64 texels: both sides of the limit and the last texel read and written,
past the end reads 0 and writes dropped, texel_buffer_parts_bound +3) and buffer_tail_device. Without the fix the device
test fails at bind: TexelBufferTooLarge{elements 134217792, limit 134217728} (m3-max-32140). ANV (2^27) is down; the XTX
(2^29) never parts.

Lane commits: 9fbf7d3c14, 7f7f3ad95e, 9a745ffb3c, 740e9e43dd, 628264de17.
2026-11-15 07:10:59 -08:00
Anees Iqbal c9abbafd2f Queue-plan tests count the command queues' VkQueues, not the copy queue's
Since 43bb61c60e (RUNTIME 2344) a device with a copy engine (a transfer-only family of at
least 2 queues: NVIDIA) lists the copy queue's slot last in DeviceShared::queues. Two tests
counted every entry after the round robin as presenting queues, so on the RTX 5080 (development
round cc68beb2af-1115-0626, job 5080:runtime) they read the copy slot as one more:
- least_queue_plan::a_device_refused_once_takes_its_least_plan_where_it_takes_fewer_queues:
  (1, 1) where the least plan is (1, 0);
- queue_limits_device::a_default_test_device_fails_where_its_work_needs_the_plan: 3 VkQueues
  for command queues where the test limits allow 2.
On NVIDIA's 2-queue copy engine the copy slot shares the fill queue's VkQueue, so the device
asked for no more queues; only the count was wrong. Both now count round_robin() +
presenting() (DeviceShared::presenting already leaves the copy slot out). lavapipe, the XTX and
PHOENIX have no copy engine by default, which is why only the 5080 leg showed it.

Test-only. Verification: the next development round's 5080 runtime partition.
2026-11-15 07:04:48 -08:00
Anees Iqbal 281fc9b40b 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-15 06:59:16 -08:00
Anees Iqbal 45e6784e91 RUNTIME 2348: ICB records the GPU never wrote are read in place, not staged
On a device that places indirect command buffer records by first use (no
unified memory, a staging queue), a host access of records in device-local
memory was staged whenever a command buffer held them or the buffer was
Private: the records it read were copied down through the staging queue and
waited for, counted, and staged-indirect-records announced. That held even
where the GPU never wrote the records, though then the host's buffer holds
exactly what device-local memory does.

The XTX conformance replay of development a88823f8f4 failed on it:
blit-copy-indirect-command-buffer announced staged-indirect-records. Its
range-none leg copies no commands into a fresh destination (an empty copy
holds nothing and marks nothing written), then executes destination command 0.
The execution's hold placed the untouched records in device-local memory, and
the commit, which records the execution from the CPU's records because no GPU
route met the buffer, read them through host_access while its own command
buffer held them: staged. The cause dates from 5dd3668a4f (RUNTIME 2294,
placement by first use); the last green XTX replay (06fd49b221, 11-11)
predates it, and the case's recording did not change.

Now host_access serves an access that only reads (Reach::Reads) records the GPU
never wrote (State::written false) in place: not staged, not counted, nothing
announced. A write of such records is still staged, for its copy back alone:
it no longer copies the runs down first.

Why the two sides cannot differ while written is false:
- placement (place_on_device) fills the device-local storage with zeros and
  writes encode_header's header, which is what the host's storage holds as the
  buffer is made (write_header: CommandBuffer::initialize's header and reset
  records, flags cleared; the reset record is all zero,
  metal2vulkan's indirect_commands/tests/records.rs
  reset_clears_action_and_bindings_to_zero). A Shared buffer the CPU touches
  before any GPU use is placed on the host for good; a Private one is placed on
  the device at its first host access, before that access writes.
- every CPU write of the records goes through records_access with
  Reach::Writes or Reach::Overwrites (reset_command, batch, the CPU reset), and
  while the records lie in device-local memory that access is staged with
  back = true, whose drop copies the written runs (records and written flags)
  back into device-local memory: home.rs line 222,
  `copy_runs(self.icb.generation(), records, host, &self.runs, false)`.
- every GPU route that writes the records holds them with writes = true, which
  sets written (home.rs line 320, `state.written |= writes`): a blit's copy and
  reset, and a compute or render encoder's use_resource with WRITE.
The move path already relied on the same fact (a move of a buffer the GPU never
wrote copies no bytes).

The conformance case needs no declaration: the notice was the runtime staging
where it need not.

Also: the runtime-lane test private_indirect_records_follow_the_memory_model
expects two staged accesses (its two setters), its getter now reading in place;
the docs of home.rs, Degradation::StagedIndirectRecords (and its cost),
WorkCounts::icb_records_staged_accesses and docs/API.md's catalogue entry say
which accesses stage. No new Degradation kind, no new counter.

Verification: in the job reports that follow.

Evidence so far (lane jobs): msi m3-max-32246 at cfcdb29780: the conformance binary and the m2v_gpu archives built; the
lavapipe replay (conformance replay --cpu) matches known-gaps.tsv (LVP_REPLAY=0). gem10 m3-max-32248: clippy -D warnings
plain, m2v_gpu and m2v_cpu_icd on runtime + validation = 0. The XTX replay and the new device tests (with the control at
76a78ec60a) follow in the lane's um790 job.

Lane commits: 76a78ec60a (tests), cfcdb29780 (fix).
2026-11-15 06:58:33 -08:00
Anees Iqbal 374a9207a0 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-15 06:57:44 -08:00
Anees Iqbal 7aff494cc4 RUNTIME 2347: Command buffers take the state a released one left, reset by its release
CommandQueue::command_buffer allocated and filled a fresh 5.8 KB State for
every command buffer (86% of CommandBufferShared's 6.7 KB), on the thread
that makes it, and took a record storage from the device's pool apart. The
thread that frees a command buffer is never the thread that made it, so
the allocator could not recycle the block locally and every line of the
copy was a cold write. A profile of 200,000 command buffers made on
lavapipe (make_bench) put CommandBuffer::new at 62% of the make,
building and moving the state about 30% and record_storage.take 9%; the
consumer's Iris profile put the allocation, the copy and the record
storage take at about half of 5.1 us a command buffer.

Now CommandBufferShared::state is an Arc<Mutex<State>>. Its Drop resets
the state in place, reached through Arc::get_mut and Mutex::get_mut (only
the command buffer holds it, so no lock): State::reset destructures an
owned State::new() exhaustively, by value, and assigns each part, while
the four lists of records are cleared where they are, keeping their room.
The compiler holds the reset to every field. The Drop then hands an
Arc::clone of the state to the device's SpareStates (in DeviceShared,
freed with the generation), which keeps at most 64, none whose lists hold
past 8 MiB and 16 MiB over all. A command buffer being made pops one
whole, with the footprints revision it moves; it builds one only where
none is kept (WorkCounts::command_buffer_states_made, new). This replaces
SpareRecordStorage, and with it State::record_storage's three
mem::takes. Nothing is moved out of a borrowed owner.

The state's parts now drop at the release, inside the Drop, before the
command buffer's device, queue and root handles go (before, after them);
its slot still goes after.

Tests (tests/spare_states.rs, device tests): a command buffer made after
another's release takes that very state and builds none; a kept state of
a failed, labelled command buffer with a kept refusal carries none of it
to the next one, whose own fill runs; 80 released at once keep 64, and a
command buffer past 8 MiB of list room keeps none. make_bench prints the
states built.

Evidence (lane jobs, msi): m3-max-32266 at 6e4c8a8723: clippy -p metal2vulkan-runtime --all-targets --all-features
-D warnings 0; lavapipe 134/134 touched tests (spare_states, dropped_uncommitted, freed_memory, encoder_fold, render_fold,
command_buffer, completion, sync_file, teardown_threads, ...); negative control (SpareStates::give refuses every state):
all 4 spare_states tests fail. Release medians, one job m3-max-32278, base 5266f9fa59 vs tip, base/tip/base/tip:
command_buffer() p50 one encoder 955/927 -> 319/291 ns, empty 902/986 -> 405/359 ns; means 1027/993 -> 408/409,
1126/1215 -> 579/522; made-to-committed p50 one encoder 5448/5469 -> 5022/4965 ns; states built 0-2 of 20,000.
Not measured yet: the release side (the reset on the releasing thread), a GPU device A/B (XTX/PHOENIX next; Iris when
its node is back).

Lane commits: 5266f9fa59 (make_bench), e91d54e0fc, 6e4c8a8723 (cfg-gated assignments in blocks).
2026-11-15 06:56:54 -08:00
Anees Iqbal 61b3da253d 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-15 06:48:55 -08:00
Anees Iqbal b7053280de RUNTIME 2346: 4:2:2 textures over IOSurface planes: an image of their texels, decoded from the pairs in place
A GBGR422 or BGRG422 texture made over a buffer's bytes (Buffer::new_texture_with_iosurface_plane,
a CoreVideo 2vuy or yuvs plane, over a Shared buffer or a no-copy buffer's host pages) had no
decoded twin: twins are attached only to textures whose image is their own for good, so every
dispatch or draw that read or sampled it was refused, with a "needs R8G8B8A8_UNORM SampledImage"
line naming a format every device samples.

Such a texture is now an R8G8B8A8_UNORM image of its texels, the converted shadow a two-plane
YCbCr texture over planes already is (ShadowSource::Converted, its conversion now an enum of the
planes' and the pairs'): its copy in, before the first command of a command buffer that reads it
and after a command wrote the bytes, is one dispatch of the new bind::chroma_convert_module that
reads the pairs where they lie, at any byte of their VkBuffer, through one storage-buffer binding,
and writes Metal's texels (ChromaDecode, exact) through the image's R32_UINT view. Copies, blits
and CPU calls keep moving the plane's bytes. Where the device converts the pairs' format with
Metal's reconstruction (MoltenVK), the copy in is that conversion instead: the plane's rows copied
into the pairs' image, sampled through the conversion (chroma_sample_module) into a scratch,
copied into the image; announced decoded-texel-precision at the copy in's planning. The set binds
the buffer's VkBuffer, so the planning makes it again after a rebind gave the buffer another one,
and each command buffer holds the set it took. The placement query answers OtherShape. A plane
the window cannot take (past maxStorageBufferRange, a last word past the buffer, rows that share
bytes, texels past the buffer; with the device's conversion, a first byte or rows off 4 bytes)
keeps the carrier, its reads refused; FAST-PATHS records it as a known gap.

Per frame, per texture (w x h texels): before, no read ran at all; the texture was an R8G8_UNORM
carrier of the plane, 2 bytes a texel. Now no byte is copied: one dispatch reads the w*h*2 bytes
of pairs in place and writes w*h*4 bytes of texels (1920x1080: 4147200 read, 8294400 written).
Memory: one R8G8B8A8_UNORM image, w*h*4 bytes (1920x1080: 8294400), in the carrier's place; with
the device's conversion also the pairs' image (w*h*2) and the scratch (w*h*4), and per copy in a
w*h*2 copy in and a w*h*4 copy out. Announced carried-decoded-twin (an existing kind) with that
cost. No new Degradation kind, no new WorkCounts field.

A carrier's binding without a twin is now refused NotImplemented(Format) naming the texture's
format (pvrtc::holds_for_copies), not a need of the twin's view format.

Public surface: metal2vulkan::bind::{chroma_convert_module, ChromaConvertModule} added
(api_signatures.tsv blessed, api_surface table); docs/REFUSALS.md regenerated (one more
binding_view site of Format).

Tests: the in-place kernel against ChromaDecode's decode under the interpreter (both orders, first
bytes off a word, odd sizes, rows apart); a carrier's binding refusal (binding_view unit test);
a device test of both formats over a Shared buffer and over host pages reading Metal's measured
bar values (an Apple M3 Max, macOS 27.0.1) and Metal's decode of a random frame written on the
CPU before the next command buffer, OtherShape from the placement query, and the device's
conversion counted and announced where it converts. Verification jobs follow in the lane report.

Evidence (lane jobs): msi m3-max-32240 at 94f603bf35, --cfg m2v_cpu_icd on llvmpipe: 130/130 touched tests, clippy -D warnings 0;
the device test fails without the fix (placement not OtherShape, the read's dispatch refused). PHOENIX gem10 m3-max-32260
(archive m3-max-32241): all 4 cases (GBGR422/BGRG422 over a Shared buffer and over host pages) "Metal's texels, exact"
for the M3's measured bars and a random CPU-written frame; ycbcr_device, ycbcr_refresh, twin_reads 7/7. MoltenVK (device form)
run on the M3 follows.

Lane commits: 735234d5f4, d59f44baa6, 94f603bf35.
2026-11-15 06:48:09 -08:00
Anees Iqbal 675912b3ad 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-15 06:44:08 -08:00
Anees Iqbal ef64727c7a RUNTIME 2345: Host RAM: a first gather over bytes some use may write is staged in a part of its own, never through imports made or waited for on the encoding thread
stages() staged a gather over chunks the device's thread imports only where no use but a
copy's read may write its host bytes (RamOnDevice::written_over). That holds for the whole copy
as soon as one chunk it touches had a scatter recorded (copy_wrote, never cleared) or a buffer
over host pages lies over its bytes, so a first fill over a fresh RAM after any download into one
of its chunks took the imports' path: for_copy imported each chunk not imported yet on the
encoding thread (the ahead plan imports no range alone). A consumer's decoder waited 1.73 s
for 124 such imports on an RTX 3090 (each pins 64 MiB of fresh pages).

Such a gather is now staged as one over a chunk that takes no import is when written: in a part
of its own (Staging::after_the_gpu), its host step after the work before it in its command buffer
completed, on the steps' thread. Its encoder keeps no log (an encoding again through the imports
would start no part, so its parts would not be the first's). Docs: copy.rs, deferred.rs,
docs/HOWTO.md.

Tests: host_ram_copy_device::a_first_gather_over_chunks_a_scatter_wrote_waits_for_no_import (a
scatter then a gather in one encoder over two chunks not imported, the thread's imports held in
flight): the gather is staged, waits for no import, imports no range, reads the scatter's bytes;
two later fills of its pages (a later encoder, a later command buffer) land after its read.
Benches (ignored, release): host_ram_first_fill_spread_bench, host_ram_layer_encode_bench.

Evidence (lavapipe, msi): negative control m3-max-32190 (the test against the parent's copy.rs
fails: not staged, 600 ms waiting on two paused imports); with the fix all 92 host_ram tests pass
(32190); clippy cpuicd -D warnings clean and the extended test pass at the tip (32210). First-fill
bench after a 1-page download: before staged 0, 121 chunks imported on the encoding thread, call
1369 us (32174); after staged 1, 0 import waits, 0 chunks imported by the copy, call 328 us (32210).
The 3090 run follows.

Lane commits: e70fea0886, f50ee551c3, 9e74f43df1, ab6d8af756.
2026-11-15 06:43:15 -08:00
Anees Iqbal cc68beb2af host_ram_device: the window assertion names the chunk counts and the import tax
A Windows run (UHD 630) failed it with no more than the two ahead counts; the
message now carries what the device's thread did between them.

Verified: cargo fmt; the run follows on the Windows node.
2026-11-15 06:24:26 -08:00
Anees Iqbal 08ae84505e teardown_threads: the queue-switch check's test states its release at the RTX 2080's usual speed
The measured split behind the previous commit's bound (the teardown's wait for the stopped
check, less the release of its Vulkan objects), on the RTX 2080 (NVIDIA 620.70.06):

- Pin 99, run alone, its host making driver calls three to four times slower than usual
  (um790 job m3-max-31777): wait 33.1 / 23.3 / 19.8 ms, release 19.6 / 22.0 / 18.4 ms,
  difference 13.6 / 1.3 / 1.4 ms. The old bound failed all three.
- After the Thunderbolt replug and the reboot, the old test passed in the exclusive GPU-time leg
  (m3-max-32075, 18/18; it printed no split, as it passed).
- This branch's test, 5 runs on the same card (m3-max-32110): wait 6.5 / 1.7 / 4.7 / 5.1 /
  1.9 ms, release 4.5 / 1.6 / 2.7 / 3.5 / 1.7 ms, difference 2.0 / 0.13 / 2.0 / 1.7 / 0.13 ms.

So the release scales with the host's driver speed. Those destroy calls must precede
vkDestroyDevice (VUID-vkDestroyDevice-device-05137) on whichever thread makes them; they are not
the check's stop, which the 16 ms bound is for.

Controls in the same job, a diagnostic build of this branch (not for landing) that sleeps 20 ms
in the check: inside its timed release, the test passed with a wait of 26.8 ms (release 24.4 ms,
difference 2.4 ms), a wait the old bound would have failed; in its stop path (after its hold,
before it reads that the teardown began), the test failed: wait 24.5 ms, release 2.8 ms,
difference 21.7 ms. So the bound still catches a check that is slow to stop.

What changes: the test's doc adds the usual-speed numbers beside the slow host's.

Verified: cargo fmt; the numbers are from the jobs above.
2026-11-15 06:13:08 -08:00
Anees Iqbal a59f80573e teardown_threads: the queue-switch check's teardown wait is bounded less its objects' release, which is printed beside it
a_running_queue_switch_check_leaves_the_device_to_the_program_s_thread failed on the RTX 2080
(NVIDIA 620.70.06) at pin 99, run alone (um790 job m3-max-31777): the teardown waited 33.1, 23.3
and 19.8 ms for the stopped check against RELEASE (16 ms), of which the release of the check's
Vulkan objects took 19.6, 22.0 and 18.4 ms and the drop of its shares 3-5 us. The wait less the
release was 13.6, 1.3 and 1.4 ms. At that time that host made driver calls three to four times
slower than usual. The same test passes on the RTX 3090 (same driver), the RX 7900 XTX and the
Radeon 780M.

Why the bound changes (the measured split above): the wait (QueueSwitch::stop) covers the test
hook's release (a 1 ms poll), the check's wake and the end of its step (none here: it is held
between rounds), then Objects::release: eleven destroy calls (three timelines, three fences, the
timestamp pool, the scratch buffer and its memory, the command pool of 97 command buffers),
through the validation layer this test's device enables. Those calls must precede
vkDestroyDevice (VUID-vkDestroyDevice-device-05137) on whichever thread makes them: moving them
to the teardown's own releases after its wait for idle would leave the last drop just as long
(5.1 s, 632 ms and 589 ms in those runs). They are driver time, not the check's stop, which is
what the 16 ms bound is for: that the teardown waits for at most one step of the check, never
for its run. The bound now applies to the wait less the objects' release (timed by the check,
QueueSwitch::last_steps), and the test prints the wait, the release, the shares' drop and the
difference, as queue_order's bounds take the driver's vkQueueSubmit time out. No product change.

Verified: see the lane report (the RTX 2080 job).
2026-11-15 06:12:26 -08:00
Anees Iqbal 74e6846f93 runtime device tests: detach_lost's pages through the host helper
Verified: Windows clippy under --cfg m2v_cpu_icd at 4854552866 (job m3-max-32077)
listed this module's libc calls only; under m2v_gpu it passed.
2026-11-15 06:10:51 -08:00
Anees Iqbal 3c78564977 runtime device tests: the unix-only exportable-buffer parts' imports and constants gated
Verified: Windows clippy under --cfg m2v_gpu at eb6fb128a8 (job m3-max-32067) listed
these errors only; Linux clippy under m2v_gpu and m2v_cpu_icd passed there.
2026-11-15 06:10:51 -08:00
Anees Iqbal 38b301e1ed runtime device tests on Windows: host pages, protections and CPU times through one helper
tests/host_os.rs gives the device tests fresh private and shared pages (a memfd on
Linux, anonymous shared memory on the other unix hosts, a section view on Windows),
their release and protection, the page size and CPU times, so the host-memory and
host-RAM device tests build and run on Windows under --cfg m2v_gpu. copied_device's
read-only host is a section with a writable and a read-only view on Windows, and its
read-only-copy tests run there; a new test checks that no-copy buffers over private
and shared pages are imported in place where the device takes them. shared_pointers
runs on every host and expects Intel's Windows driver to import a section view. Tests
of unix-only items (exportable buffers, dma-buf hooks, memfd guest RAM) stay unix-only.

Verified: cargo fmt; Windows and Linux clippy follow as jobs.
2026-11-15 06:10:51 -08:00
Anees Iqbal 55ff518295 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-15 06:10:02 -08:00
Anees Iqbal 43bb61c60e RUNTIME 2344: Runtime: a command queue on the copy engine, and buffer copies merged into runs
Device::new_command_queue_for_copies() answers a CommandQueue whose command
buffers submit to the device's copy engine (the staging queue's family of
transfers alone), or None where the device has none to give (MoltenVK,
lavapipe, RADV by default, a copy engine of one queue, an adopted device).
Its VkQueue is the copy engine's third queue where it has one, else the fill
queue's, whose submissions then take that QueueSlot's lock: NVIDIA's copy
engine has two queues, staging's and fill's, and staging must wait for no work
in flight. The slot is the last of the device's VkQueues, after presenting's;
its family stays out of image sharing (buffers already share it as the staging
queue's family, so no ownership transfer is recorded).

Its command buffers take blit encoders alone, and of their commands buffer
copies, fills and fences: other encoders and blit commands are refused
(Invalid, Problem::CopyQueue(CopyQueueProblem::Encoder | Command)), as is a
caller's VkBuffer not concurrent with the copy family (Buffer). A copy batch
takes buffers' fills alone from first work. Barriers on its VkQueue name the
copy family's reads (Barrier::record_reading), not the primary family's, which
a family of transfers alone may not name beside ALL_COMMANDS
(VUID-vkCmdPipelineBarrier-dstAccessMask-02816).

A blit encoder's consecutive copy_from_buffer_to_buffer calls between the same
two VkBuffers that its order needs no barrier between are recorded as one
vkCmdCopyBuffer of many regions (copy_run.rs), on every queue; counted as
WorkCounts::buffer_copies_merged. Batches on the copy slot are counted as
WorkCounts::copy_queue_batches.

Verified: not yet built (first build job follows).

Also in this landing:
- Copy queue: docs, and the device test's None answer checked against the device
- Copy queue: keep the copy queue's place alive while the families are counted

Evidence: lavapipe 425/425 (m3-max-32049), clippy m2v_cpu_icd and m2v_gpu -D warnings (32049, 32053); XTX m3-max-32073: default RADV answers None; RADV_PERFTEST=transfer_queue: 1 batch on the copy engine, 63 of 64 row copies merged, sync file signalled, bytes right, refusals typed, validation layer silent.
The derived API table and docs/REFUSALS.md were re-derived on the merged tree (winport's #[cfg(unix)] gates landed beside copyq).
2026-11-15 06:09:09 -08:00
Anees Iqbal 4c8ca3e4b4 queue_order: the single taken-up test times the scheduler's thread from the holder's let-go, its wait for a core apart
a_checked_command_buffer_committed_during_a_submission_is_taken_up_promptly still noted the
VkQueue's release before it sent the release to its holder thread, so the holder's own wake (it
must get a core to unlock: measured up to 40.7 ms after the release under 16 busy loops on the
RX 7900 XTX, m3-max-31893) was charged to the scheduler's thread against the 40 ms bound, and
its measure ran to the left command buffer's kernel start, past the instant where the driver's
time was read, so a wait for a core after its check counted too.

What: the test now takes the timing d25f77ecb1 gave its sibling
checked_commits_during_submissions_are_taken_up_promptly, through the same helpers, which move
into one place: the holder (`Held`, which both rounds and the commit-order test now use) notes
the instant it lets go of the VkQueue as its closure's last step, with the scheduler's thread's
schedstat (`Freed`); the left command buffer's take-up is noted by its submission handler on the
thread that took it (`carried`, `Noted`), and the bound applies to the take-up less the longer of
the driver's vkQueueSubmit time and the thread's run-queue wait over that same span (`own_time`,
`Noted::since`). Its kernel start and submission are printed, not bounded, as the sibling prints
them. The test also begins once the device's submission checks answered
(Device::settle_submit_checks), as the sibling has since 88ed42fc2a, for its reason: a lane
device's checks run on its first VkQueue as it is made, holding that VkQueue's lock for calls
batch_submit_nanos does not count, and this test's one round is the earliest there is. Each run
prints a TAKEN-UP-ONE line with the split. `in_driver` and `noting` had no other user and go.

Verified: see the lane report (the RX 7900 XTX job: 5 runs alone, and the old and new binaries
under busy loops pinned with the test to the same cores).
2026-11-15 06:02:11 -08:00
Anees Iqbal c7d3c434fb 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-15 05:50:16 -08:00
Anees Iqbal 0bede1683a Windows: the dma-buf gauge accessor and the Source refusal's test pair on unix alone
Verified: Windows clippy at 3d6ba0eff5 (job m3-max-31991) listed these two errors only.
2026-11-15 05:49:35 -08:00
Anees Iqbal a3b38034d5 runtime README: Windows
What the runtime asks Win32 for on Windows (VirtualQuery and GetSystemInfo for host
pages, the performance counter and its calibration domain, GetThreadTimes, the C
runtime's atexit, the default shader cache directory), how section views are imported,
and the fd items absent there. docs/REFUSALS.md is unchanged (refusal_surface.py --check
passes): no refusal or RuntimeGap was added.

Verified against the code at this commit; no Degradation kind added.
2026-11-15 05:49:35 -08:00
Anees Iqbal de2921df91 Windows: unix-only counters and the dma-buf source refusal gated; residency's pointer form without a lazy closure
The counters of dma-bufs, sync files and fd budgets that only unix code calls, and
in_place's Refusal::Source (made only from a caller's dma-buf source), compile on unix
alone; leaves_rows names the two refusals that keep the rows instead of listing the rest.
Again::pointer returns early so that its Windows form has no closure for clippy to flag.

Verified: Windows clippy at cd6973f432 (job m3-max-31977) listed these errors only.
2026-11-15 05:49:35 -08:00
Anees Iqbal 6267d10c6f CI: clippy of the published crates and devtools for Windows, on Linux
x86_64-pc-windows-gnullvm (the primary Windows target) and x86_64-pc-windows-msvc, with
--all-targets --all-features and warnings denied. Clippy links nothing, so the Linux job
needs only the two targets' standard libraries. AGENTS.md's CI paragraph names the step.

Verified: the same clippy lines ran in potluck jobs on Linux (msi) for both targets.
2026-11-15 05:49:35 -08:00
Anees Iqbal 402135752b Windows: the remaining unix-only imports, the exportable event check and fd tests gated; docs say Windows asks too
dma_buf.rs's exit-guard and release imports, EventShared::carry's check of an exported
semaphore and the memory tests of dma-buf and fd placement compile on unix alone.
The docs of refuse_unwritable's callers now say Windows asks the system as Linux does.

Verified: Windows clippy (gnullvm, msvc) at a571e90d9d reported these errors only.
2026-11-15 05:49:35 -08:00
Anees Iqbal adb6f3c93c devtools: the tool runner's test module on unix hosts only
Its one test runs /bin/sh; on Windows the module held only an unused import.

Verified: Windows clippy (gnullvm and msvc, --all-targets) reported this as the
only error at 438f0c42cb (job m3-max-31946).
2026-11-15 05:49:35 -08:00
Anees Iqbal 3369c52a3c Windows: dead fd/dma-buf helpers unix-only; examples' pages and CPU times on Win32
The fd and dma-buf helpers, fields and test hooks that only unix code reaches are
compiled on unix alone, so the Windows build carries no dead code. The examples'
anonymous pages use VirtualAlloc/VirtualFree/VirtualProtect on Windows and their
thread and process CPU times GetThreadTimes/GetProcessTimes.

Verified: cargo fmt; the Windows and Linux clippy rounds follow as jobs.
2026-11-15 05:49:35 -08:00
Anees Iqbal a9dce911e7 Known gaps: drop the first commit's translation; held_step_order's numbers from a release build
9aadbdf281 rewrote the known gap from the test profile's numbers. A release build of the same
test on the same idle Radeon 780M (RADV PHOENIX, m3-max-31944, 2 processes x 3 runs) puts the first
commit of a host-step pass, which translates the variants its step draws with, at 4.5 and 5.4 ms,
and a later one at 0.11 to 0.19 ms; the unoptimized test build takes 23 to 25 ms and 1.0 to 1.3 ms
there. Nothing measured holds a guest's commit past a frame's 16 ms any more: the 406 and 10.5 ms
were the test build inside a suite that loaded the host's cores. So the known-gap row goes, and
CHANGELOG's known-failing line names only the teardown test. The test's COMMIT doc carries the
release and the test build's numbers.

Docs and a test comment only. Verified: the numbers are m3-max-31944's printouts.
2026-11-15 05:45:35 -08:00
Anees Iqbal a88823f8f4 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-15 05:39:49 -08:00
Anees Iqbal 88873b27e1 frame_costs: the debug draw bound's note states the kept checks' schedule and the new measurement
The draws of a build with debug assertions no longer build the whole bind shape at each draw
(kept_checks.rs, the commit before): runtime_lane::frame_costs measured 6.24 allocations a draw
on lavapipe (llvmpipe, LLVM 23.1.1) in m3-max-31921 on msi, against the 17.88 its note stated.
The bound (20) stays; the note says what the checks do now.
2026-11-15 05:39:05 -08:00
Anees Iqbal d4846e710b Debug builds check a draw's kept values at their first uses and at powers of two
Builds with debug assertions re-derived four kept values of a render draw at every draw and
compared them with the kept ones: its used resources (refresh_bind_state), its bind shape
(LiveBind::shape, kept and recent paths), its uses of what its encoder made resident
(binding::command_uses_into) and its heap part (render/heap_part.rs). Each is a walk of everything
the encoder made resident, so a recording of n draws over r resident resources walked them n
times in those builds alone.

That is what made runtime_lane::kept_textured time out on the RX 7900 XTX under the suite (pin 99:
two TimedOut at kept_textured.rs:155 after 60 s; pin 93b: all five, with a host step still
recording at exit). Its page is 512 draws over 2048 resident resources (1536 buffers, 512
textures). Measured on the XTX (RADV, Mesa 26.2.6), a host step of those 512 heap draws, alone:
- 2.9 to 3.5 s with the validation layer, 3.0 to 3.2 s without it (VK_LAYER_PATH at an empty
  directory, the device made with no layer): the layer's share is about nothing;
- 140 to 177 ms in the same unoptimized build without debug assertions
  (CARGO_PROFILE_DEV_DEBUG_ASSERTIONS=false), the five tests 1.3 to 2.1 s each against 10.7 to
  14.7 s: the debug-only checks were about 95% of the step;
- of 205 samples of the steps thread at 20 Hz (gdb): HeapPart::check 40%, LiveBind::shape's
  checks 27% (kept 19%, recent 7%), command_uses_into's whole uses 8%, refresh_bind_state's used
  resources 7%.
Beside a suite slice (load 10 to 16) the same steps took 5 to 11 s; with three suites on the
node's 16 threads one passed the test's 60 s wait.

Each of the four kept values now keeps a debug-only count of its uses since it was worked out
(kept_checks::KeptChecks) and is checked at its first 8 uses and then at each use whose count is a
power of two, so a recording walks the resident resources 8 + log2(n) times for each kept value. A
kept value that is wrong stays wrong until a change works it out again, so one that goes wrong
after its first uses is still caught within twice the uses it took (render/draw_again.rs already
checks every second draw again). A found bind shape is still checked at each find. Builds without
debug assertions are unchanged: they compiled none of these checks.

Test: tests::resident_uses::kept_values_are_checked_at_their_first_uses_and_at_powers_of_two
draws 40 draws over one residency and counts 11 kept resident-use checks and 11 kept heap-part
checks (uses 0 to 7, 8, 16 and 32); before this change both counted 39.
2026-11-15 05:39:05 -08:00
Anees Iqbal 9aadbdf281 held_step_order: time Scheduled from the commit's return; hold the commit call to a frame
command_buffers_behind_a_waiting_step_read_scheduled failed 3 of 3 on the Radeon 780M (PHOENIX)
inside the whole device suite (m3-max-31782): the long command buffer's commit returned 405.95,
23.66 and 10.50 ms after its call, and the test bounded the call plus the scheduler's pass to
`Scheduled` by 10 ms together. Scheduled itself came 19.6, 1.6 and 2.3 ms after the commit
returned: the ordering the test is for held.

What holds the call (probes m3-max-31832 and m3-max-31876, gem10's 780M idle, step marks in the
commit path): no pipeline wait (commit_pipeline_wait_nanos 0) and no lowering; Recording,
Deferred::prepare of the host-step pass. Its first commit translates the variants the step draws
with on the program's thread (DeferredPass::settle: the step's buffer forms and the fan-out's,
the route's replay variant; record_on_gpu's decision and, once a device, the notice's rules past
its cause): 24.1 / 23.7 ms cold, 49.8 in an earlier run. A later commit finds them made: 1.0 ms
(2.4 in the earlier run), about 30 lookups of 5 to 35 us, no single repeated item. The suite on
the host's cores stretched the same work about tenfold. The translation cannot move earlier
(whether the pass is a host step and its route are decided at the commit) nor off the program's
thread (the device keeps only what the program's calls make, in its order).

So the test's one bound mixed two properties. Now:
- `Scheduled` is timed from the long commit's return, still within 10 ms (the long work ends
  100 ms or more after it);
- the commit call is asserted apart, by its own clock (WorkCounts::commit_nanos), within a frame's
  16 ms in one of the runs at least (the later runs are warm), the test's own work_counts()
  snapshot outside the timed span.

docs/FAST-PATHS.md's known gap is rewritten to what is measured (the first commit of a host-step
pass translates its step's variants, why it stays there), and CHANGELOG's known-failing line with
it.

Verified: see the lane's report (PHOENIX 5/5, negative control with a sleep in the commit path).
2026-11-15 05:36:51 -08:00
Anees Iqbal ab9103b213 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-15 05:25:19 -08:00
Anees Iqbal 673d542c39 Windows: the section probe's security feature; tests on Windows forms
- CreateFileMappingW is behind windows-sys's Win32_Security feature (its
  SECURITY_ATTRIBUTES argument).
- Unused-on-Windows bindings gated (NoImage, pointer_refused).
- Tests: the fork test of degradation.rs is unix-only; the host RAM window
  tests take their untouched address space from one helper (mmap
  MAP_NORESERVE, or VirtualAlloc on Windows); a Windows test of the
  calibration's domain (the performance counter's); and a Windows test that
  the exit hook atexit holds runs at exit before the handlers registered
  before it and closes the guard (a child process of the test binary, as
  tests::warm runs one; its handler ends it with 42 where the guard closed).

Verified: a step of the Windows check iteration (gnullvm, msi job). The
Windows tests are compiled, not run: no Windows node runs them yet.
2026-11-15 05:24:38 -08:00
Anees Iqbal b8bb06bcac Windows: host pages, clocks, thread times and exit hook through Win32; pointer residency on every host
Windows forms of the runtime's host facilities, through windows-sys:
- the host page (GetSystemInfo), the process's page permissions
  (VirtualQuery: mapped_readable, mapped_writable, and refuse_unwritable, so
  pages the process cannot write are a copy whose GPU writes are dropped, as
  Metal drops them, counted in host_mappings_queried), and section views
  (MEM_MAPPED) as shared memory for a guest RAM's plan;
- the runtime's own pages (fresh pages, the submission checks' and the
  in-place check's pages: VirtualAlloc/VirtualFree), so those checks run;
- the shared-pointer probe over a view of a paging-file section
  (CreateFileMappingW SEC_COMMIT + MapViewOfFile), as a VMM's Windows guest
  RAM is made;
- the fault-free read of caller pages (ReadProcessMemory);
- a thread's CPU time (GetThreadTimes);
- the host clock on the performance counter, calibrated against
  VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_KHR (gpu_time.rs: host_nanos,
  host_domain, Calibration::reading only);
- the exit guard's hook registered through the C runtime's atexit, one
  handler per kind, where the not(unix) arm registered nothing.

The idle release of pointer imports (host_residency) is structural, decided by
the device's submission checks, so its pointer form runs on every host; only
its dma-buf form is unix-only. A guest RAM's dma-buf sources are absent on
Windows (cfg(unix) builders; no source exists, so the RAM's dma-buf paths are
uninhabited there). Buffers report exported memory through memory_exported,
false where the system has no file descriptors to export.

Linux and macOS: the cfg(unix) residency gates removed are always true there;
in_place_check's host page now reads host_memory::host_page (sysconf), as its
own copy did.

Verified: a step of the Windows check iteration (gnullvm, msi job).
2026-11-15 05:24:38 -08:00
Anees Iqbal 4c6a29c409 Windows: dma-buf items unix-only; dirty pages, residency and rotation on every host
The runtime's first Windows check stopped at its module tree: dma_buf.rs
takes file descriptors (std::os::fd) unconditionally, while dirty_pages,
host_residency and texture/rotation were unix-only modules that every host's
code names.

- dma_buf.rs: every item that holds or makes a file descriptor (the
  sources, requests and chunks, the imports of dma-bufs and their pages,
  images bound to them, exported pages) is cfg(unix). The DRM-modifier image
  items that hold none (ModifierMemory, the explicit-plane and natural-layout
  checks, the format queries) stay on every host: their extension decides at
  run time.
- dirty_pages and texture/rotation hold no unix code: on every host.
- host_residency: the descriptor limit (RLIMIT_NOFILE), the dma-buf form of
  an import made again and its descriptor counts are unix-only; the pointer
  form and the sweeps stay on every host.
- devtools' scratch lock: the file identity on Windows is the volume serial
  number and file index (GetFileInformationByHandle) in place of dev/ino.

Verified: a step of the Windows check iteration (gnullvm, msi job).
2026-11-15 05:24:38 -08:00
Anees Iqbal c40358858a runtime: libc on unix hosts only, windows-sys on Windows
The runtime's host facilities (pages, clocks, threads, exit handlers) are
libc's on unix. Windows has none of libc's there, so libc becomes a
cfg(unix) dependency and the Windows forms come from windows-sys (MIT OR
Apache-2.0, a GPL-2.0-compatible option), a workspace dependency with the
features the runtime's Windows forms call.

Verified: dependency resolution in the Windows check job that follows.
2026-11-15 05:24:38 -08:00
Anees Iqbal d25f77ecb1 queue_order: the taken-up rounds time the scheduler's thread from the holder's let-go, its wait for a core apart
checked_commits_during_submissions_are_taken_up_promptly failed on the RX 7900 XTX under the full
suite with two other GPUs' suites on the same 16-thread host (pin 99 legs, um790 job m3-max-31769):
round 2 took its two left command buffers 23.6 ms and 55.5 ms after the release, the thread's
"own" time 18.1/46.0 ms against a 40 ms bound, while the thread had waited 25.8/46.8 ms of it on
the host's run queue (schedstat): ready to run, kept from a core by the host's load, not by its
own work.

What: each round's take-up is now timed from the instant the round's holder lets go of the
VkQueue (noted as the last step of its with_vk_queue closure, with the scheduler thread's
schedstat read there, where that thread waits for the VkQueue off the run queue), not from the
instant the test sent the release: the holder thread's own wake under load (it must get a core to
unlock) was charged to the scheduler's thread as blocked time. The bound (unchanged, 40 ms) now
applies to the take-up less the LONGER of the driver's vkQueueSubmit time and the thread's
run-queue wait: the two may overlap, so their sum is never taken out, and the measure is never
below the thread's own time. The take's schedstat is read before its instant and the let-go's
after, so a wait between the reads stays in our time. Each round now also prints the thread's
time on a core and its sleeps at each take, and the holder's latency from the release to its
let-go, so a failure still left says whether the thread ran, was blocked, or slept.

Why the model changed (the measured split): in 31769, round 2 is all run queue (its wait at
least its "own" time). The slowest round there, 19 (taken 102.5/135.4 ms, run queue 38.2/57.0,
driver 0.9/6.7), left 63-72 ms that is neither; that it was the holder's wake is INFERRED, not
measured: the old print had no holder latency, CPU time or sleeps. A diagnostic build of the old
test with those prints (branch steelbrain/qorder-diag, 1fa4226bdf, not for landing), 40 rounds a
run, 2 alone and 3 beside a runtime-lane partition (load average 6-16): on the RX 7900 XTX
(m3-max-31849) every round made 2 then 3 passes, 0 sleeps and 0 wakings between the release and
its takes, the thread on a core at most 1.65 ms, taken at most 2.0 ms alone and 10.4 ms loaded
(8.35 ms of it run queue); on the Radeon 780M PHOENIX (m3-max-31841) the same steps, taken at
most 22.1 ms loaded (22.6 ms run queue at most, thread on a core 9.4 ms). No lost wake and no
slow own work in what ran.

Verified: see the lane report (the XTX proof job: alone, and beside a runtime-lane partition on
6 pinned cores against the old binary).
2026-11-15 05:20:00 -08:00
Anees Iqbal fac976c772 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-15 05:19:46 -08:00
Anees Iqbal 7ba0cd9fe6 RUNTIME 2343: GPU times placed by a calibration still beyond 20 us are announced and counted
A calibration pair is read again while the smallest deviation so far
states more than 20 us (`gpu_time::SETTLED`), four readings at most
(`least_deviation`). Where the least of four still stated more (93 and
125 us on the RX 7900 XTX under full parallel suites: a reading's
deviation holds the time its thread spent off the CPU), the runtime
placed the command buffer's GPU times by it, inside the command
buffer's life, with up to that error, and said nothing. Owner rule 2:
a near-equivalent is recorded and announced.

`GpuClock::span` now answers `Placement::Loose { deviation }` where the
pair places both times inside the life and its deviation exceeds
`SETTLED` (a pair outside the life is still set aside as before).
`Placement::read` gives the notice for every placement the first read
of a command buffer's GPU times announces, counting a loose one:
- new kind `Degradation::LooselyCalibratedGpuTimes`,
  `loosely-calibrated-gpu-times`, class Precision, announced once per
  device at the read (the site `uncalibrated-gpu-times` uses), its
  reason stating the deviation; not `uncalibrated-gpu-times`, whose
  cost says the times are placed by the completion, where these are
  the pair's, the duration exact;
- new `WorkCounts::loosely_calibrated_gpu_times`: command buffers
  whose times a read found placed so, counted at the read that
  announces, so the count is nonzero exactly where the kind was
  announced.

Tests: `tests::gpu_time::a_pair_still_beyond_the_settled_deviation_is_
announced_once_and_counted` feeds `least_deviation` a fake source of
four readings above 20 us (Loose, the kind with the deviation in its
reason, each read counted, announced once) and settled ones (Iris
Xe's 165 then 7.6 us; 20 us exactly: Calibrated, nothing), and a loose
pair outside the life (Disagreed, the uncalibrated kind, not counted).
The lane's `gpu_times` expects the kind exactly where counted, and holds
the count nonzero exactly where `calibration_deviation_most` exceeds
the slack (no disagreement); `read_kinds` adds it where counted
(mesh_draws), `disagreeable_kinds` allows it (first_use); a site const
`LOOSE_GPU_TIMES` takes it. The conformance cases that read GPU times
(`command-buffer-facts`, `empty-command-buffers`) allow its notice:
the host's load decides it, and every value still compares exactly.

docs/API.md's catalogue lists the kind; api_signatures.tsv blessed.
2026-11-15 05:18:59 -08:00
Anees Iqbal d9236a8a11 Known gaps: a commit held past 16 ms on a Radeon 780M; a teardown wait past 16 ms on an RTX 2080
Two latency tests fail on some GPUs at the 0.2.0 release candidate, recorded where a user reads
open gaps (docs/FAST-PATHS.md, Known gaps) and in the 0.2.0 CHANGELOG entry, at the owner's call to
document them as failing and release:

- tests::held_step_order::command_buffers_behind_a_waiting_step_read_scheduled: on the Radeon 780M
  (Phoenix, m3-max-31782, exclusive) the long command buffer's commit returned 405.95 / 23.66 /
  10.50 ms after its call over the test's three runs (bound 10 ms); pin 97's XTX printout shows the
  same shape (315.68 -> 12.59 -> 17.11 ms). The ordering the test is for held in every run.
- tests::teardown_threads::a_running_queue_switch_check_leaves_the_device_to_the_program_s_thread:
  on an RTX 2080 (620.70.06) it failed 3 of 3 alone (m3-max-31777): the teardown waited 33.1 / 23.3
  / 19.8 ms for the check, 19.6 / 22.0 / 18.4 ms of it the check's objects' release; it passes on
  the RTX 3090, RX 7900 XTX and Radeon 780M. That host's driver calls on the 2080 ran several times
  slower than usual during the measurement (cause open).

Docs only.
v0.2.0
2026-11-15 02:15:21 -08:00