A command buffer whose pools handed out every VkCommandBuffer of a level they held now takes the
spare holding the most of that level from its first hand-out on (before: only past 16 handed out,
making the rest in its first pool), and inside a section of the exit guard (the scheduler's
barrier command buffers, a host step's recording) it takes a spare whose command buffers need no
reset (before: no spare at all). Where no spare holds one, it makes it in its last pool, up to
POOL_HOLDS (32) of the level there, past which it takes a pool for more (a spare holding none of
the level, or a new pool). HELD stays the hard bound; idle sheds and recent-uses frees are
unchanged; no new switch.
Why: under command buffers of fenced one-dispatch compute encoders split into parts (a guest's
fluid simulation's shape), the barriers' command buffers, made in sections, were 64% of the
allocations and the first-pool makes 34%; the pools grew past what was in use at once to HELD,
and each give-back shed the oldest pool whole, which the next takers made again (45,914 made over
30 rounds of 200, about 1,250 a round, on lavapipe). On RADV each made VkCommandBuffer is a new
buffer object with cleared pages.
New WorkCounts field: command_buffers_made (vkAllocateCommandBuffers' count), POOLED in the
conformance cost table.
Tests: tests::spares unit tests take `settled` and a new one checks a section takes only a spare
that needs no reset; the device test of a small and a large command buffer now asserts none is
made where the spares hold them; tests::spares_parts (device): fenced command buffers 16 in
flight make none once warm and hold at most the in-use bound; a load that falls sheds down.
No answer, refusal or recorded command changes (only which VkCommandBuffers the spares
hand out), so RUNTIME_VERSION stays 2305 and the runtime-sources pin alone moves.
A/B (msi lavapipe release, m3-max-29720, spares_compute_parts: 200 command buffers a round
of 2-120 fenced one-dispatch encoders, 48 in flight, rounds 6-30, two interleaved runs):
command_buffers_made 1,498/1,448 a round -> 8.8/4.3; spare_command_buffers_shed 1,460/1,447
-> 0; spares held pinned at HELD -> 3,251/3,263; committing thread CPU per command buffer
-7%/-6%, scheduler -4%/-8%, queue waiters -12%/-9%, free thread to 0; anonymous RSS at round
30 187/190 -> 71/74 MiB. Control (sections take no spare): 2,189/2,305 made a round, fails
the steady test.
Verified (m3-max-29776 at 2a5db4d65e, msi): clippy runtime+conformance plain and
--cfg m2v_cpu_icd 0; tests::spares and spares_parts 26/26; conformance cost 0; signatures 0.