From d8090a85fe5dde89ee1ce9fadb880dfffe200d5f Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Mon, 9 Nov 2026 09:05:09 +0300 Subject: [PATCH] Keep headroom blocks for device-local memory types only Headroom woke for every memory type that got new device memory, the staging pool's own 64 MiB blocks included, and then kept a 256 MiB spare block in that type's default pool. On the RX 9070 the default pools of host memory types 1 and 3 held 4 MiB, beside 512 MiB of spare blocks. Textures and mirrors, whose block allocations headroom moves off the render thread, live in device-local types. RX 9070, field save, 60 s: heap 0 VMA blocks 192 MiB instead of 704, driver usage 1384 MiB instead of 1896; 60 fps, 1% low 51.9. Co-Authored-By: Claude Opus 5.5 --- runtime/vk_headroom.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/vk_headroom.c b/runtime/vk_headroom.c index e25ceb21..88083025 100644 --- a/runtime/vk_headroom.c +++ b/runtime/vk_headroom.c @@ -75,7 +75,11 @@ static void drop_anchor(const VkCtx *c, uint32_t type) { static void top_up(const VkCtx *c, uint32_t type) { VkDeviceSize block = block_size(c, type); - if (!room(c, type, block)) { + // Device-local types only: textures and mirrors grow there. Host memory types are woken by the staging pool's own + // blocks (vk_memory.c vk_staging), while their default pool held 4 MiB: on the RX 9070 the spare blocks of types 1 + // and 3 held 512 MiB of commit for nothing. + if (!(c->mem_props.memoryTypes[type].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) || + !room(c, type, block)) { drop_anchor(c, type); return; }