Files
metal2vulkan/docs
Anees Iqbal 05dcfce04e Memory: a pool near its next block gets it made ahead, its first growth among them
Blocks were made ahead (memory/ready.rs) only for a pool that grew lately:
a second or later pooled block added within KEPT_EMPTY_FOR. So a pool's
first growth, and its first after a pause, was always made in place by
the creation call whose keep_room found no room for half a block: in a
guest's scroll on a Radeon 780M, the buffers' pool's first growth block,
made on the guest's thread.

A pool made ahead for now also gets its next block made ahead, grown or
not, once it is near it (Pool::near_next): it holds a pooled block and
its longest free range is below three quarters of a block (ahead_room), a
quarter of a block before the half block keep_room keeps. The pools of
exportable buffers take the same rule (exported_growing lists those near
their next block too). A block made ahead for a pool that stopped growing
goes after KEPT_EMPTY_FOR only once the pool has room for three quarters
of a block again, so a pool that rests near its next block keeps that
block, one at most a pool, counted against the kept empty blocks'
budget, and makes none over and over. That is the resting cost, written
in docs/FAST-PATHS.md's row on kept blocks and in ready.rs. The other
option, a block ready for every pool in use, holds one at rest for every
pool, not only those near their next.

Tests: blocks_ahead's growing-pool test now asserts its first growth is
made ahead too (renamed). reclaim_submit_bench gains a scroll arm:
Private buffers of 7471104 bytes (a scroll's, eight to a block) every 30
ms, 64 a phase.

Verified on um790's Radeon 780M (RADV PHOENIX) and lavapipe (jobs 12337,
12354):
- blocks_ahead, 780M: first growth 1 made ahead, 0 in place (lavapipe
  the same). Negative, development's memory.rs and ready.rs: 0 ahead, 1
  in place, the test fails.
- Runtime suite: 780M 2011/2011, lavapipe 2014/2014; clippy with
  m2v_gpu, m2v_cpu_icd and no cfg clean; rustdoc clean.
- reclaim_submit_bench_scroll, release, three runs each, alternating:
  development made 7 blocks ahead and 1 in place in each phase, quiet and
  fragmented (compact_stall about 2500 in the pressed phase), every run;
  with this change 8 ahead and 0 in place in every phase. The slowest
  creation call: development 0.2 to 0.4 ms, this change 0.1 to 0.2 ms.
  The in-place makings were fast in this bench's fragmenting; the
  consumer's trace had the same making under the kernel's compaction.

(cherry picked from commit 35c4231506652a454e43e703b162384a0a2f71cc)
2026-11-09 13:37:57 -08:00
..