Files
reims-vgpu/docs/graphics-kext
Anees Iqbal 7905f732f3 🐎 Make each pool piece one metal2vulkan-rt unit
The pool asked its source for 64 MiB pieces. metal2vulkan-rt's unit is 16 MiB:
a take of up to a unit lands in a unit rt's block maker made ahead, with no
Vulkan call, while a longer take makes an allocation of its own length on the
pool's thread and rt frees it as one call once it has been idle 250 ms. A
driver may hold the device's submissions for the whole of such a call, longer
the longer it is: on an RTX 3090 a free on rt's slow path held a submit 72 ms
for 64 MiB and 20.6 ms for 16 MiB, and rt's ALLOCATION_LEN records a 16 MiB
Shared allocation holding one 3.3 ms at the median and one of 256 MiB 51 ms
(measured).

A piece the pool asks for itself is now one unit, BLOCK_LEN, read from rt
(MemoryClass::Shared.block_len()). The headroom keeps the bytes it kept, 64 MiB
(HEADROOM), as four empty pieces: the pool asks a unit for each piece the
headroom is short, counting the asks its thread has yet to serve and the one it
serves, and gives back only the empty pieces above the lowest 64 MiB of them. A
take longer than a unit still has a piece of its own length.

What the host sees: pool_add and pool_remove carry 16 MiB pieces where they
carried 64 MiB ones, four adds at the guest driver's take of POOL where there
was one, and, as the guest's use grows and shrinks, up to four times the adds
and removes for the same bytes, each piece a mapping of its own (QEMU: an
unmergeable RAM region, a KVM memory slot in each address space).

What the guest sees: a block's offset in the pool, and its GPU address where
the guest took POOL_ADDRESSES, follow the 16 MiB pieces. Blocks that shared a
64 MiB piece now lie in up to four, and a take longer than 16 MiB, which fitted
the old piece, has a piece of its own past the headroom's.

The tests that held the one 64 MiB piece count the headroom's pieces, and
a_piece_is_one_rt_unit pins the unit, the headroom's bytes and the long take's
own piece.
2026-11-20 06:03:27 -08:00
..