Commit Graph

3 Commits

Author SHA1 Message Date
6c6a8cd47d vk_pipeline_check: a large module that must wait frees its worker (VK-PIPELINE-CHECK-LARGE-ADMISSION)
A worker took the next index and only then waited in the large-module gate,
so with the memory budget full the modules behind a large one sat untaken
while spare workers blocked, and the pool ran below --jobs.

LargeModuleQueue (large_module_gate.h) now hands out the indices. A large
module the gate can't admit yet is put back and the worker takes the next
one. The oldest module put back goes first as soon as the gate admits it and
no later large module passes it; once every index is out, a worker waits for
it. Nothing is put back while the gate admits each large module as it comes,
so with one worker or room under the budget the order is unchanged, and
--large-parallel 1 and --large-module-bytes 0 never ask the queue to admit.

large_module_gate_test: the waiting module frees its worker (fails with the
old claim-then-admit order), oldest-first and no double entry, the unchanged
order, and every module once under 8 threads.

AI-assisted (Claude Code).
2026-11-25 20:53:43 +01:00
36aecce11c Honor cgroup v2 limits at the mounted root 2026-11-23 01:53:09 +01:00
1c604af1a0 vk_pipeline_check: large modules share a memory budget instead of compiling alone
Modules over --large-module-bytes compiled one at a time with every other thread waiting. On the translated
corpus that is 695 modules (the ray-tracing compute shaders, ~14k RDNA2 instructions each, ~4.9 MB of SPIR-V),
about 12 s and 2 GB each on RADV GFX1201, so the pipelines stage spent hours mostly single-threaded.

large_module_gate.h lets large modules in while 512 bytes per SPIR-V byte fits 3/4 of the memory available at
start (Linux: MemAvailable and the cgroup v2 memory.max room up the tree; Windows: ullAvailPhys), one always
admitted when none is in, small modules never held back. Unknown memory keeps the old exclusive gate, as does
--large-parallel 1. malloc_trim(0) after each large module returns what glibc kept in per-thread arenas.

40 modules (27 large), Mesa shader cache off, RX 9070 XT / Mesa 25.3.6: 297 s -> 83 s on 6 threads (7.1 -> 8.3 GB
peak), 56 s on 12 threads (15.1 GB).

Tested: large_module_gate_test (Linux, and the clang-cl build under Proton), ctest on Linux (40 passed, 2
skipped), vk_pipeline_check over 40 real modules in three modes, and the pipelines stage over the corpus with the
gate: 26,000+ of 26,503 modules in 15 min, none failed. The largest module (26 MB of SPIR-V) was still compiling
alone on RADV after 25 min, as it would under the old gate. AI-assisted.
2026-11-23 00:30:02 +00:00