Files
metal2vulkan/crates
Anees Iqbal 2d8407c940 A kernel's variant keeps 256 region pipelines, counting those it lets go
What: a kernel's compute variant now keeps up to REGION_PIPELINES = 256 region VkPipelines
(was PIPELINES = 32, which render variants and tile functions' variants keep as before), and
every compute variant's memo counts the pipelines it lets go past its bound in a new
WorkCounts::region_pipelines_evicted (the memo's Lru takes an eviction hook,
Lru::counting_evictions; Making::counted_evicting).

Why: a guest's run on an RX 7900 XTX dispatched one index fix-up kernel as
dispatchThreads(n, min(n, 64)). The kernel observes its threadgroup partition, so it keeps the
exact split: a single region at each width 1..64 (MultiRegion 0) and, for ragged grids, the
interior of 64 and an edge at each remainder 1..63 (MultiRegion 1): about 128 region keys of
one variant. With 32 kept, the cyclic stream remade each key about 6,300 times in 146 s (1.2M
compute pipeline creations), each such dispatch's command buffer waiting for a pool making.
256 holds that measured working set twice over. A tile function's dispatch is one region of its
pass's threads per tile, with no edges, so its variant keeps 32 (tile_rebind_making_wait
crowds 33 keys to evict one).

Verified: tests/region_widths.rs (the stream above, twice, outputs checked against Metal's
gid % width) made [129, 129] VkPipelines at the parent on lavapipe (m3-max-21348, the control);
this commit's run follows in the report.
2026-11-12 07:55:36 -08:00
..