Files
metal2vulkan/docs
Anees Iqbal 9e663b770c Memory: the pools of exportable buffers get their growth blocks made ahead
A creation call that places an exportable buffer (new_exportable_buffer, an exportable buffer
descriptor, the in-place check's buffers) in a pool with no room made the pool's 64 MiB block
itself, on the program's thread. keep_room made blocks ahead (memory/ready.rs) only for the
pools the runtime's encodings and commits place in and for the host copies' pool, so every
growth block of Holds::Exports and Holds::DmaBufs was made in place.

Now each pool of exportable buffers that grew within KEPT_EMPTY_FOR and lacks room for a whole
block gets a block started ahead at each creation call's keep_room (Memory::exported_growing,
ready_if_growing, the kept pools' tail of keep_room moved into it), made right after a burst of
the device's submissions ended, as the kept pools' blocks are. makes_ahead covers those pools,
so the placement that finds no room takes the block made ahead or waits for its making
(place, take_ready) and counts a block it makes itself in buffer_blocks_made_in_place.
keep_room makes no block for such a pool in place: its placements are the creation calls.

The reclaim bench gains an arm of exportable buffers made by the runtime (24 of 32 MiB a phase,
one every 400 ms) and prints blocks_ahead_waited_for. The citation of a consumer's wait is
replaced by these measurements; FAST-PATHS's row on kept blocks says blocks are made ahead for
pools that grew, the exportable ones among them.

Verified, on a Radeon 780M (RADV PHOENIX, Mesa 26.2.6, gem10, MESA_VK_DEVICE_SELECT
'1002:15bf!'):
- reclaim_submit_bench_exportable in release under --cfg m2v_gpu, exclusive, two rounds each,
  the negative being memory.rs and memory/ready.rs as on development (job m3-max-12103): the
  creation calls that made blocks in place took 10.0 to 10.8 ms (quiet, round 1), 12.9 to
  15.0 ms (fragmented: free memory in single pages, round 1) and 12.0 to 13.7 ms (fragmented,
  round 2; 0.3 ms at most in round 2's quiet phase). With the change no creation call took over
  0.3 ms in any phase: 10 blocks made ahead and 2 in place (the pool's first two) in each quiet
  phase, 12 ahead and 0 in place in each fragmented one, 0 waited for. Turnarounds of 8 ms or
  more: 0 in every phase both ways (an exportable block holds no submission).
- blocks_ahead's new test a_growing_pool_of_exportable_buffers_gets_its_new_blocks_made_ahead:
  6 of the pool's last 6 blocks made ahead, 0 in place; with memory.rs as on development it
  fails, 0 of 6 made ahead (job m3-max-12111).
- The whole runtime lib under --cfg m2v_gpu (debug): 1997 of 1997 passed (job m3-max-12109);
  clippy on the runtime crate, all targets and features, clean.
And on lavapipe (llvmpipe, LLVM 23.1.4) under --cfg m2v_cpu_icd: blocks_ahead and clip_bursts
pass (the later clips allocated nothing: [(0, 0), (0, 0)]; job m3-max-12110), clippy clean, and
the new test fails, 0 of 6, with memory.rs as on development (job m3-max-12112).
Not run: NVIDIA, MoltenVK.

(cherry picked from commit 5a862c6ab9ebf0a6f2effeb8776aaac6de3bed16)
2026-11-09 09:44:38 -08:00
..