Say in the log what keeps the half-full blocks of video memory from going back to the driver.

A play session at 5120x2160 held 3 to 5 GiB free inside 140 to 180 of the allocator's 64 MiB blocks, 48 to 85 of them at most half full, and the "mem: holes" line said only that 1 to 18 of those could be emptied by moving textures. A second line now counts the other half-full blocks by what stays in them: a VRAM mirror, a texture whose content only the GPU made, a texture a shader sampled lately, or a texture that cannot move for another reason, each with the blocks that kind alone keeps. Those figures say which change would give the memory back: mirrors placed apart from textures, or a wider rule for what a compaction may move. The line is written with the holes line, every 3,600 frames, from the table that line already builds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-14 04:30:25 -05:00
parent f7a2d94813
commit 190cdbb50f
3 changed files with 47 additions and 1 deletions

View File

@@ -858,11 +858,17 @@ typedef struct { uint64_t mem, block_size, bytes; uint32_t type; } VkBlockRow;
// their sizes and the textures and rows in them; the textures that could move to another block or be dropped (marks 0:
// the texture pool's marks do not tell which textures are sampled, and none counts as movable); the blocks at most half
// full by what is listed, and those of them that hold nothing but such textures, which are what a compaction could
// give back to the driver.
// give back to the driver. kept: the other half-full blocks in which something listed stays, by what stays there
// (VK_HOLES_KINDS kinds, in order: a VRAM mirror, a texture whose content only the GPU made, a texture sampled lately,
// a texture that cannot move for another reason): kept_with counts the blocks with that kind in them, kept_only those
// where nothing else stays.
#define VK_HOLES_KINDS 4
typedef struct {
uint32_t type, marks, blocks, sparse, emptiable;
uint64_t block_bytes, tex_bytes, other_bytes, move_bytes, drop_bytes;
uint64_t sparse_bytes, sparse_listed, emptiable_bytes, emptiable_move, emptiable_drop;
uint32_t kept, kept_with[VK_HOLES_KINDS], kept_only[VK_HOLES_KINDS];
uint64_t kept_bytes, kept_only_bytes[VK_HOLES_KINDS];
} VkTexHoles;
void vk_texture_holes(const VkBlockRow *other, int nother, VkTexHoles *h);
// Texture compaction (NX2NAVI_TEX_COMPACT; vk_texture.c "the pass"): idle textures move out of sparsely used blocks