RUNTIME_VERSION 2071: the runtime's own runs of memory frees step aside for the device's submissions

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).
This commit is contained in:
Anees Iqbal committed 2026-11-11 17:54:36 -08:00
1 parent b7d06c3820
commit 8db2f6f5c8
1 file changed
+1 -1
+1 -1
View File
@@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 502;
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
/// keeps no history.
pub const RUNTIME_VERSION: u32 = 2070;
pub const RUNTIME_VERSION: u32 = 2071;
/// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex,
/// of the manifest, the build script, and exactly the files the crate roots' module tree compiles