The unshared-isolation hold kept other queues' batches to about 2 ms of expected work ahead of an
unshared (compositor) queue on the same VkQueue at all times. On the 780M that stretched Super
Resolution's command buffers (reims gbo-780m A/B with isolation Off: SR 27.78 -> 24.78 s; 5772 holds).
Now the 2 ms budget applies only while an unshared queue on that VkQueue committed within the last
50 ms; otherwise the budget is 16 ms (the intolerable-wait line), so a quiet compositor's first
frame waits at most about 16 ms plus one batch.
- SlotShare::unshared_committed: one relaxed atomic store per VkQueue at the commit call.
- Flight::ahead takes the budget; Flight::room returns Room::Idle where only the 16 ms budget let a
batch go; batches enter the flight either way, so the 2 ms bound is exact from the compositor's
next commit.
- WorkCounts::heads_let_go_unshared_idle (new). No new Degradation kind, no refusal change.
- docs: FAST-PATHS unshared-isolation row (both budgets, reasons, trade, a replay over reims's
hold-off trace: SR at 2 ms would hold 3,168 of 6,855 CBs, at 16 ms 0), API.md, the
UnsharedIsolationPolicy::Bounded and new_command_queue_unshared docs.
- queue_share_device: the held-work runs settle their queue's expected run before measuring.
Verified (isohold): lavapipe m3-max-28760 at 337f244d25: unshared_hold, queue_share_device,
scheduler_held_wakes 28/28; quiet compositor: second long CB let go 13.5 ms before the first ended,
the compositor's CB ran between the second and third; active compositor: ran before the second long
CB (Off: after the third). Negative control (window check removed) m3-max-28762: CONTROL_EXIT=100
(device test + 2 unit tests fail). The SR A/B on a 780M is owed. Clippy and the suites run after landing.
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.
What: two known-gap entries in docs/FAST-PATHS.md and the spec's reasons in the doc comments of
`Device::sparse_granule` and `Device::imports_dma_buf_buffers` (dma_buf.rs). No behaviour change.
Why: a consumer's guest buffers over scattered 4 KiB pages need more udmabufs than one (more
runs than udmabuf's list_limit, 1024). The runtime already binds such a buffer as one
SPARSE_BINDING VkBuffer over several dma-bufs where the driver reports the import (RADV:
dma_buf_sparse_buffers in the consumer's 780M runs). ANV does not: it has sparseBinding and a
sparse-binding queue family, but vkGetPhysicalDeviceExternalBufferProperties answers
externalMemoryFeatures 0 for a SPARSE_BINDING buffer (dma-buf, host allocation and opaque fd,
with device-address usage or without) and 0x6 for a plain buffer's dma-bufs, so by
VUID-VkImportMemoryFdInfoKHR-handleType-09862 and VUID-VkSparseMemoryBind-memory-02731 no
buffer over several imports is documented there: such a buffer stays a copy where its pointer is
refused. A texture over such pages stays a shadow on every device: an image made with
SPARSE_BINDING alone has no application-visible mapping between texel location and memory
offset (spec, Sparse Buffers and Fully-Resident Images; Sparse Resource Features), and a linear
image takes no sparse residency (VUID-VkImageCreateInfo-tiling-04121).
Verified: probe job m3-max-28707 on the Iris Xe of RPL-P (Mesa 26.2.6-arch3.1, Linux 7.3.1):
sparseBinding=1, sparseResidencyBuffer=1, queue family 0 flags 0x1f; external buffer features
0x0 with SPARSE_BINDING for all three handle types, 0x6/0x4/0x6 without. Spec text read from the
Vulkan 1.4.366 specification.
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.
Pin 87's checks at 09068993d6 failed four ways, all from RUNTIME 2269's read twins:
- tests::fast_paths: the read-twin FAST-PATHS row named `ContainmentPolicy::UnsafeOff`, a
private item; the row now says "its `containment` is not `UnsafeOff`".
- validation runtime_lane::copied_surfaces: a ReadTwin gate refusal counted in
host_imports_refused_by_host as well as read_twins_unimported; it now counts only in the
latter, so the expected [1,0,0,1] holds.
- tests::host_ram_copy_device: twins stay in chunk_bound_buffers_made; the test's expectation
follows, and its copy reads use a one-word fill in the page the CPU writes plus a copy, read
through the copy where the twin would serve.
- private rustdoc: two read_twin.rs module-doc links fixed.
Verified (roip, m3-max-28711): fast_paths 32/32, private rustdoc exit 0, lavapipe runtime 88/88,
validation copied_surfaces 4/4. Clippy and the full suites run after landing, on development.
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.
Every compute encoder logs now, and a group of folded encoders holds its
logs until the commit (encoder_fold.rs), which gave each back alone to
spares that kept 16: a 2300-encoder command buffer allocated about 2280
logs and freed them at its commit. dispatch_chain --host 20 --only encoders
--dispatches 2300 on the RTX 5080 node, no buffer over host pages: the
commit's share per dispatch went from 113-126 ns to 221-223 ns.
SpareLogs::give_held clears the held logs outside the lock and keeps them
under one lock, and each kind's spares keep as many as the last commit that
held logs gave back (at least 16), all of a kind together within 1 MiB of
room (SPARE_ROOM_BYTES, what 16 logs of SPARE_LOG_BYTES took before), so a
next command buffer's encoders reuse them rather than allocate.
Giving them back under one lock at the commit did not bring the commit's
share back: dispatch_chain --host 20 --only encoders --dispatches 2300 on
the RTX 5080 node, no buffer over host pages, ns a dispatch (two runs each):
commit 137/127 before every compute encoder logged, 225/238 with the logs
given back one by one, 235/217 under one lock; bind 50/50, 97/97, 60/59, the
spares' reuse taking the first pushes' allocations off the bind. Each held
log's clearing (its calls' handles let go of) and move stayed on the
committing thread.
split_failure now leaves the logs no split takes held, and the release gives
them back (State::unsplit_logs, SpareLogs::give_held) beside the logs the
encoders kept, on the queue's handler thread, before the waiters return. A
2300-encoder command buffer's held logs (about 0.7 MiB) live until it
completes rather than until its commit.
RUNTIME_VERSION 2273: fold logs are spared across command buffers and given back on the handler thread.
Verified (dchain, at 3c895e7444 = this tree but the pin file): lavapipe full runtime suite 2583/2584 (the other: host_ram_copy_device private-bit, roip's); clippy x3 and rustdoc 0 (28705, 28706). ABAB on the 5080 node CPU, dispatch_chain --host 20 --runs 9 --only encoders --dispatches 2300, ns a dispatch: commit base 127/128, RV2272 214/219, this 130/139; bind 50/50, 98/97, 59/61; committing thread 3424/3467, 3545/3568, 3463/3500 (+35 over base); the clearing (~79) runs on the queue's handler thread (208/209 vs 129/129).
Squashed from steelbrain/dchain3 8554aa06cc..0053613e6c.
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.
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.
RUNTIME 2268 failed a whole group of compute encoders recorded into one
VkCommandBuffer when a failure (commit_failed's From(n) or Set, a fault, a
recording failure) named only some of them. Metal runs every encoder the
failure leaves, so a From(n) inside a group dropped the work of the
encoders before n: a consumer's protection probe (a compute encoder, then
one made under protection options it fails From) read the first encoder's
words as never written.
Now every compute encoder logs its calls (replay.rs), a closed group keeps
its members' logs until the commit, and the commit splits a group its
failure fails in part (State::split_failure): the members that run are
encoded again from their logs, each into VkCommandBuffers of its own, in
the commit's call before the scheduler sees the batches (the rebind's
encode-again path, held by the same mark); the shared VkCommandBuffer is
never submitted and the failed members run nothing. Groups no failure
splits give their logs back at the commit. The split also works in a
command buffer that used command predication where its encoders are alone.
The one remaining difference (docs/API.md section 10, FAST-PATHS known
gaps): a group whose predication unit later laid a loop
(encode_start_while / encode_start_do_while) or left a record unbalanced
still fails whole.
pending_rebind's test reaches its no-log case through an If opened by the
encoder before (Unlogged::Predicated), since compute encoders now always
log; Unlogged::NoCalls's doc and notice text name what logs nothing now.
Cost (dchain, 5080 node CPU, dispatch_chain --host 20 --runs 9 --only
encoders --dispatches 2300, no host-page buffer, ABAB, ns a dispatch):
thread_cpu 3393/3396 -> 3539/3809; commit 113-126 -> 221-223 (logs held
until commit; a follow-up gives them back under one lock and keeps them as
spares); bind 49-50 -> 96-97 (the log itself, stays).
RUNTIME_VERSION 2272: folded groups split at a partial failure.
Verified (dchain): lavapipe full runtime suite at c118ca6fb6 (m3-max-28648)
2581 passed, 1 failed (host_ram_copy_device private-bit, the same at
09068993d6, owned by roip); pending_rebind negative control (guard removed)
fails on VUID-VkDescriptorBufferInfo-buffer-parameter; RTX 5080 208/208
(encoder_fold, rebind, reencode, command_buffer, dispatch, predication,
replay, fence, indirect, compute, failed); negative control at dd286c7304
(m3-max-28590): the four failure tests fail, the consumer-shaped one
included.
Squashed from steelbrain/dchain2 89480ccfd3..c118ca6fb6.
The host's time takes --heap-churn K: each command buffer makes K buffers in
an automatic Private heap of the example's own before it encodes, its
dispatches take them as the two read-only buffers, and they are let go after
it completed, as a program that takes a command buffer's scratch from a heap
does (Geekbench's Super Resolution, through MPS: about 3.3 heap buffers made
and 2.8 freed a command buffer). --heap-kept H places H more buffers in that
heap and --live L makes L of the device's own, living through the runs.
HOST-CB prints the calling thread's ns per command buffer by phase (make,
place, encode, commit, free) and each thread group's CPU, the scheduler's
among them. (--heap, compenc's, places the words and zeros in a heap over
host pages; the two combine.)
--binds ptr runs bump_ptr, bump_wide with its first zero buffer read
through an address the dispatch sets as bytes (a Holder of one pointer, as
an argument buffer holds it): its command buffers take a root table, and
the device's resident set of its live buffers resolves the load
(live_buffers.rs), so the live table is made at each command buffer while
the list changes each one.
These are steelbrain/livebuf's a4709341d7 and 9a6dceb14b on development,
renamed beside compenc's --heap (bc1580095c). Verified: before and after of
the listing fix (RUNTIME 2271) ran a4709341d7's form on lavapipe (commit ns
per command buffer at 2048 kept heap buffers: 73.7 us before, 13.9 after);
this form is built and run on lavapipe in the lane's sweep job (report).
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.
LiveBuffers::reach called Heap::reached for every heap a command buffer
used, which upgraded every live buffer ever placed in the heap into a Vec
and registered each: a lock and a SortedChunks lookup per buffer, only to
find it listed. That ran at each commit, and again at the first submission
wherever the list changed since the commit, which with heap scratch made and
freed each command buffer is every one. Heap::place pruned the heap's list
of placed buffers at every placing. Both walked every buffer in the heap:
O(heap buffers) a command buffer and a placing. On Geekbench's Super
Resolution (Iris Xe profile), register, reach, Vec<Buffer>::from_iter and
Heap::program_buffer were about 44 us a dispatch of the runtime's 155.
Once a heap was used, every buffer placed in it since is listed at its
placing (LiveBuffers::placed), and nothing unlists a placed buffer without
clearing the heap's flag: forget at its drop, refresh (which lists it
again), and rebound with the heap (unreached). So Heap::reached now returns
the heap's buffers only at the first use since its making or the last
replacement of its pages, and none at a later use. Placed keeps how many
lived at its last pruning and prunes again only once the list holds twice
as many and 8 more: O(1) a placing amortized, the list within 2x + 8.
Metal's reach rules (live_buffers.rs) are unchanged: a heap's buffers from
the first using commit, later ones from their placing, and after a rebind
from the next use, a commit's or a first submission's.
Tests: heap_reach_once (new, a device test) reads through a loaded address
each way a placed buffer is listed: placed in a used heap, placed where a
gone one lay (the gone one unlisted), refreshed, the heap rebound then used
again, and placed after a commit and before its first submission (held by a
shared event); and checks that a later use walks none of the heap's buffers
and that the placed list stays bounded under churn. Run on lavapipe with a
negative control (no listing at placing), and HOST-CB before and after of
dispatch_chain --heap on lavapipe; the jobs are in the lane's report.
RUNTIME_VERSION 2271: a reach of an already reached heap walks nothing.
The two test-only helpers (Heap::placed_entries, LiveBuffers::lists) are gated cfg(all(test, any(m2v_gpu, m2v_cpu_icd))) as the device tests that use them (main, at landing: a plain test build warned them unused).
Verified (livebuf): reims gbl-iris lbr call graph: 2184 of 2267 SortedChunks samples are contains <- LiveBuffers::register <- reach (1223 commit_now, 925 first_submission). Lavapipe m3-max-28623: 175 touched tests pass incl. tests::heap_reach_once (placed in a used heap; placed where a gone one lay; refresh; rebound(heap) then used; placed after commit before first submission behind a shared event) and the bounded-list test. HOST-CB ns a CB, commit at H=2048: K=4 73696 -> 13858, K=8 71934 -> 14149 (flat in H after); heap phase K=4 H=2048 5128 -> 1573. Negative controls (no listing at placing; reached() walks every use) were still running at landing; lint runs after.
The dispatch_chain commits (a4709341d7, 9a6dceb14b) conflict with bc1580095c's --heap flag and are left to livebuf to rebase.
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.
The consumer places a guest's buffers in a heap over the guest's RAM, beside a no-copy
buffer over the RAM, so each use of the heap's bytes takes a use of the RAM's key too
(host_aliases.rs's placements): the host-pages path reims's perf -a names per dispatch
(HostAliases::augment_into, HostCell::lying, host_residency::Residency::exposed). --heap
gives the host's time that layout, as draw_costs's --heap does.
Clippy (needless_bool's if-guard form, -D warnings) refused development's lib test build in
every configuration at read_twin.rs:76: a cfg(test) if that returns false, then true. The
test build's refuses_writes now answers the guard's negation, and the other builds' answers
true, each a function of its own; the behaviour is the same.
Found by: clippy --all-targets --all-features -D warnings at development 09068993d6 on msi
(m3-max-28569: plain, m2v_gpu and m2v_cpu_icd all 101, rustdoc 0).
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.
Every compute and render encoder's open built what it starts with (the shadowed textures
its command buffer's ended encoders made resident) from scratch: the command buffer's
joined residency, then each ended encoder not joined yet, one shadows_onto each. The joined
residency advances only where the command buffer's own work reads it, so a command buffer
of n compute encoders walked n(n-1)/2 ended encoders: at Geekbench Fluid's ~2300
one-dispatch encoders a command buffer, the open grew to ~2.9 us a dispatch on lavapipe
(866 ns at 6 encoders), and reims's decodeperf profile (M3, MoltenVK) put
inherited_residency and shadows_onto at 762 of open_compute's 874 samples.
The command buffer now keeps what its next compute and its next render encoder start with,
with the number of ended encoders it took in (State::inherits): an open takes in the
encoders ended since, each once, in the order they ended, and hands out a copy (a count:
the residency's resources are shared until one copy changes). It is let go of where the
joined residency or an ended encoder's residency may change: joined_residency (every read
that joins, the heaps' textures made since, the first submission, a re-encode) and a
re-encode's splice of an encoder's residency. The result is the one the walk made: the
joined residency's shadows first, then each ended encoder's onto them in order, usages and
stages joined as before.
Counted: WorkCounts::ended_residencies_looked_at (an ended encoder's residency looked at for
an open's inherited shadows). Tests (tests::joined_residency): 64 encoders with a read of
the residency after the 32nd look at 62 residencies (the walk: 992); a shadowed texture made
resident for reading, then writing, reaches the next encoder with its usage widened.
RUNTIME_VERSION 2270: an encoder open inherits residency incrementally (the same result).
Also (compenc): dispatch_chain gains --host (each encoder call and the commit timed on the calling thread, commit_and_submit, per-thread CPU on Linux), --binds 4|tex (four buffers, or the Geekbench compute shape: 2 textures, a sampler, an output buffer and setBytes) and --pages (buffers over host pages).
Verified (compenc, msi lavapipe): touched tests 165/165 (m3-max-28544) incl. tests::joined_residency: 64 encoders with a residency read after the 32nd look at 62 ended residencies; a shadowed texture made resident READ then WRITE reaches the next encoder as written. Negative control (drop the slots every open, m3-max-28547): 992 vs 62, fails. Release dispatch_chain --host --only encoders --dispatches 2300 --binds 4, ns a dispatch: open 2862 -> 573, encode 7332 -> 5004, thread CPU 7532 -> 5205 (jobs 28534/28545); ended_residencies_looked_at 1.00 a dispatch. SR-like (6 encoders a CB) unchanged (866 -> 913). Clippy x3 and rustdoc run after landing.
Squashed from steelbrain/compenc d0d524b6de..84b304c5e3.
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.
Off macOS, a no-copy buffer made with Metal's read-only option bit 24 is a
copied host buffer (CopiedFor::ReadOnly) whose copy takes every write; every
commit that used it compared the whole copy against the pages (reims's
12.7.6 walk: 130,448 MiB compared, 34,462 compare threads, copy-in bytes 0).
Now such a buffer also gets a read twin: the runtime's own buffer over the
same pages, imported in place, outside the Metal address space (key bit 63),
made only under the Contained policy and only where the pages import in
place (never a copy). copyFromBuffer:toBuffer and copyFromBuffer:toTexture
read through the twin until an earlier command of the same command buffer
may have written the buffer (a write of its key, writes_unnamed, or unnoted
uses); after that they read the copy, so the command buffer reads its own
dropped write back and the next command buffer reads the pages. Every
encoder refuses a command whose own uses write a twin key: it records
nothing and fails its command buffer. The twin is placed over the bytes
before its buffer, so a twin use does not drag in the copy.
Counted: read_twins_made, read_twins_unimported, read_twins_uncontained,
read_twin_blit_reads, read_twin_reads_after_writes, read_twin_writes_refused,
copied_copy_ins_compared, copied_copy_in_bytes_compared. Docs edited in
place: the FAST-PATHS row "Off macOS, GPU writes into read-only memory",
API.md's copied-host-pages and private-resource-option rows, read_only_view.rs.
RUNTIME_VERSION 2269: blit sources of bit-24 buffers read in place.
Verified (roip, lavapipe m3-max-28537 at ad4ed6a591, 40/40 read_twin_device|copied_device):
a 29,753,344-byte (3648x2038x4) buffer's copyFromBuffer:toTexture + buffer copy
compare [0 copies, 0 bytes, 0 threads] (was [1, 29,753,344, 7]), texels and
bytes match the pages; fill + copy-out in one CB reads the fill back, pages
unchanged, next CB in place; blit fill, blit copy-in and a kernel store through
a loaded pointer at gpuAddress leave the pages; a fill of the twin is refused
(negative control: with the guard off it changes the pages); no twin when the
import is refused, over read-only pages, or under UnsafeOff. Owed after
landing: 5080, clippy x3, rustdoc. Next steps: sampled textures over the buffer,
buffer slots, resident sets.
Squashed from steelbrain/roip 4d4bef55bd..ad4ed6a591 (encoder.rs import
conflict with RUNTIME 2268's encoder_fold resolved by keeping both).
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.
Two counters that name the cause behind two costs on the per-draw path, so the next lever is
chosen from data, not guessed.
Whole stage-table reads. Of stage_tables_read, the reads a draw's settle reads whole
(refresh_bind_state) are now counted by the first of its checks that failed, in their order:
stage_tables_read_whole_{unread, moved, interface, maps, views, spare, carried, unlisted}. With
stage_tables_read_in_part they add up to stage_tables_read. A state an ended encoder left is
marked as such (ReadFrom::ended, set by LiveBind::end_encoder as a spare and by end_carried as
carried, cleared by the next read), so a new encoder's first read is told apart from a table
that keeps too few changes. The classification runs only on the whole-read path, after the
in-part attempt failed.
Rebinds stopped reshaped. live_bind::Reshape now keeps the first change that told it the shape
may have changed (a slot's class and kind, or a field) in place of a bool, at the same cost: it
compares nothing once told. A rebind that stops reshaped counts draws_rebind_reshaped_views (a
changed table's at-bind views) or the first slot change: buffer, texture or sampler bound,
unbound or of another shape, or a buffer offset of another shape. Counted for every rebind that
stops so, of the same arguments or other ones (draws_rebind_stopped_arguments_reshaped is the
latter).
Tests: tests::live_bind (CPU) checks the named first change; draw_again's
a_table_read_whole_is_counted_by_why (unread on a new device, spare after) and
a_rebind_stopped_reshaped_is_counted_by_the_slot (bytes where the kept draw read a buffer);
carried_draws' stale-stop test now checks spare and carried whole reads.
Also: a690aeb7b0 (a leftover read of the old reshape bool goes through may_reshape) and 654a35c8dd (carried_draws: passes in queues of their own read whole from a spare, then from a new state).
Counters only; no behaviour change, so no RUNTIME bump. New WorkCounts fields: stage_tables_read_whole_{unread,moved,interface,maps,views,spare,carried,unlisted} and draws_rebind_reshaped_{views,buffer_bound,buffer_unbound,buffer_shape,buffer_offset,texture_bound,texture_unbound,texture_shape,sampler_bound,sampler_unbound,sampler_shape}.
Verified (perdraw7, m3-max-28525, msi lavapipe): 72/72 touched tests incl. the new live_bind, draw_again::a_table_read_whole_is_counted_by_why, draw_again::a_rebind_stopped_reshaped_is_counted_by_the_slot; clippy --cfg m2v_cpu_icd 0. Clippy plain/gpu and rustdoc run after landing.
Squashed from steelbrain/perdraw7 07c6c9b6da..654a35c8dd.
Before, with the ring capped at 8, the device test hung until nextest's timeout instead of failing: round 9's commit submitted on the test's own thread and waited on the host under the staging lock. Now the rounds run on a scoped thread; the test thread waits at most 5 s for each round's submission, then lets the hold go, stops the rounds and fails. It reads the ring's size and the work counts only after the hold is let go (a stalled submission holds the staging lock).
Verified (gbkern, b5080 m3-max-28508, RTX 5080): at 128 PASS in 1.05 s (20 held, 12 made past 8, 0 host waits, 8 kept after); with the cap at 8 (throwaway) FAIL in 6.26 s: (8, Scheduled) vs (20, Scheduled). Clippy x3 and rustdoc run after landing.
Squashed from steelbrain/gbkern-ringtest cac2815693..123ad2a246.
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.
A command buffer of N one-dispatch compute encoders went to the queue as
2N - 1 command buffers (each encoder's primary and a kept barrier command
buffer before it). A compute encoder now records on in the tail of the
compute encoder before it where nothing needs a boundary: same dispatch
type and logging, same batch (no event wait or signal, no host step), the
earlier encoder one plain part (no segment, no fence update, nothing
failing or faulting), no command predication, encoder trail off,
protection options 0.
The barrier between the two is recorded per command by the tracker's own
rule between two encoders of a batch (encoder_fold::FoldOrder), joined with
the encoder's own serial barrier into one vkCmdPipelineBarrier. The folded
encoder's uses and fence waits join the group's first part's summary, so
the batch's plan orders the group as a whole; its own part keeps its fence
updates alone. A rebind encodes a group again whole or not at all; a
failure that fails one encoder of a group fails the group (docs/API.md
section 10, "A command buffer committed as failed"). Counted:
WorkCounts::encoders_folded. FAST-PATHS: the ANV command-buffer row notes
folded encoders begin none.
Also: the dispatch_chain example (gbkern, dchain): a chain of dependent
dispatches by how a command buffer holds them (encoders, serial, raw
barrier, raw split), with each shape's first command buffer's counts.
RUNTIME_VERSION 2268: compute encoders fold into one VkCommandBuffer.
Verified (dchain, at d7e4a9ce51, the same diff before its rebase):
- lavapipe (m2v_cpu_icd): 40 tests incl. 8 new tests::encoder_fold (dependent
chain, independent encoders take no barrier, dispatch-type change, fence
update ends a group, commit_failed inside/at a boundary, rebind re-encodes
a group whole).
- RTX 5080 (m2v_gpu, b5080): 190 touched-family tests; FOLD-CHAIN folded 23,
begun 1, barriers 17, 0 wrong words.
- 5080 dispatch_chain, encoders shape, GPU us a dispatch: 1000: 8.41 -> 2.92,
2300: 7.43 -> 2.92 (raw barrier 2.92); vkQueueSubmit per command buffer at
2300: 1007 -> 44.6 us; command buffers submitted 2N -> 2.
Owed after landing: the negative control (fold barrier removed reads wrong
words), clippy x3, rustdoc, the full lavapipe runtime suite at the rebased tip
(m3-max-28507), the 780M and XTX before/after.
Squashed from steelbrain/dchain f51ba34c37..2f2000cfbc.
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.
The carry took the ended encoder's kept draw and those of the three states
drawn most lately before it (CARRIED_STATES = 4), and let go the rest
(kept_draws_carry_capped), while the bind state sets aside seven
(live_bind::SET_ASIDE). In the consumer's Iris Xe walks (appwalk14, macOS 14)
the cap let go 24.7k kept draws over about 252.6k draws, and 109k draws found
no kept draw and took every step (about 2.8x a rebound draw's encoding time).
Now every set-aside kept draw that carries goes with the last one, so the
bound is the bind state's: eight kept draws a carry at most, each holding its
settles' variants, VkPipeline and settings, one carry a command buffer and one
a queue place (documented on SET_ASIDE). The cap and its counter go
(WorkCounts::kept_draws_carry_capped, api_signatures). A carried state that
the next encoder never draws is work for nothing at the opening; the counts
show it as kept_draws_carried + kept_draws_carried_aside less
draws_rebound_carried + draws_carry_stopped (in the walk above, 131.9k carried
against 38.3k drawn with the cap at four).
Test: carried_draws::passes_of_several_states_rebind_each_state_s_carried_draw
now draws eight states a pass: the second pass rebinds all eight (seven carried
aside) and none takes every step; at the old cap it carried three aside.
Checked: cargo fmt; lavapipe and the negative control follow.
RUNTIME_VERSION 2267: carried kept draws are no longer capped at four states.
WorkCounts::kept_draws_carry_capped is removed (the cap it counted is gone).
Verified (perdraw7, m3-max-28480, msi lavapipe, debug): 61/61 touched runtime tests;
carried_draws::passes_of_several_states_rebind_each_state_s_carried_draw draws 8 states,
rebinds all eight carried; negative control at the base fails "eight states: the counts"
[1, 2, ...] vs [1, 4, ...]. Lint runs after landing (pin round).
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.
A rebind re-asked how its draw reads the pass's colors only where the kept
draw read through snapshots. A kept draw that read its own attachment
through the texture's copy, carried across a commit into a pass over a
texture over a buffer's bytes, whose every step reads through a snapshot
whatever the area, was rebound with the copy form: in builds with debug
assertions the rebound check panicked ("a draw rebound worked out other
commands than its every step", tests::pass_end_tiles on the Radeon 780M at
pin 84, timing-dependent), and in release the draw read the stale copy.
RenderLowering::reads_otherwise asks every step's question with nothing
counted or taken (in_place_wanted, snapshot_wanted_or, weigh_snapshot,
with Wanted::leading as every step's snapshot_by_area passes it): a kept
draw that reads through no snapshot is rebound, or drawn again as before,
only where every step reads none of its pass's colors in place, through
snapshots or after the split; else it takes every step, counted for a
carried draw in draws_carry_stopped_snapshot. The as-before path asks it
too: a draw the area rule sent to the copy weighs again there.
Also (perdraw7): walk_costs gains a profiling run of the no-barrier shape,
the reader's splits and their reasons in the walk counts, and barriers /
no-barrier shapes over host pages (walk_costs_profiled_over_pages); the
pass_end_tiles and dispatch_pending fixtures find where the run lays the
source out.
Tests: carried_draws::a_carried_copy_reader_stops_where_every_step_snapshots;
learned_coverage: a draw again weighs its form by its own count.
RUNTIME_VERSION 2266: kept draws that read through no snapshot can now take
every step's form.
Verified (perdraw7): clippy plain/m2v_gpu/m2v_cpu_icd 0 and rustdoc 0 at
7a4ef08494 (m3-max-28443); Radeon 780M fix PASS and negative control panics
at :1239/:1312 at the pre-rebase 2c5f5cba3f. Owed: the 780M at this sha,
lavapipe touched tests (run on development after landing).
Squashed from steelbrain/perdraw7 108762244d..7a4ef08494.
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.
A staging submission that found its queue's 8 command buffers all pending
waited on the host for the oldest, under the staging lock, on whichever
thread submitted: the scheduler's among them, inside a batch's submission
(flush_staging), which held every queue's submissions until the staging
queue ran. On a device whose staging queue is of compute work that can be
as long as the program's kernels run.
Now the staging queue makes another command buffer instead, up to 128
(MOST), and frees those past the 8 it keeps once the host saw their
submissions complete, at the next submission. Past 128 it waits as before.
The fill queue keeps its 8: its batches submit only after they found room.
The doc comment says why 128 and what it costs (ANV below Xe-HP: a 64 KiB
binding-table block per command buffer, 8 MiB at the cap).
Counted: WorkCounts::staging_buffers_grown (made past the 8) and
staging_buffer_waits (host waits for a command buffer to come free, either
queue), classified as submission work in the conformance cost table.
Tests: a unit test of the ring's choice (reuse the oldest complete, free
the other complete ones past 8, grow below the most, wait at it), and a
device test that holds 20 staging submissions on the GPU and checks every
round's command buffer is submitted meanwhile with no host wait, then that
the ring is back to 8 after one more round. The device test passes trivially
on a device without a staging queue (lavapipe).
RUNTIME_VERSION 2265: staging submissions no longer wait on the host for a
command buffer below 128 pending.
Verified (gbkern, at ffd3a51a79 on c796a88d6a): clippy x3, rustdoc, unit 29/29,
api_signatures/api_surface 15/15, lavapipe 4/4, RTX 5080 4/4 (20 staging
submissions held, 12 command buffers made past 8, 0 host waits, back to 8 after).
On the RTX 5080 Laptop GPU (b5080 entry nvscroll-tip at 3cdbfe9256) the test failed in its
second pass: Took { leading: 2, by_coverage: 0 } where it expected the whole-plane reader to
split by coverage. Its first pass recorded the readers once the pool made their pipeline
(pipelines pooled 1), and such a recording measures nothing (render.rs: a measured reader
records inside its query only where its pipeline was made at the draw), so the second pass
had no count yet. The lane in the same entry shows coverage weighing the same readers
(host pages, full coverage: 7.47 of 8 readers a frame over half, split).
The test now runs three passes and expects the coverage form only in a pass after one whose
coverage queries counted both readers, and asserts that a device that leads and measures
weighed a pass so at least once.
The census (m3-max-28383 at c796a88d6a, pin 85: cases 2369, compiled 48670, refused 1079,
failed 0, differences 0, regressions 0, moved artifacts 0, slowest compile 1917 ms) moved only
its artifacts_at product stamp (the translator sources' doc-link fixes in RUNTIME 2262).
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.
On NVIDIA's drivers a linear image takes no feedback-loop or input-attachment usage, so a draw
that read such a color at its own pixels after a memory barrier split the pass and copied the
texture's scissor box (the whole surface for a guest that sets no scissor) before the new
instance: in a consumer's autoscroll on an RTX 2080 about 21 readers a present each copied a
3648x2038 surface, ~29 ms of a 45 ms take-to-show.
Such a reader now splits the pass with no copy: its snapshot draws record in an instance of
their own ahead of the reader's (LOAD/STORE_NONE, empty masks), a "leading snapshot". The device
enables VK_KHR_load_store_op_none, else VK_EXT_load_store_op_none, below Vulkan 1.3 (the
runtime's instance is 1.2, so STORE_OP_NONE was core on no device); the version comes from the
device's properties.
A leading snapshot reads the texture at every pixel its draw covers, so over host pages it is
not cheaper than the split at every area: on an RTX 5080 Laptop GPU (split_parts, 8 readers a
frame over a 2648x1658 surface over host pages) whole-surface readers took 22.98 ms a frame
leading against 17.99 split, quarter-surface readers 6.06 against 8.55; the forms cross near
half. weigh_snapshot takes whether the reader leads and skips over_bytes for it, so the area
rule weighs its first pass and, where the device measures readers (occlusionQueryPrecise),
learned coverage decides from the second: a reader keeps the leading form within the existing
bound (SNAPSHOT_PIXEL_COST 20: 20% of a 4-byte color) and splits above it. A rebound kept reader
weighs with the same flag. New WorkCounts: reading_draws_snapshotted_leading,
reading_draws_leading_covered_within / _to_half / _over_half (where the guest's readers fall
against the bound). docs/FAST-PATHS.md's row records the 5080 A/B.
Also: the split_parts lane (ignored by default, run by name) measures what split readers cost and
reads its fixtures from the crate directory the runner names.
From steelbrain/nvscroll (81915c28de..3cdbfe9256, 11 commits). Verified on potluck at 3cdbfe9256:
clippy gpu (28377), cpu_icd and plain (28379) 0; rustdoc -D warnings 0; api_signatures and
api_surface 15/15; lavapipe 478/478 (copy form unchanged there). 5080 A/B nvscroll-ab-233300
(kind t). The tip's 5080 device test and lane (b5080 batch 28393) are pending; the 2080 and XTX
runs wait for um790.
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.
What: under METAL2VULKAN_QUEUE_TIMES (a default-off diagnostic that already notes queue head
and submit-return times), a batch submission that took 5 ms or longer from its start to its
vkQueueSubmit call logs one line (id name metal2vulkan-slow-submissions, through the device's
message sink, else stderr): its place in its command buffer, its VkQueue slot, the span split
into the prologue, the first work's take, the staging queue's flush (its waits for the staging
queue's lock and for one of that queue's command buffers counted apart) and the planning and
recording, then the call's own time. slow_submissions.rs holds the watch; submit.rs enters the
phases; device/staging.rs counts the two waits through a thread-local only while a watched
submission runs on the thread. Off, a submission reads one flag; no clock read, no line.
Why: in a guest's Feature Matching trace on the RX 7900 XTX, two one-dispatch command buffers
spent 23.6 ms and 323 ms between kernelStart (submit.rs's kernel.begin) and their driver call,
on the scheduler's thread, holding back every later commit; the trace cannot say which phase.
One rerun with this on names it.
Verified: not yet run; a lavapipe test (kernel_end_device) holds a submission 30 ms at its first
work's take (a new trace::Point::FirstWork) and checks that one line names it with that phase's
time, that a straight submission adds none, and that without queue times none is printed.
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.
Metal's reference for MTLIndirectComputeCommand concurrentDispatchThreadgroups (and
concurrentDispatchThreads): "Compute commands encoded into an indirect command buffer don't
automatically serialize access to resources with other commands in the indirect command buffer.
Use barriers to serialize access to resources within a range of commands." and "If dispatchType
is serial, the compute command encoder adds a barrier before and after the range of commands. If
dispatchType is concurrent, then the compute command encoder does nothing". MSL 6.17.2: "In an
ICB, dispatches are always concurrent." The runtime ordered a serial encoder's execution as the
encoder's own dispatches: a barrier wherever their uses met (the host step and commit's
recording) or between every two commands (the GPU form).
Now a command runs after the earlier ones of its range only where its record sets a barrier, in
either kind of encoder; the segment's barriers from everything before and to everything after it
are the serial encoder's before and after the range (Execute loses `ordered`; ComputeKey loses
`ordered`, so a kept chunk runs in either kind of encoder; the GPU form puts a barrier between
two commands only where a route may set one in the records, CommandWrites::BARRIER; the
tracker's ordered_everything goes). docs/API.md's accepted difference quotes Metal's text. Not a
speed-for-accuracy choice (Metal's contract), so no FAST-PATHS row.
Also: kept_commands' compute tests note each command's own output window as an apart write
(the layer reported write-after-write between disjoint windows); trail_gpu_forms requires a GPU
form's scratch in device-local memory only without unified memory (a Private buffer lies in
system memory before the carve-out by design on the 780M), fixing the 780M lane failure.
From steelbrain/icbbarrier (b3f5e50f94, 7c5e5e60b2, fdfc1e412a; icbinherit). Verified on potluck
at fdfc1e412a: lavapipe 275/278 (28026; the 3 failures were lvpfails-owned and fixed by RUNTIME
2261 on development), clippy plain/m2v_gpu/m2v_cpu_icd and rustdoc 0 (28027), negative control
27962 (both new tests fail on the old runtime). XTX and 780M legs: not run (um790 down), owed at
the next pin's device legs.
a_completed_handler_waits_for_no_pool_block_made_meanwhile holds a
completed handler to less than half a block's making after its command
buffer completed: a bound on a thread's wake, which other test processes'
CPU use stretches. In pin 84's 780M legs (15 other lane processes beside
it, two other GPUs' partitions on the host, load average 18 on 16
threads) round 1's handler ran 13.5 ms after its completion, 6.5 ms
before the 23.5 ms making ended (so it waited for no making's end), and
failed the bound. Run alone at f6a19accbe on the same 780M with the
other GPUs' partitions still on the host (load average 14, potluck job
m3-max-28326), all 12 rounds' handlers ran within 0.53 ms.
The blend16 lanes asserted that a draw through the pixel interlock
announces none of their notes. A float output's blend is converted to
half by the storage image's store: Metal's conversion (toward zero) where
the profile takes DriverDeviation::MetalHalfStorageWrites, else the
device's own, which the translator records as
PrecisionNote::DeviceColorConversion (lower/fragment/fetch.rs). The
RTX 2080 is not among that deviation's measured rows (the 3090 and the
5080 Laptop GPU are), so its float cases announced device-color-
conversion and four tests failed, though their texels were Metal's
(4096/4096).
interlocked_notes names what an interlocked draw announces from the
profile's own predicate: device-color-conversion for a float output
where the profile does not take the deviation, nothing else. The
assertion is now equality with that list, in blend16.rs and narrow.rs
(zero.rs and nans.rs share blend16's sweep).
Seen in pin 84's 2080 legs. Verification follows.
On the RTX 2080 (NVIDIA, 16 graphics queues: a plan of 14 round-robin
VkQueues) four lane tests failed on metal2vulkan-queue-limits-reached,
which fails a run by design (runtime_case's Messages::sink): under the
lane's limits (one round-robin VkQueue) the program's second command
queue shared VkQueue 0 where the plan gives it one of its own. RADV's
one graphics queue leaves the plan as the limits do, so the XTX and the
780M said nothing.
- generic_pointers and sampler_tables made a queue per dispatch: each
test now makes one queue per device and dispatches through it.
- depth_executions' frame commits on two queues on purpose: both tests
that draw it make their device with the plan (at_plan).
- rate_mapped_passes' counted_draw makes a queue per draw: the two tests
that call it more than once take fresh_with(at_plan), as the file's
other multi-queue tests do.
Seen in pin 84's 2080 legs (archive e30c91de8a): generic_pointers_answer
_as_metal, a_frame_s_executions_at_a_fixed_stride_run_on_the_gpu,
a_sampler_table_read_at_a_dynamic_index_samples_as_metal and
a_viewport_over_part_of_the_screen_draws_only_the_regions_it_reaches.
Verification (build, the 2080 and lavapipe runs) follows.
The consumer's game on the XTX counted 5.5 ms a frame of batch_hold_nanos, all of it the
unshared isolation hold, beside a 12 ms gap between its frame and its GPU time. queue_share's
pairs mode runs that shape on the runtime alone: the hold keeps the next batch out of the
VkQueue while the one ahead runs, and the GPU stays busy under both policies (idle 1.9% against
1.4%, a 0.18 ms against 0.12 ms gap before each frame at the median), so the hold is recorded as
costing that, not the frame's gap.
Verified: m3-max-28278 on homelab-um790-xtx-1's XTX, the four pairs runs exiting 0.
A consumer's game on the RX 7900 XTX (RADV, one graphics VkQueue) ran a frame of two command
buffers (about 9.5 ms and 0.3 ms of GPU time, two frames in flight) at 22 ms a frame against
9.9 ms of GPU time, its batches held 5.5 ms a frame for the compositor's unshared queue
(WorkCounts::batch_hold_nanos, heads_held_for_unshared_isolation). This mode runs that shape
on the runtime alone: the frame period, GPU time and GPU idle share, each command buffer's
commit to kernel start, the GPU gap before each frame, the completion's lateness, and the
device's hold and scheduler counts a frame, under either UnsharedIsolationPolicy, with the
compositor's queue committing nothing or a draw every --period-ms.
Verified: cargo fmt; built and run on the XTX in the following jobs.
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.
Two members of the false-overlap class that RUNTIME 2257 closed for heap-placed images remained:
- A pass drawn in color groups refused a resolve target set in its first group's encoder
(RuntimeGap::ColorAttachmentGroups) wherever a draw had read anything with the target's key:
check_group_resolve compared ResourceKeys only. A heap-placed target, or one made over a
buffer, apart from the bytes the draw read was refused although Metal runs it. First.read is
now a per-key list of UseRanges (byte ranges joined where they touch), and the refusal stands
only where the target's use shares memory with a noted read.
- A texture made over a buffer (Storage::Alias, Owner::Buffer) took the buffer's key with a WHOLE
place, so attached_levels, cleared_copy and snapshot_color counted every texture over one
buffer as the same image: a pass rendering one and sampling another at other bytes took the
attached-read route, and after a load-ordering barrier before the first draw the sampled
texture's copy read the attachment's clear (4096 of 4096 texels wrong). Owner::Buffer now
carries the texels' ImagePlace (Texels::place, in Buffer::tracked's offsets) and Image::place()
returns it.
True overlaps keep their routes: the tests' controls refuse a target over the read bytes, and a
texture over the attachment's own bytes still takes the attached read and reads the clear.
Also: CI's "Private intra-doc links" step (ceiling 0 for every crate) failed on x86-64 Linux
with 16 links whose targets exist only under some cfg (runtime 10, metal2vulkan 4, air 2); they
are plain code spans or paths that resolve under every cfg now. Doc comments only.
From steelbrain/falseov (9e7367e451..b77784c0b4). Verified on potluck:
- before the fix, lavapipe (msi): m3-max-28285 at 9e7367e451 failed 3/3 (both targets refused,
apart read attached=1); m3-max-28297 with the fix reverted: the barrier case 4096/4096 texels
wrong.
- after: lavapipe touched filter 175/175 (m3-max-28304); XTX RADV carried m2v_gpu archive 175/175
(m3-max-28303; asserts aliases_buffer() and color_group_passes ran).
- clippy -D warnings plain (28314), m2v_gpu (28299), m2v_cpu_icd (28301): 0; rustdoc
--document-private-items 0 for all six crates on x86-64 (28311), public cargo doc 0.
No new Degradation kind, WorkCounts field or refusal kind; docs/REFUSALS.md unchanged.
The census at the pin-84 tip (m3-max-28187) covered 2369 cases over 21 profiles: 48670 compiled,
1079 refused, 0 failed, 0 differences, 0 regressions. 121 cells' artifact hashes moved with
SEMANTICS 2107 (a kernel's static threadgroup memory length is reported rounded up to 16 bytes);
each is still compiled. Slowest compile 2.1 s. The golden-table bless at the same tip
(m3-max-28186) wrote nothing.
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.