Files
metal2vulkan/docs
Anees Iqbal 49b25c189c RUNTIME 2464: Parked dma-buf images released at the next pass where held imports tax submissions; each whole guest RAM import said with its time
A parked image (an in-place image over a no-copy buffer's dma-buf pages, kept for the next
texture over the same pages) is one more imported memory on every kernel submission's list on
RADV and ANV on i915. On the Radeon 780M that costs about 0.46 us a submission (m3-max-36970:
167 against 6 listed memories, 86.8 against 13.7 us a submission), 0.53 ms a second at the 1,150
submissions a second of a guest's desktop. Held 2 s (released by the first pass at least 2 s after
the park, passes every 0.5 s), an untaken park cost 1.06 to 1.32 ms of vkQueueSubmit time, while a
take saves its texture's making: on the 780M 0.13 ms (7.9 MiB) to 2.6 ms (84 MiB) over 2 MiB
pages, 0.73 to 24.3 ms over 4 KiB pages (texture_shadow_bench, m3-max-37048, medians). In a
guest's desktop walk on the 780M, 443 of 2,098 parks were taken; at 2 s the parks cost about 2.0
to 2.5 s of submit time, which pays only where a take saves 4.5 ms or more on average.

Where Device::pointer_imports_tax_submissions holds, the residency thread now releases a parked
image at its first pass after the park (held 0 to 0.5 s, 0.25 s on average); elsewhere, where a
held import costs no submission, the 2 s window stays. The cap of 64 parked images stays.

Expected, not measured: takes come soon after their park (a guest wrapping the same surface again
a frame or two later), so most still hit; an untaken park then costs about 0.13 ms instead of
1.2 ms, and a desktop walk at the cap holds about 10 parked images instead of 64. The proof is a
guest's desktop walk on the 780M before and after: dma_buf_images_taken against
dma_buf_images_missed, dma_buf_images_parked_released, and batch_submit_nanos per submission.

Tests: dma_buf_parked_images now forces the import tax: with Fails, a pass right after the park
keeps the image; with Holds, the next pass releases it (fails without the change: the 2 s window
keeps it). texture_shadow_bench's in-place arm parks its image in a warm-up within its own cycle,
outside its times and counts, so its texture still takes one: the other arms between two of its
cycles run longer than a pass.

Documented in host_residency.rs, dma_buf/parked.rs and docs/HOWTO.md. No new Degradation kind; not
an accuracy choice, so no FAST-PATHS row.

Also folded:

Guest RAM: say each whole import, with its time; bench it at 2, 4 and 8 GiB and across a recovery

A device that imports a resident guest RAM whole as its use begins now says so once on its
message sink (id name metal2vulkan-host-ram, Info): the bytes and chunks imported, those left to
the copies, the imports' time and the first listing's (the submission of no work it waits for).
A consumer then sees the one-time wait at setup in its log, and at each recovery of the device,
whose carry makes the use again on the new device before it serves, so the new device imports the
RAM whole in turn on the recovering thread.

Tests (host_ram_whole.rs): the resident RAM says the line once, naming its bytes and its one
chunk; the RAM with a hole says nothing; a recovery imports the resident RAM whole again before
recover_for_test returns, and says so again. The ignored whole_ram_bench runs 2, 4 and 8 GiB RAMs,
each on a device of its own, each with a hole and then resident, the resident one recovered,
printing the device's lines.

Documented in host_ram.rs (the module docs and use_host_ram) and docs/HOWTO.md.

Guest RAM recovery test: read the chunks of the generation that serves

a_recovery_imports_a_resident_ram_whole_again_before_the_new_device_serves read the RAMs through
the root handle, whose own generation the recovery lost, so it found none and passed without
asserting (m3-max-37099: "the new device does not import the RAM whole ([])", while the same run
counted one chunk imported ahead in the recovery and heard the second line). It reads them through
Device::current now, the generation that serves.

The docs give the 780M's measured whole-import times at 2, 4 and 8 GiB (m3-max-37099): the
imports 0.05, 0.08 and 0.1 s, the first listing 0.43, 0.63 and 0.51 s.

And: whole_ram_bench times the first commit after the chunks' imports apart (dbc707372d); one
doc line rewrapped (0d19c052f8).

Verified: at ae6ae7876a clippy x3 (m3-max-37116 CLIPPY_GPU=0; m3-max-37117 CLIPPY=0, CLIPPY_CPU=0,
DOC=0, 20 host_ram unit tests, lavapipe host_ram_whole/dma_buf_parked_images/host_residency 13
passed: the parked check kept with the tax forced Fails, released with Holds). PHOENIX
(m3-max-37099, at c894bbdb13): whole import 2/4/8 GiB: imports 56/77/102 ms, first listing
441/633/511 ms, use_host_ram 532/759/690 ms; recoveries 507/768/716 ms; the lazy first commit
today 429/639/510 ms.
2026-11-16 10:03:48 -08:00
..