On an RTX 5080 Laptop GPU a 64 KiB copy in a frame took 0.336 ms (p50)
through the fill queue and 0.234 ms at the start of the batch's work, and
1 MiB the same either way (job 18108): the sizes between them place the
crossover, and 4 KiB the smallest copies.
Verified: cargo fmt; device runs follow.
The order leg wrote the Managed buffer's host copy again once the command
buffer that took the first copy in was only submitted. That copy reads the
host copy when the GPU runs it, so the write raced it: the leg failed on an
RTX 2080 with the fill queue and on an RX 7900 XTX without one (jobs 17974,
17975), the inline path too. Metal leaves the host copy to the CPU only once
the copy in ran, so the test now takes the first copy in with a command
buffer of its own that completes, then keeps a second one, whose blit reads
the device copy behind a long run of kernels, in flight while the CPU writes
again and a third takes that copy in, which must follow the blit.
Verified: cargo fmt; device runs follow.
A copy in noted before a committed command buffer's submission is that submission's, as the
runtime's contract says (the device's next submission takes it): on the RTX 3090 the first
command buffer's submission took both copies in, read the second bytes, and made the one
fill-queue submission.
A Managed buffer there is one copy, which the CPU's write races while a command buffer reads it,
as on Metal; lavapipe read the second pattern in the first command buffer.
A fill-queue submission waits for the batches before its batch, and one of those may wait for a
signal the caller reserved, so taking a command buffer by a wait on the host could hold the
scheduler's thread until the caller submits. The batch checks for room first (a command buffer
whose submission the host saw complete, or fewer than BUFFERS) and keeps its fills at its start
where there is none.
device/staging.rs documents the fill queue: why (a copy through the graphics family runs on the
engine the kernels run on; the 3090 and 5080 numbers so far), why not the staging queue, what it
waits for, what waits for it (with the spec's semaphore and sharing text), what it holds, and what
stays where it was. first_move.rs and managed_copy.rs say where a batch's fills go. Queue counts:
the plan takes 18 queues on NVIDIA now, so the measured 17- and 2-queue devices are named by their
queues, and the least plan keeps the fill queue as it keeps the staging queue.
The bench runs both paths on one build: the default device, and one whose extra transfer queue
takes the copy engine's second queue, so its fills stay at each batch's start; and sizes from
64 KiB, for a size crossover.
On a device with a family of transfers alone that has a second queue (NVIDIA's copy engine), a
batch's buffers' fills (zeros, staged bytes, Managed buffers' copies in) are recorded in a
submission of their own on that queue, which waits for the batches before it on the batch's
VkQueue, what the batch waits for and what completed, and which the batch waits for. Every other
submission waits for the fill queue's last until the host saw it complete, as for the staging
queue. Buffers are already concurrent with that family (sharing.rs), so no ownership transfer.
Not yet built: a build and the device tests follow.
Each frame the CPU writes a Managed buffer of 64 or 256 MiB whole and tells it (did_modify_range,
which the runtime copies into its device copy by the next submission), and a command buffer runs
a kernel over its first floats into a Shared buffer, checked. Beside it, optionally, another
queue's command buffers of 24 dispatches over 64 MiB Private buffers, two in flight. Prints the
frame's wall time, the load's rate against the load alone and each phase's host time span, for
the copy-engine work's before and after on discrete GPUs.
Not yet built: the first build is a potluck job.
A measurement of its own Vulkan device (no runtime): copies between host-visible memory and an
optimal image or a device buffer, 64 KiB to 256 MiB each way, on the graphics family's first
queue and on the first queue of a family of transfers alone (else another compute family), alone
and beside a compute load on the graphics family's second queue; and a copy the next dispatch
waits for, in one submission or across a timeline semaphore. Each phase prints its host time
span so nvidia-smi dmon samples can be placed in it.
Not yet built: the first build is a potluck job.
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 branch before this commit stops importing the same host addresses twice. A buffer or texture
over a guest RAM chunk that wasn't imported yet, or a copy over one, was bound in an import of
its own run, made from the run's host pointer, while the device's thread imported the whole chunk
from its pointer. That left two live imports of the same host addresses, and the run's was freed
while the chunk's lived. VK_EXT_external_memory_host leaves importing the same host allocation
twice undefined (issue 6). It is the lead for the NVIDIA present stall on the 3090 and the 2080
eGPU.
Now a run is imported alone only on a listed plan, whose chunks and runs are dma-bufs of the RAM's
source, and a run's import never falls back to its pointer. Everywhere else an object or a copy
over a chunk lies in that chunk's one import, made or waited for, as on MoltenVK and ANV. The cost:
a making waits for a chunk the import window hasn't reached yet. imports_inside_live now counts
every import made over host addresses a live import holds (heaps included, on the making and
rebind paths). A new evidence counter, ObjectChurn::imports_over_ram_chunk_pages, counts a view's
own import over guest RAM pages that a live chunk import holds. host_ab prints both, plus
buffers_bound_in_import. HOWTO and API.md describe the single import and its cost.
Verified (potluck jobs, on the branch):
- lavapipe, full runtime suite: 2200/2200 at the tip (m3-max-18365) and at c6f775cefe (18331).
- The one_import device tests' counts show their paths ran: [pointer imports, bound in import,
copies over live, imports_inside_live] = heap first [1, 2, 1, 0], buffer first [2, 1, 1, 0].
- Lint (m3-max-18364): clippy workspace all targets all features; the runtime with --cfg m2v_gpu
and with --cfg m2v_gpu --cfg m2v_gpu_hazards; rustdoc -D warnings; api_signatures/api_surface.
- metal2vulkan with no feature and with each alone (18340).
Not yet run: the NVIDIA device tests at the tip; the opt-in hazard test
(tests::import_overlap_hazard) on gem10's 3090, before and after; the consumer's NVIDIA walks.
Two tests under m2v_gpu with m2v_gpu_hazards, on Linux. One makes objects
over chunks of a fresh guest RAM the device's thread has not imported
(each a jump past its window), writes and reads them by blits, makes a
second buffer over the same pages, and drops the first: 6 RAMs of 24
chunks. The other maps 32 views of 512 scattered memfd pages, makes a
no-copy heap over each, a buffer over exactly its bytes and 32 buffers of
64 to 384 KiB inside it, each blitted and dropped while the heap lives.
A runtime that imports those runs or sub-ranges by their own pointer
frees each such import while the larger import of the same pages lives.
Each prints the import and placement counts that say which path ran;
the job reads the kernel log. Not yet run.
API.md's copied-host-pages entry gains the over-a-live-import cause
(copied_over_live_imports, announced once per device as the others are).
HOWTO's listed-plan paragraph described its runs alone "as above", text
the previous commit removed: it now says what a listed RAM's run import is
(a dma-buf), what it costs, how it orders, and that MoltenVK and ANV import
the chunk instead.
host_ram_device's window, down-the-RAM, margin and ordering tests expected
an object over a chunk not imported to lie in an import of its own run on
every device but MoltenVK and ANV. A RAM with no source of dma-bufs has
chunks imported by their pointer, and its runs are no longer imported
alone beside them (RamOnDevice::runs_alone): each test now asserts the
object imports its chunk and no run import lives. The two ordering tests
are renamed for what they order now (two buffers in one chunk's import, a
chunk-bound buffer and copies). runs_alone moves to the dma-buf tests,
whose listed RAMs still import runs alone, and kept_in_its_run goes with
the run imports it kept. The defect's evidence keeps its measurements
without the old test names.
An object over a chunk not imported yet, and a copy over one, was bound in
an import of its own run alone, made by the run's host pointer while the
device's thread imported the whole chunk by its pointer: two live imports
of the same host addresses, the run's freed while the chunk's lived.
VK_EXT_external_memory_host leaves the same host allocation imported twice
undefined (issue 6). Runs are now imported alone only on a listed plan,
whose chunks and runs are dma-bufs of the RAM's source, and a run's import
never falls back to its pointer. Elsewhere every object and copy over a
chunk lies in its one import, made or waited for, as on MoltenVK and ANV.
The price is a making that waits for a chunk the window has not reached.
imports_inside_live now counts every import made over host addresses a
live import holds: a no-copy object's own import over another's (heaps
included) or over a live chunk import at the same addresses, and a
chunk's import over a live no-copy import, on the making and rebind
paths. A new evidence counter, imports_over_ram_chunk_pages, counts a
view's own import whose guest RAM pages a live chunk import holds at the
RAM's addresses. host_ab prints both and buffers_bound_in_import.
Not yet verified: built and tested next on lavapipe.
The first build of ed11f23e9a failed: bind_in_import read Pages' private
memory field, InImport's Debug printed handle flags ash gives no Debug for,
and a test's heap binding shadowed its heap helper. Found by potluck job
m3-max-18250 (lavapipe build on ms01).
VK_EXT_external_memory_host leaves a host allocation imported twice into one device
undefined (issue 6: "Some platforms do not allow locking the same physical pages for device
access multiple times, so attempting to do it may result in undefined behavior"). The runtime
imported the same pages twice in several ways: a heap's own import was never noted in
HostAliases, so a no-copy buffer over exactly a heap's bytes, or over part of them, imported
them again (the consumer's guest heaps over 2 MiB page-block views, and the block's view as a
buffer); a buffer over part of a live buffer's bytes imported its own (counted,
object_churn.imports_inside_live: 34 in one 3090 walk); and a heap over a live buffer's bytes
imported its own.
Now:
- a heap's own import is noted (HostAliases::hold), joining no key;
- a buffer or heap over exactly a live import's bytes lies in that import (a heap keeps its
heap identity);
- a buffer whose window a live import holds all of is bound inside that import's memory at
its offset, with a VkBuffer of its own and no import (Device::bind_in_import,
Placement::in_import, which holds the import; the import is exposed, so never released
while idle); counted object_churn.buffers_bound_in_import;
- a buffer or heap whose window a live import holds some of and not all, and a heap a live
import holds more than, is a copy (CopiedBecause::OverImport, copied_over_live_imports,
announced copied-host-pages);
- rebinds take the same rule;
- imports_inside_live now counts only imports made where a live one held some of the pages
all the same (two buffers made at once).
Tests: host_aliases unit test a_page_a_live_import_holds_is_never_imported_again; device
tests one_import (heap first, buffer first). Not yet run: this commit is for the build.
The known gap on the cold making of a 200,000-word compositing module ended "Nothing is built
around it", which was not true. It now names what is:
- the driver records across boots (`shader_cache/driver.rs`), named by the driver's identity, so a
driver update, another device or a removed content directory makes every making cold again, and
no machine's records serve another's;
- pipeline records and `Device::warm`, which remake a previous process's creations on a thread of
their own below every other making, and what they do not cover today (a compute state that
states no required threadgroup size predicts nothing, so its dispatches' pipelines are made at
their first dispatch);
- `PipelineWaitPolicy::Bounded` at creation and at commit, and dispatches that hand their making
to the pool;
- the consumer's creation of guest states on a compile thread off the guest's command path.
It adds the compute case: a convolution kernel's 12 variants at a macOS 12.7.6 login, one SIMD8
program each of 6,222 to 8,925 instructions with 70 to 221 spills, and the host-load
sensitivity that made the same login's makings 2 to 13 times slower than alone.
Measured on the Iris Xe (Mesa 26.2.6), the dumped modules made by a scratch harness with
the logged specialization, one module of its own per making, the driver's disk cache off:
- the 23,108-word variant alone 0.27 to 0.34 s (jobs 18284, 18292); 11 at once 0.31 to 0.53 s
each, 0.50 to 0.53 s for all (18293); device robustness on or off alike (18292);
- the 138,047-word fragment module alone 2.03 to 2.42 s, two at once 2.42 to 2.53 s each, four
at once 2.69 to 3.33 s each (18284);
- under 20 and 30 busy threads on the 20-CPU host, that fragment making 6.27 and 7.94 s, and 11
kernel makings at once under 20 busy threads 0.78 to 1.44 s each (18293);
- the program counts from INTEL_DEBUG=cs (18226).
The login's own numbers (4.87 s; 1.5 to 4.2 s, 10 or 11 at once; the guest's 1 to 197 command
buffers a second during the making) are the consumer's cold-login log at the 12.7.6 capture; the
3.1 ms warm making is the consumer's warm boot.
Docs only.
On the M3 through MoltenVK, a 27.0.1 guest's widget glass drew white strips or a comb in 8x4
blocks at its vertical edges, in every saved screen. The widget's gradient draw writes colour 0 in
the storage form and ends in an OpSelect whose one value operand is a NoContraction add, picked
where coverage is below a bound. SPIRV-Cross inlines that single-use operand into the ?: arm, so
the [[clang::optnone]] add runs only in lanes past the gradient's vertical edges: the quad
helpers. That is Apple's recorded store-drop shape (DriverWorkaround::DiscardDropsSimdgroupStores):
a call only helpers make, then a storage write, and the simdgroups at the edge lose the draw's
writes. spirv::helper_branches looked only at branches, so the select was neither guarded nor
fenced, and no note was recorded.
Now the helper guard treats a non-branch path to a call as a branch: a scalar OpSelect value
operand, a scalar OpLogicalAnd/OpLogicalOr right side, or a reader inside a non-uniform
selection arm, reached through single readers. Such a call gets the fence the branch form gets
(an identity OpGroupNonUniformShuffle after it, which SPIRV-Cross writes inside the arm). Where
the fragment stage can't shuffle, the pipeline records PrecisionNote::HelperBranchDropsSimdgroupStores.
The guard runs only on a profile with DriverWorkaround::DiscardDropsSimdgroupStores (MoltenVK on an
Apple GPU), so no other device's module changes. It is exact and takes no switch. Docs: API.md's
degrade-notice catalogue and artifact.rs name the new case.
Tests: fixture rch_helper_select (our own MSL: a NoContraction sum picked where coverage != 1,
with no branch), lane runtime_lane::helper_select, unit tests on modules built in the test (an
arm-read call fenced; loop-read and uniform-arm calls not).
Verified (potluck jobs, on the branch):
- M3 MoltenVK 1.4.2 (m3-max-18169), helper_select: without the fix rch_select_arm and
rch_select_and lost 174 covered pixels' writes each, in whole groups, fences 0, no note; with
it fences 1, 0 lost, 0 extra, no note. The two controls (the pick an implicit-LOD sample reads
after it; the pick on a constant-buffer flag) unchanged at fences 0, 0 lost. helper_tangle and
discard_fetch_groups unchanged.
- GPU time on the M3, worst case (every fragment of a 1024x1024 pass takes the arm): 32 draws
2.874 -> 3.125 ms, least of 5 command buffers (+0.25 ms per 33.5M fragments).
- Golden tables on the M3 (18216): exactly 4 rows move, rch_select_arm and rch_select_and in
both spellings, in the moltenvk-m3 cell alone; no other fixture's cell on any profile.
- clippy plain, --cfg m2v_gpu, --cfg m2v_cpu_icd and rustdoc -D warnings (18210).
Expected, not yet run: the consumer's 27.0.1 boots at the fix against its base.
On the M3 at 86884548c8 (m3-max-18216): bless_engine_inventory took 0 moved cells and 10 new rows, all rch_helper_select's; bless_engine_goldens wrote tests/air_input/rch_helper_select.txt under the pinned LLVM 21.
The catalogue entry and the variant's rustdoc name the new case: a ?: arm, the right side of a && or ||, or a selection's arm, where the call's value is read once (spirv::helper_branches).
tests::engine_helper_picks builds fragment modules that sample at LOD 0, add 1 to the red with NoContraction in the entry block and store the sum once: in the arm of a selection on the coordinate (fenced on moltenvk-m3), in a loop body, or in the arm of a selection on a specialization constant (neither fenced); intel-arl-anv fences nothing. SPIRV-Cross writes the first call inside the arm and keeps the loop's at its definition (checked with Homebrew's spirv-cross on synthetic modules).
The fixture rch_helper_select's companions (scripts/regen-air-fixtures,
m3-max-18157): every pick is an AIR select, which the translator writes as an
OpSelect and SPIRV-Cross as a ?: whose arm calls spvFAdd.
runtime_lane::helper_select draws the 32x16 triangle of guarded_effects with
each function and checks every covered pixel's write against Metal's answer:
no write may be lost where the fragment records no
HelperBranchDropsSimdgroupStores, on a device with the defect the ?: arm and the
&& right side are fenced (or noted without a fragment shuffle), and the pick a
sample reads after it and the pick on a constant block's flag are left alone.
a_fenced_pick_s_gpu_time prints the GPU time of 32 draws of a 1024x1024 pass
whose every fragment picks the sum, and checks every texel.
tests::engine_fragment::a_helper_call_a_select_picks_is_fenced holds the same
forms on moltenvk-m3, on it without the fragment SHUFFLE (the note instead),
and on intel-arl-anv (nothing), each module through L3.
Verified so far: nothing; the M3 runs before and after the fix follow.
With a buffer load in the picked arm, the compiler kept a branch (the load is not speculated), which the branch analysis already covers. Summing components of the sampled colour lets it speculate the addition into a select.
Fragment functions, without fast math so every float operation is
NoContraction (SPIRV-Cross's optnone spvFAdd), that read a coverage texture,
sample at LOD 0 and pick, where the coverage is not 1, a value an addition
makes: as a component (rch_select_arm), on the right of a && after the
coverage test (rch_select_and), as a coordinate an implicit-LOD sample then
reads (rch_select_sampled), and on a constant block's flag
(rch_select_uniform). Each writes a texture after it. The compiler writes each
pick as a select, and SPIRV-Cross writes that as a ?: whose arm holds the call.
The .ll and .air.ll companions follow from scripts/regen-air-fixtures.
SPIRV-Cross moves an expression read once into what reads it. An optnone call
(a NoContraction FAdd/FSub/FMul, QuantizeToF16, MulExtended, Reflect) outside
every selection and loop, whose value reaches through single readers a value
operand of an OpSelect on a scalar condition, the second operand of a scalar
OpLogicalAnd/OpLogicalOr, or an instruction inside a selection's arm, is
written in that arm: `cov < t ? spvFAdd(a, b) : c`. Where the condition is
not draw-uniform, only the quad helpers past a primitive's edges may take it,
and on MoltenVK on an Apple GPU (DriverWorkaround::DiscardDropsSimdgroupStores)
Apple's compiler then loses the simdgroup's texture writes after it. The
analysis looked only at branches, so such a call was neither fenced nor noted.
Facts::conditional follows the chain (a value read more than once, a phi or
terminator operand, an instruction without a result, or a reader inside a loop
the call is outside ends it: SPIRV-Cross keeps that value where it is defined,
checked with Homebrew's spirv-cross on synthetic modules). Such a call is
counted as one inside a construct: fenced by the identity shuffle where the
fragment stage shuffles, else PrecisionNote::HelperBranchDropsSimdgroupStores.
The per-instruction write test of the open blocks is now linear in the block.
SEMANTICS_VERSION 2039: modules with such a call get fences on profiles with
the workaround.
Verified so far: nothing; the lane and unit tests follow.
host_residency::a_texture_in_place_over_a_dma_buf_import_leaves_it_releasable waited for the
device's in-place checks within SETTLE (20 s), the bound for an import's release. On ms01's Iris
Xe in the round at d0f800ddd0 (m3-max-18134) the checks took longer and the test failed with "the
in-place checks never answered" at 27 s, while the in-place check's own tests in the same run
passed at 47-56 s. It now waits CHECKS (120 s), the bound in_place_check.rs and copied_device.rs
use. Test-only.
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 compute pipeline's line in METAL2VULKAN_LOG_PIPELINES named the kernel's function, its SPIR-V
hash and length, its specialization constants and notes, but not what the kernel was made from:
a cold boot's slow compute creations could not be made again off the device, because the
function's Metal constant values were nowhere in the log, and METAL2VULKAN_DUMP_PIPELINES wrote
render modules only.
The compute line now ends with `; descriptor: ` and the same naming a render state's first line
gives each function (its name, the SHA-256 of its bitcode, the constant values by index and by
name with their types and bytes), from one helper both share (`render::logged_function`). With
the dump directory set, the line's module is written there as `<hash>.spv` (`dump_modules`, the
render dump's writer, now over any modules), and a failed write is named in the line as a render
line names it. Nothing is kept or measured while the variables are unset: the descriptor's text
is made only where the log is on (`compute_kernel`).
The creation log's module doc also names the record words the split prints since the record
naming change (`record's cache shared`, `found in cache`, `compiled`).
Test: `opencl_data::the_pipeline_creation_log_names_a_compute_pipeline_and_its_notes` now runs
its child with the dump directory set, and asserts the line's descriptor (the kernel's name,
`air`, `constants {`), no dump failure, and a SPIR-V module (its magic) at the hash the line
names. It and the creation_log unit tests, and lint, run on this commit as jobs after it is made
(the report names them); a failure is fixed forward.
Records, as a known gap, what is left of the Iris Xe's cold login
creations after the records stopped naming attachment formats: the one
compile of the compositing fragment module (203,016 words, macOS
26.7.2) that every state over another format then finds in its record.
Measured with a scratch harness making the module's fragment shader
library cold, the driver's disk cache off:
- ANV, Iris Xe, Mesa 26.2.6: 3.3 to 3.7 s at load ~16 (m3-max-17871);
its program is 29,101 SIMD8 instructions, 34 spills, 10,585 non-SSA
registers.
- RADV, Radeon 780M: 1.3 to 3.0 s (m3-max-17958, -18098).
- RTX 3090, 620.70.06: 4.5 to 7.4 s (m3-max-17957, -18097).
Why no translator change: spirv-opt -O (186,314 words) and -O with
frozen specialization constants (180,402) leave ANV's NIR within 0.2%
(27,347 to 27,393 instructions) and its program within 9 instructions,
and their creations are no faster than the original's within the
run's noise (m3-max-18022, -18034, -18127). Holding half values in 16
bits across moves, phis and selects (a scratch pass on the -O module)
makes it 29,719 instructions with 103 spills. So the words the
translator emits do not drive ANV's time; the shader's own work does
(NIR: 4,163 fmul, 2,868 fadd, 1,689 ffma, 1,835 csel, ~290 samples,
30 loops).
VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT: ANV builds the same
program in the same time and the 3090 the same time; RADV takes 0.9
to 1.0 s (m3-max-18098), at a draw cost not measured. Nothing is
built around it. Doc only.
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 (620.70.06) each vkFreeMemory holds the device's other submissions while it runs, and
not only for imports: plain host-visible frees hold too. RV 2067 paced the device checks' own
allocations and frees; the runtime's other threads still freed in bursts.
Now step_aside gains a paced-thread mark and pace(): a runtime thread that frees memory in a run
waits before each free until as long as its frees before it took has passed since the last one
ended (the checks' OwnCall rule; the checks' step now counts from the calls' end too). Paced: the
free thread before each block (fresh-pages imports included); the residency thread's idle
releases (its sweep holds imports weakly while it waits, so a program's release meanwhile still
frees its import inside that release); a guest RAM's give-back of untaken chunks and its listed
thread's idle chunk and list releases. Never paced while a caller waits for the frees: an
allocation at the limit (free-thread waiters, Allocations::give_back_awaited), the device's
teardown, a guest RAM use's end. A program's own release of a no-copy buffer still frees its
import in the release, unpaced (Metal's contract). Handler threads are not paced (a wait there
would delay the completed handlers behind it). WorkCounts gains memory_frees_paced and
memory_frees_paced_nanos. FAST-PATHS known gap: NVIDIA's vkFreeMemory holds other submissions.
Tests: tests::import_free_hold_bench (ignored bench: five kinds freed in turn and paced, beside a
fill every 250 us); a posted-frees burst runs paced; the at-limit test asserts no free is paced
while the allocation waits; step_aside units.
Verified (potluck jobs, on the branch):
- RTX 3090 (18052, quiet host, two runs), fill p50 beside frees in turn -> paced: 512 KiB pointer
imports 0.46-0.50 -> 0.29-0.32 ms; 512 KiB dma-buf imports 0.47-0.54 -> 0.23-0.25 ms; 64 MiB
pointer imports 2.6-2.9 -> 0.10-0.13 ms; 512 KiB plain 1.2-1.6 -> 0.17-0.22 ms; 64 MiB plain
70-79 -> 0.15-0.19 ms (baseline 0.13-0.14 ms). Paced runs take 1.2-2.2 times as long. posted_frees
5/5 (each in its own process), burst 2 of 2 frees paced, step_aside 7/7.
- RTX 2080 (18054): the same results.
- lavapipe touched suites 130/130 (18094); clippy all features, --cfg m2v_gpu, --cfg m2v_cpu_icd
and rustdoc -D warnings (18103, 18094).
The known gap the frees' pacing answers in part: tests::import_free_hold_bench on an RTX 3090
(NVIDIA 620.70.06, quiet host, two runs) put a fill's commit to completion at 0.13-0.14 ms beside
no free, 0.46-0.54 ms beside runs of 512 KiB pointer or dma-buf imports freed one after another
(each free 0.26-0.39 ms), 2.6-2.9 ms beside 64 MiB imports (2.2-2.4 ms each), 1.2-1.6 ms beside
512 KiB plain host-visible allocations (1.1-1.2 ms) and 70-79 ms beside 64 MiB ones (28-30 ms);
paced, 0.10-0.32 ms beside every kind. An RTX 2080 on a loaded host showed pacing lower the median
beside every kind too. What stays open: a program's own release of a no-copy buffer frees its
import there (Metal's contract), unpaced, as does a completed command buffer's handler that frees
the imports its blits held last; one free still holds a submission that meets it.
tests::import_free_hold_bench measures what a vkFreeMemory of an import of host pages holds of
another thread's submissions: a pinger commits a one-word fill every 250 us while the bench's
thread makes and frees, through the runtime's doors, 32 pointer imports of 512 KiB, four of 64
MiB, 32 dma-buf imports of 512 KiB (udmabuf) and 32 plain host-visible allocations, each kind's
frees in turn and paced (step_aside::pace), printing the frees, the runs and the pings beside
them. tests::posted_frees gains a burst of posted frees that runs paced, and the allocation at the
limit now checks that the frees it waits for are not paced. api_signatures re-blessed for the two
new WorkCounts fields.
NVIDIA's driver holds every other thread's vkQueueSubmit while it frees memory, a host-pointer
import's for 0.5 to 0.9 ms on an RTX 3090. The submission checks already pay their own
allocations and frees back before their next step (step_aside::OwnCall); this applies the same
owed time to the device's own threads that free in runs: the free thread before each block, the
residency thread before each idle import it releases, and a guest RAM's threads before each chunk
or list they give back or release. Each waits until as long as its frees before took has passed
since the last ended (now also the checks' rule), never while a caller waits for those frees (an
allocation at the limit, the device's teardown, a guest RAM use's end). The residency sweep holds
its imports weakly while it waits, so a program's release meanwhile frees its import in that
release, as before. Counted: WorkCounts::memory_frees_paced, memory_frees_paced_nanos.
Not yet built: the bench that measures the hold and the paced frees follows.
tests::submit_check_device::the_checks_answer_once_and_a_second_device_recalls_them held the
device that ran the checks to the cmd_copy_buffer count of the one that recalled them, which
held while every device was primed. Since 6ce451f452 a device made again on what stays loaded is
not, so the first (primed: priming's one copy within its buffer) counted 1 and the second 0
(lavapipe, gem10, m3-max-18039 and 18111, 3 of 3). Each count now leaves out the copies the
device's priming recorded, where ExitRegistrations::primings shows it was primed.
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.