A kept empty block was looked at only when a release came in its own pool, so a
pool whose resources stopped coming and going kept its blocks, up to its heap's
budget, until its next release. The device's creation calls (keep_room) now
also free every pool's kept blocks past KEPT_EMPTY_FOR, at most once every
KEPT_SWEEP_EVERY (1 s): the memory is held at most about 11 s past a working
set's dip wherever the program still makes resources.
docs/FAST-PATHS.md, known gaps: the NVIDIA memory block row, with the bound
(an eighth of a heap, at most 2 GiB, 10 s), what it holds per device, why it
has no switch (no answer of Metal's changes), and the RTX 5080 measurement of
tests::clip_bursts (poolwait-burst, NVIDIA 615.71.09, two runs each): clips 2
and 3 took 41 and 40 allocations and 89 to 102 ms with 2 to 5 commits held
1 ms or more (longest 8.8 to 9.4 ms) before, none and 64 to 71 ms with no
commit held (longest 0.39 to 0.67 ms) after; a first clip 44 allocations
before, 16 after.
Not yet built: the sweep builds and runs next on lavapipe.
(cherry picked from commit b31e221ee4cfba1861320e8c674a01ea83614013)
The test of a dedicated block's free now sets the heaps' budget of kept empty
blocks to 0 through a test-only stand-in on Memory, as the free it counts
happens only past that budget. A new test checks the kept path: a released
128 MiB Private buffer frees nothing, its block is kept empty, and the next
buffer of its size takes it with no vkAllocateMemory.
(cherry picked from commit fcc48ace45b8d96a55e283dafbcaa2ef927d41a7)
A guest's 4K video clip start on the RTX 5080 made 9 pooled blocks and, for its
decoded pictures, one exportable allocation each (about 15 MiB); the clip's end
freed them all and the next clip made them again. NVIDIA's vkAllocateMemory and
vkFreeMemory hold every submission until they return.
- A block that empties is kept, past its pool's two pooled ones, while the
empty blocks kept in its heap stay within an eighth of the heap, at most
2 GiB (KEPT_EMPTY_BYTES). A dedicated block of the runtime's own memory is
kept the same way and takes the next dedicated placement of its pool that
is at most a quarter shorter (Pool::place_dedicated). Kept blocks go after
10 s empty (KEPT_EMPTY_FOR, was 1 s), but one pooled block per pool, and
all of a type before a block of it fails to be made, as before.
- Exportable buffers whose export needs no dedicated allocation lie in blocks
of a third kind, Holds::Exports, allocated exportable (OPAQUE_FD) and
pooled like any other: a 64 MiB block holds five 4K NV12 pictures, and
ExportedMemory reports the block's size and the buffer's offset in it.
The consumer's CUDA import already passes allocation_size, offset and
length.
tests::clip_bursts now checks that clips after the first allocate no memory;
before, lavapipe made 42 and 38 allocations for clips 2 and 3. Pool unit
tests cover the budget, the floor, dedicated reuse and staleness.
Not yet built: builds and runs next on Linux (lavapipe), then the RTX 5080.
(cherry picked from commit dd9b7573c9ee5c313d6bebaf242bf860185034fb)
A device test that measures what a guest video player's clip start costs: 3062
buffers, 1175 textures and 34 exportable 4K NV12 pictures made at once while
another thread commits a small fill every 2 ms, held, released, and made again
after a 3 s pause, three clips. It prints the makings' times by kind, the
VkDeviceMemory allocated and freed, pooled blocks made and freed, frees by
cause, and the compositor's command buffers that took 1 ms or longer to be
scheduled. Not yet a check: the numbers decide the fix.
Built only; runs next on lavapipe and the RTX 5080.
(cherry picked from commit f609e36a9d6e01ebb6ca5fbe84dbd9a8d0e8e3e6)
A copy_from_host_ram over chunks not yet imported notes its uses and defers a GatherStage: its arena
region is taken and its GPU copy recorded at its batch's host step, on a steps' thread, so the calling
thread no longer waits behind a 64 MiB arena block's vkAllocateMemory or another thread's allocation
(on the 5080 the region take was 58-93% of the slow first calls). A rebind before the first submission
re-encodes the encoder through the imports. The runtime-sources pin is recomputed.
Verified by radvruns on gem10: clippy in three configs, rustdoc, api_signatures/api_surface, runtime suite
on the 780M 1917/1917 and on lavapipe 1920/1920 (9318); two negative controls fail as intended. The 5080
effect is expected, not yet measured.
0f60b71653 renamed StepInputs::Scatter to Staged and left the commit's announcement
naming the old variant, which does not build. Verified: the gem10 checks follow.
(cherry picked from commit 2f6607441a25058b3b7bc9d70f49e1c00ccefd01)
A gather staged through the CPU (31e642ecc2) took its region of the
command buffer's arena on the encoding thread. A region over 32 KiB is a
chunk of its own: fresh pages imported by pointer on NVIDIA, about 2.3 ms
plus 0.25 ms/MiB, and more where the import thread allocates at the same
time. On the RTX 5080 the contended fill bench's first call took
52.8 ms, of which checks, pieces and the staging decision were 0.3 ms.
The gather is now a Deferred::GatherStage whose batch's host step does
all of its work: it takes the region, fills it by the CPU from the
pages, and records the vkCmdCopyBuffer into the buffer at the copy's
place. Like the staged scatter's GPU copy, it is recorded at its step
(records_at_its_step). Its uses are noted at the call. It still waits
for the work before it where the GPU may write the pages
(Deferred::steps_after_the_gpu_now, read by step_waits).
StagedFill becomes StagedGather. The command buffer's staged list,
staged_unfilled, fill_staged and State::next_encoder go: segments
carry it all now.
A rebind's encoding again replaces a staged gather's segment with a copy
through the imports: Segment::records_again and splice_replay take it
(recorded_by_an_encoding_again). So an encoder with a staged gather
keeps its log, as before.
Tests (host_ram_copy_device, device tests):
- Every staged copy test asserts that the encoding took no staging of
the arena (Uploads::bytes below the copy's bytes).
- a_rebind_before_the_first_submission_encodes_a_staged_gather_s_encoder_again:
a staged gather and a fill of a no-copy buffer over a page outside the
RAM, in one encoder behind an event wait. The buffer is rebound after
the commit. The command buffer completes with no error, the encoder
encoded again once, the fill lands in the new page, and the gather's
bytes are in its buffer.
Not yet verified; the gem10 checks follow this commit.
(cherry picked from commit 0f60b71653f9f7dfe9eaba18976c21eb75dd696d)
A copy_to_host_ram over a chunk not yet imported, on plans that are not listed, records the copy into
the staging arena (ScatterStage) and copies the region into the pages on a host step of its own batch
after the GPU work (ScatterDrain), before that batch is submitted: no import, allocation or wait on the
calling thread, and completion still means the pages hold the bytes. New counts host_ram_scatters_staged
and host_ram_staged_drain_nanos. The runtime-sources pin is recomputed.
Verified by radvruns: gem10 9198 (clippy in three configs, rustdoc, api_signatures/api_surface, lavapipe
runtime suite 1918/1918, negative control: all three new tests fail on the old path), 9245 on the 780M
(runtime suite 1915/1915). The 5080 A/B (radvruns-scatter-release) is queued.
A copy_to_host_ram over a chunk not yet imported used to import on the
encoding thread. With 16 ranges or fewer it imported those ranges alone
(each import about 2.3 ms on NVIDIA, its pages pinned). With more, it
imported the whole chunk or waited for its import. A clip switch's
block release (a device cache scattered to fresh guest pages) paid this
on the guest's command thread.
Such a scatter is now staged through the CPU, on devices whose thread
imports ahead (plans other than Plan::listed), as gathers are since
31e642ecc2. It leaves its work to two host steps, as two new Deferred
kinds:
- ScatterStage: the host step of the copy's batch waits for no GPU
work (Deferred::records_at_its_step, which Segment::needs_step and
known_summary take). It takes a region of the command buffer's arena
and records one vkCmdCopyBuffer of the bytes the runs cover into it,
at the copy's place in the encoder. The region's memory is made on
neither the encoding nor the committing thread (commit_and_submit).
- ScatterDrain: gpu_written, so the rest goes in a part and batch of
its own. Its host step waits until every VkQueue completed what was
submitted before it, then copies each run's bytes from the region
into the pages in run order (a host byte named twice keeps the
later's), before that batch is submitted. So the pages hold the bytes
once the command buffer completed, and every later command sees them.
The buffer's read is noted where the GPU copy lies. The chunk keys'
writes are noted at the start of the drain's part, so hazard tracking
orders later readers of those host bytes after the CPU's write, and
the RAM's log hears of them as of a copy through the imports. Each
chunk is taken and asked of the import thread, as a staged gather's is.
An encoder that holds a staged scatter keeps no replay log
(Unlogged::Segments). A rebind before first submission of a buffer
over host pages that the same encoder named fails that submission
with EncodedUseRebound. The HOWTO says so.
Counted:
- WorkCounts::host_ram_scatters_staged
- WorkCounts::host_ram_staged_drain_nanos
Upload::copy_out reads a region back.
host_ram_block_release_bench prints both.
Tests (host_ram_copy_device, device tests):
- a_first_scatter_over_chunks_the_thread_imports_is_in_its_pages_once_it_completes:
40 single pages over two chunks not imported, one page named twice,
from a Private buffer the GPU wrote just before in the same encoder.
At encode: staged 1, no run import, no chunk imported by a copy, no
import wait. At completion: the pages hold the bytes (the later's for
the page named twice), the page beside them is untouched, and a
buffer over one page reads them in a later encoder and in another
queue's command buffer committed after.
- a_first_scatter_of_few_ranges_imports_nothing_on_the_encoding_thread:
four pages over two chunks, which the old path imported as ranges
alone. At encode: no run import made. The thread then imports exactly
the two chunks, and the next scatter goes through their imports.
- The window test's scatter past the window is now staged: no copy
import, the thread imports its chunk.
Not yet verified; the gem10 checks follow this commit.
(cherry picked from commit 93965ee58ed9b238084696fa80b910745d6dc281)
A release benchmark (ignored) of the shape of a consumer's clip switch.
It releases 4 and 24 MiB of a Private device cache to fresh guest pages
by copy_to_host_ram, five times per shape:
- single pages over three chunks no copy took;
- four runs of one chunk, as many ranges as a copy imports alone.
Each release is committed by commit_and_submit and waited for. Beside
it, a compositor thread commits a fill sized to take 2 ms of GPU time
every 16.7 ms on a queue of its own.
It prints the calls', commits' and completions' spread for each shape
and size, the frames' commit to completion, and the copies' counts: run
imports made, import waits, and chunks imported (ahead).
The baseline for the staged scatter that follows. Not run yet.
(cherry picked from commit fd0d7511d4660fbc6a8239be18d1ebc6e1dcfdbc)
A viewport, scissor, cull, winding, depth-stencil, stencil reference, depth bias, clip mode, fill mode
or blend color set keeps the kept draw, restated: the next draw works its settings and draw state out
again and is rebound where nothing its shape depends on changed (WorkCounts::draws_restated). Draws
record differently, so the version moves; the runtime-sources pin is recomputed.
Verified by perdraw: um790 job 9190 (clippy plain and cpu_icd, rustdoc, draw_again 17/17, runtime
suite 1917/1917, lavapipe lanes 1932/1932), 9238 (clippy on the example); gem10 A/B 9220: the clips
shape 22301 -> 12929 instructions per draw (-42%), rebound 8000 -> 31680 of 32000; ws +11, 10k +7.
The restated cut keeps the kept draw across render state sets, but no draw_costs shape set
any: ws, many and 10k set only buffers, textures, samplers and pipeline states, so they time
the cut's overhead and none of its gain. clips is the 780M glass drag's mix of gaps (main's
setter histogram): every draw a vertex buffer at the next slot; every second one a scissor
rectangle before it (the target's top half, then its bottom, in turn); every 4 draws instead
a pipeline state switch with its sampler and a texture. 8 command buffers of 500 draws, as ws.
set_scissor_rect is counted apart under --calls.
Verified: cargo fmt; built and run in the branch's A/B job after this commit.
(cherry picked from commit de82ba3ff84724dbb8c468869b0e89720261f68f)
The shape-memo lane (draws_take_their_shape_from_their_encoder_s_draws_of_the_same_inputs)
expected the draw after a scissor rectangle's set, and the one after the scissor rectangle's
and the blend color's sets, to take every step: the sets forgot the kept draw. With the
restated cut they keep it, restated, so both are rebound (draws_restated 1 each), and the draw
after the blend color's, a debug build's checked draw taking every step, finds no pipeline the
memo kept for those values (a restated draw keeps its draw state, not the pipeline its record
binds), so it reuses no shape.
The test now asserts the restated draws per draw too. Per-draw counts from probe job 9156 on
lavapipe: reused [1,1,1,1,0,1,0,0], carried [1,0,1,0,0,0,0,0], restated [0,0,0,0,1,0,1,0];
the pixels' checks pass as before.
Verified: cargo fmt; the lane runs in the branch's checks job after this commit.
(cherry picked from commit 1c5ebd0a4001c3df575eb037a904b936e5746419)
Of draws_rebound, those whose kept draw was restated: evidence that the
restated path ran, which the compositor-gaps test asserts and a guest's walk
reads. The API signatures table is blessed.
(cherry picked from commit db5b6aa36a6d43b53491c73625fdf44535991c37)
A scissor rectangle set now restates the kept draw rather than forgetting it,
so the draws after it are rebound (each records its own scissor still) where
they took every step and reused their shapes; the test counts both.
(cherry picked from commit 71ef29627825937a8042af07b762754d2deccce0)
Matching the rebound path's answer after it returned moved its Again (which
holds an Error) through a local: draw_costs 10k, whose draws are all
rebound, took 31 more instructions a draw at a027a28691 than at 403c3e035a.
Each place that stops a rebind now counts it and returns Again::No.
(cherry picked from commit 84dc8f0ace31ca648a9849b770f8144567a79844)
Indexed draws after a vertex buffer offset alone, a scissor rectangle and
the offset, or a switch to the other of two states of one function pair
with another texture and the offset, in turn: every draw but the pass's
first and the second state's first is rebound, with the same commands,
state commands and pixels as the same draws taking every step.
(cherry picked from commit 61b4c90596cf5c5de28fd23991a565a778b06fa3)
set_viewport(s), set_scissor_rect(s), set_cull_mode, set_front_facing_winding,
set_depth_stencil_state, set_stencil_reference_value(s), set_depth_bias,
set_depth_clip_mode, set_triangle_fill_mode and set_blend_color log through
log_restating: the encoder's state stamp is drawn afresh and every kept draw
stays. A kept draw under another stamp derives again its settings, the bind
state's values and its draw state (draw_again/restated.rs), and is rebound
where its pipeline key, plan, shape and push bytes stay the kept draw's,
comparing every dynamic state with its record. Not yet built.
(cherry picked from commit 606b7a3aa92dde3bc472c1b9e1204c16bfd2fe0d)
A draw after another pipeline state's draws rebinds its own state's last draw (one bind state per
pipeline state, not per interface), argument tables keep 64 to 128 slot changes, and WorkCounts says
why a direct draw kept nothing (draws_unkept_*), found its kept draw unlike, or stopped a rebind.
Draws record differently, so the version moves; the runtime-sources pin is recomputed.
Verified by perdraw: gem10 job 9125 (clippy plain and cpu_icd, rustdoc, draw_again 16/16, runtime
lanes on lavapipe 1931/1931, runtime suite 1907/1908 with the one failure the old owned_kernel_builds
assertion a5cc119ae9 fixed); A/B 9122: ws -3.9% instructions per draw, rebound 23936 -> 31680 of 32000.
Matching the rebound path's answer after it returned moved its Again (which
holds an Error) through a local: draw_costs 10k, whose draws are all
rebound, took 31 more instructions a draw at a027a28691 than at 403c3e035a.
Each place that stops a rebind now counts it and returns Again::No.
(cherry picked from commit a0f027cdb53087a3c0b1cc5554aa7208b1a4c13d)
A guest's composite (the 780M glass drag) rebound 0 of about 261 draws,
though some of its gaps between draws call no forgetting call. These
counts tell why: draws_unkept, a direct draw that recorded and kept
nothing, with the groups of conditions it met (a step of its own or a new
instance, a barrier, a shadow or snapshot, a heap, handle, sampler or root
table or push hole, an index copy, a write, a pipeline still being made,
or none of those); draws_unlike_kept, a draw whose encoder kept a draw of
another call, arguments, state, command buffer or Under; and
draws_rebind_stopped, a draw of its kept draw again after calls that took
every step. The switching test checks the first two on its draws. The API
signatures table is blessed.
(cherry picked from commit a027a28691a3cb6d4022e320047e16cbeaa5d5a3)
A pipeline state's draw after draws of others is rebound from its own kept
draw only where its tables still list every change since that draw read them.
draw_costs ws switches between 4 states every 4 draws, each draw binding 2
fragment slots and a sampler every switch: about 27 fragment-table changes
come between one state's draws, past the 16 to 32 the table kept, so only
1,408 of its 8,000 switching draws were rebound (25,344 against 23,936 at
the base). 64 to 128 hold them, and a reader still scans back from the
newest change alone.
(cherry picked from commit 403c3e035acd3a5e1e71506152f7cb3a1ac5bcbf)
With a bind state per pipeline state, the entry state's draw after the slot
state's (and after the marker's) starts from its own state's bind state, with
the uses its last draw worked out: it makes none, and notes them again, as
the encoder keeps only its last draw's noting apart. The tests and their
docs say so; the debug build's kept-use checks still run on those draws.
(cherry picked from commit a97149a346e5af672e1f75c55ebca1f99ec9207e)
Two pipeline states of one function pair (blending apart) share their base
variant's interface, so the encoder's set-aside bind states, chosen by
interface, held one state for both: the per-state kept draw of one was
always lost to the other's draws (the switching test's rebound count was 0,
and draw_costs ws rebound only 1,408 more of its 8,000 state switches).
Each bind state is now named by the pipeline state whose draw left it
(WeakRenderPipelineState, which keeps the allocation, so the name is exact).
A draw starts from its own state's, else from a free one, else from the
freshest read through its interface (as before, once every slot holds a
live state's), else from the one set aside longest. The kept draw taken
with it must name the drawing state too.
(cherry picked from commit 95d3424563a9e112c8f4bebfc548adf122bfc3a1)
A render encoder kept one draw to draw again or rebind, and every set_render_pipeline_state
forgot it, so the first draw after each switch took every step. On draw_costs ws --heap (lavapipe,
gem10 8940) a draw that takes every step costs about 31.6k instructions and a rebound one about
9.0k, and the compositor's walks on the 780M and the Iris show the every-step path on top
(draw_resident, settle_draw, instantiate, Recording::record).
Now a pipeline state set keeps the kept draw. At the next draw through another state, the kept
draw goes aside with its state's bind state in LiveBind, together with the storage its draws write
(commands, pushes, uses, pushed set 0, dynamic offsets, vertex buffers and starts, the rebound's
kept storage), and the draw starts from its own state's, taking the draw kept there where it was
kept under the encoder's epoch. Such a draw is between (Kept::between): its next draw is rebound
whatever its tables' stamps, its uses noted, added and gathered whole, every state command its
record does not hold recorded, and no draw-moved shortcut taken. The epoch is drawn afresh
whenever kept draws are forgotten: at every call but a bind or a pipeline state set, as before,
and now also after a draw that keeps nothing, so the draws between a set-aside draw and its next
are each kept or drawn again, into the same instance. A kept draw names its pipeline state
(WeakRenderPipelineState), as two states of one interface share a bind state.
Test: draw_again::draws_switching_pipeline_states_rebind_each_state_s_last_draw (two states in
turn: every draw after each state's first rebound, the same commands, state commands and pixels
as every step; a state whose draws write memory between leaves nothing rebound). In builds with
debug assertions every second such draw takes every step and checks what it worked out.
Verified: cargo fmt; builds, the suites and the ws A/B run as potluck jobs after this commit.
(cherry picked from commit 6c43c5f68b2f6e07eba76ff2b51c930ef849b03e)
Round 058's cost leg printed "the run stopped: a call did not answer, at
MTLPixelFormatRGB10A8_2P/..." for format-footprints-two-plane-ten-bit, which
read as a hang. The case had stopped at its known typed refusal,
Unsupported{Format, NotImplemented}. Both stop lines (cost's and times')
fell back to "a call did not answer" for any abort whose failure names no
device gap.
A Failure now keeps the typed runtime error's text where it is one
(Failure::of, kept through at_step and at_resource), and Abort::stopped
makes the line both sites print: what the venue lacks, else "refused
<error>", else "a call did not answer" for a failure outside the runtime's
typed errors (Failure::named, Failure::unavailable).
Test: tests::a_run_stopped_at_a_typed_refusal_reports_the_error.
The 14 recordings whose "stopped" text reads "a call did not answer"
take the new line at their next cost write, where their abort is typed.
(cherry picked from commit 0073cfd7cbb0e433414bbbdd2ae86ad828a439b0)
A run records one more count (run_imports_made: an object's run, its re-import after an idle release,
a copy's ranges alone, a copy's lists), so frees of host imports can be split into run, chunk and object
imports. The runtime-sources pin is recomputed.
Verified by radvruns on gem10 (job 9071): clippy in three configs, rustdoc, api_signatures and
api_surface, host_ram suites 70/70 on RADV and on lavapipe, and a negative control of the window test.
A consumer's boot on an RTX 5080 freed host imports at a high rate
(memory_frees.host_import) while host_imports_live only grew, and its counts
could not say which imports churned: run_imports_live is a gauge,
run_bound_buffers_made counts objects alone, and a copy's ranges imported
alone were counted nowhere once freed. run_imports_made counts every import
of runs as it is made (an object's run, its import again after an idle
release, a copy's ranges, a copy's lists). With run_imports_live it gives
the run imports freed; with host_ram_chunks_imported and
host_ram_chunks_live, the chunk imports freed; what is left of
memory_frees.host_import is objects' own imports.
Test: the window test's scatter outside the window now also asserts that its
page's import alone counted made once, and gone with the copy (0 where
AliasedImportBlitsUnordered makes it import the chunk). api_signatures.tsv
has the field.
(cherry picked from commit 8bbe67f4640fc21deea6edb1e6b35d7eb607d507)
LLVM's writer gives an empty partition the offset its string table had
reached, so no FUNCTION record of the fixtures had a zero tail and none was
cut to version 1's 15 fields (gem10 m3-max-9055: 0 cut, 5172 kept longer).
The offset now counts as unset where the partition's size is 0.
(cherry picked from commit f1c0c0d5b2e5548f1f1740f2f796e6acc5c9d476)
The entries' operands were inferred as a slice from vst_record's argument;
they are owned vectors.
(cherry picked from commit 28aef25631603f281013e1097a8d1c14832a20f3)
vst_record read the characters of any record before matching its code; a code
it does not abbreviate is now written unabbreviated before its operands are read
as characters.
(cherry picked from commit a507f448ca63b001225486ee648219a9e6f54e32)
reims's macOS 11 descriptions (VectorKit's clear shaders) put the version-1
modules in LLVM 4's layout: an empty producer, a BLOCKINFO of LLVM's four
symbol table abbreviations, FUNCTION records of 15 fields, no
SYNC_SCOPE_NAMES, the module symbol table's ENTRY and FNENTRY records
abbreviated, the latter through three abbreviations of its own. The
re-emission wrote 19-field records unabbreviated with no BLOCKINFO, so the
reader's first pass never met a BLOCKINFO-abbreviated symbol table and no
record was version 1's own length.
The re-emission now writes that layout: BLOCKINFO after VERSION; every
symbol table record (module and function) through the abbreviation LLVM's
writer picks for its characters (char6, 7 or 8 bits), the module's entries
last value first, as a hash order would; FUNCTION records cut to 15 fields
and GLOBALVAR to 6 or 12 where the cut fields are 0; SYNC_SCOPE_NAMES left
out where it holds only the two built-in scopes; the producer and epoch
through their own abbreviations. The decode test counts the records cut and
the blocks left out; the translation test writes an empty producer.
(cherry picked from commit 74f4d2b77c13b6367b71c9f6bd9eba8b892114d0)
check_bodies counted the version-1 function entries it matched and
compared the count with the entries, and required no more entries than
defined functions. Neither can fail: a version-1 record refuses a
function offset on a global or a declaration, and each value id has at
most one entry, so every entry names a distinct defined function, which
the loop matches. Version 2 keeps its one-entry-per-defined-function
check. The two no-VSTOFFSET arms are one arm.
No behaviour changes; the air suite's symbol-table tests cover both
versions.
(cherry picked from commit f98b303d8db6092e3df6625d79feab619bb18a6e)
Round 058's M3 cost leg (at f84816ddec) failed on 18 gated counts in five
cases, all of them down. d119fdeca7 ("YCbCr conversion: make its staging
buffer, sets and refresh at its first conversion") moved all 18: a
two-plane texture whose planes are read in place no longer pays for the
conversion's staging buffer, copy and sets when it is made.
The contrast is a whole-set `cost --runs 8 --check` on the M3 (MoltenVK),
run against the records then in the tree (m3-max-9015):
- At 2ade9a7971, d119fdeca7's parent: no gated bound moved.
- At d119fdeca7: exactly the leg's 18. It was built with ed618c7102's
one-line fix (self.refresh -> made.refresh), since d119fdeca7 and
dfdbca7d72 do not compile without it.
- surface-fills-over-planes-and-buffers: command_buffers_begun 38 -> 23,
command_buffers_begun_batch_work 19 -> 4, command_buffers_submitted
38 -> 23, cmd_copy_buffer 34 -> 19, cmd_pipeline_barrier 53 -> 23,
end_command_buffer 38 -> 23.
- ycbcr-minify-band-x: command_buffers_begun, command_buffers_submitted
and end_command_buffer 5 -> 4.
- ycbcr-gathers-edge, -zero and -white: the same three, 12 -> 10.
Alone (`cost --runs 8 --alone --show`, m3-max-8997), the five cases'
counts are equal at 0578e213c0 and 2ade9a7971. They move at d119fdeca7
(with the fix) and hold at every later commit measured through
67e38e3e9a: dfdbca7d72 (with the fix), ed618c7102, 26db05e481,
be9e3547b2, b15443f18d, ded385b661, 31bfbd22a9, 8329c9e954, f84816ddec.
Written at 31e642ecc2 the way s37-job.sh's record leg writes: a whole-set
`cost --runs 8 --write`, every recording outside the five put back, then
`cost --runs 8 --alone --write` of the five. A whole-set
`cost --runs 8 --check` afterwards moved no gated bound and no ceiling
(0 of the 95 differences is a number the gate reads).
The leg also printed "the run stopped: a call did not answer, at
MTLPixelFormatRGB10A8_2P/..." for format-footprints-two-plane-ten-bit.
That is the case's known refusal (known-gaps.tsv). The check passes over
a case that stopped, so it did not fail the leg.
(cherry picked from commit 2ba47889a63898aff3ebbb4a2bba0a4edf142e17)
What: the accepted differences' "Process exit" names what the exit hook's registrar leaves: a
making on the program's own thread, which the exit does not wait for, and destructors the
driver's compiler registered in the last 2 ms before the exit (or past the registrar's 16384
registrations), which can run beside the compile, where Metal compiles in another process.
Why: the registrar (RUNTIME_VERSION 1899) closed the rest of exit_guard's hole for makings on the
runtime's threads; what is still open is a consumer-visible difference, and one such exit (a
consumer's making thread left running) ended its process with SIGSEGV inside NVIDIA's SPIR-V
compiler on the RTX 5080.
How verified: docs only; the figures are exit_guard's MAKING_INTERVAL and MAKING_REGISTRATIONS.
(cherry picked from commit 5f1846a295017a2244fde27cdd2ed3db97bdb9cb)
What: a child's case name no longer takes an @bare suffix, which ran it without the validation
layer; every child's device is the lane's validated one again.
Why: the suffix served the exit-crash probes (loops with and without the layer on the RTX 5080,
the XTX and lavapipe, which faulted in neither form); no test of the lane names it.
How verified: the lane builds and runs its children as before (gem10, the RTX 5080).
(cherry picked from commit 87fe0b663ff2d0a443e98ee425fa5e0d92f96b65)
What: an_exit_mid_making_is_clean runs first_making_exit beside making_exit: the same exit while a
pool's thread makes a dispatch's pipeline, with no making of the kernel before it, so the pool's
making is the process's first and the driver's compiler makes its statics, and registers their
destructors, while it runs. Each case's mark is checked; the registration after a program
thread's making only for making_exit, which makes one.
Why: that is the exit the registrar (exit_guard, "Registered again") covers. With an LD_PRELOAD
shim logging exit handlers on lavapipe (Mesa 26.2.4, LLVM 23), in 1 of 3 such exits before the
registrar, destructors LLVM registered 1 to 2 ms before the exit ran before the hook, the compile
going on. The lane now runs that exit on every device.
How verified: the exits module on lavapipe (gem10) and the RTX 5080 follow.
(cherry picked from commit e3cdfa528cedfd6c0efb8f7a2af0ff19dedc5ef6)
Its product fingerprint follows development's versions at 14f1ce3657. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit da66b91b0eee2cf026b0c31b0347aaa26e43629c)
Buffer hand-outs (vk_buffer) now wait for the first work on the VkBuffer they return, reading it
apart once, and HostRam copies keep their page lists past the copy for the next copies of the same
pages (bounded at 64 MiB / 16 lists). Both change what a run submits, so the version moves; the
runtime-sources pin is recomputed over the merged sources.
Verified by radvruns: lavapipe suite on gem10 (job 8970) 1910/1911, clippy in three configs,
rustdoc; a same-host A/B on um790's 780M (job 8986) for the kept lists. Doc checks rerun here.
HOWTO, the runtime README and FAST-PATHS still said a copy's lists were
freed with its command buffer and that every copy pays its lists'
imports. They now say each list is kept past its copy for the copies of
the same pages after it (at most 64 MiB and 16 lists, released once no
copy took one for 2 s), and they give the numbers.
The numbers come from tests/host_ram_listed_bench.rs on the Radeon 780M
of one host (um790, RADV, kernel 7.3.1). The kept tip was run with a
timing probe that never lands, then again with the bound sabotaged to
(0, 0), which keeps nothing, back to back. Medians are commit to
completion, then encode:
- A 5 MiB device cache filled again: 0.37 to 0.43 ms and 0.2 to 0.4 ms,
against 3.0 to 3.2 ms and 0.7 to 1.0 ms with no list kept. Over an
imported chunk it takes 0.37 to 0.40 ms and 0.12 to 0.14 ms.
- A surface-shaped tile's download after its fill: 0.53 to 0.60 ms,
against 4.0 to 4.2 ms.
- A scattered tile's download: 0.46 to 0.50 ms, against 0.98 to 1.04 ms.
- A copy that imports pays the lookup through the kept lists: 48 to
63 us for a surface tile, 250 to 290 us for 1,800 scattered runs
against 16 lists.
- The scroll's 24 visible tiles pass the 64 MiB bound (about nine
tiles), so a third to a half of their repeated fills took a kept list.
- Residency is the same with and without kept lists: 4028 of 8192 MiB,
and 8300 of 16384 MiB.
(cherry picked from commit ee030ba7ed497aeb4bf0c92653cc33078e987379)
A copy over chunks not imported, of a RAM with a source of run lists, paid
its lists' imports every time: on the Radeon 780M a surface-shaped tile took
4.1 to 4.5 ms from the commit to the completion where a copy over an imported
chunk takes 0.39 to 0.48 ms, first copy or repeated, and the probe that kept
the lists brought repeated copies to 0.55 to 0.60 ms.
Each list a copy imports is now kept by the RAM's use on the device
(host_ram/kept.rs) and taken by the copies after it for every run of theirs
one of its runs holds whole; their other runs take lists of their own. The
kept lists hold at most 64 MiB and are at most 16, the least recently taken
let go of first; the device's thread for the RAM (listed_chunks) lets go of
each no copy took for the idle window (2 s) and no command buffer holds, every
tick, whether or not the plan releases chunks; the use's end lets go of all.
Residency is unchanged: a list's pages were made resident by its import and
stay in the file once it is freed; kept, they stay pinned, and each kept list
is one more import every submission lists.
Tests: kept.rs's units (taken whole or not at all; the least recently used
past the bytes or the count; idle ones not held); the dma-buf tile and
residency tests now expect the scatter after a gather to take the gather's
lists and import none, the lists to stay live past their copies, and the
device's thread to let them go within 5 s. Docs: with_dma_buf_of_runs,
use_host_ram, Imported, the module docs, host_ram_run_list_imports and
run_imports_live.
(cherry picked from commit 86b0de84551210c31d01af1d7f35e8f468ec4e5b)
28dcdcaed2's hand-out read the buffer's VkBuffer a second time, through
Buffer::at, to find the fills waiting on it. A no-copy buffer's import
counts each read apart by its reason, so vk_buffer of a no-copy buffer
now counted a Binding read beside its VkBuffer read. In the lavapipe
suite (job 8946), host_import_counts::each_read_apart_counts_for_its_reason_once_and_each_import_for_its_keeping
read [1, 1, 1, 0, 0, 0] where it expects [1, 1, 0, 0, 0, 0].
settle_first_work now takes the VkBuffer from its caller. vk_buffer reads
it once, for VkBuffer, and settles with it. export_memory_fd passes its
own buffer's, which is no import. hand_out only notes the hand-out again.
(cherry picked from commit 3d3ea570b4f1d90263c22a1f7456bb1a94264f9f)