Files
Strata/engine/include
Niko1221 6e45f7fbd3 fix(cuda): the expert cache on Windows WDDM prices what the load really allocates after it (#6836 #6887 #6509 #6846)
0.1.66 priced 384 MiB for "what is allocated after the cache" on WDDM (256 before) and added
a shrink-after-write loop that wanted reserve + draft head + 384 MiB free once the slots were
written. Since 0.1.65 the BF16/FP16 GEMM warm-up (about 180 MiB of cuBLAS workspace) runs
BEFORE the cache is sized, so only the verifier's buffers and graph captures come after it.
Measured on an RTX 5070 12 GB (Windows, IQ3_S pack, MTP, spec 4): 134 MiB at --vram-reserve-mib
300, 110 MiB at 700, 126 MiB at 1536. The card ended with 606-620 MiB free (reserve 300) and
the cache lost 0.36 GiB against 0.1.65 (2287 -> 2099 slots, 4.40 -> 4.04 GiB): the 886 -> 562
experts of #6836 on an 8 GB laptop, 3598 -> 3204 slots in the #6713 table, 7.63 vs 8.38 GiB
of #6846.

kWddmLateAllocMib 384 -> 192 (measured plus 50-80 MiB for a wider window), and the shrink loop's
slack under WDDM 0 -> 32 MiB (the slot count rounds down, so the free figure is a few MiB under
the need by construction: 902 against 904 MiB cost a 64 MiB shrink and a second cache write).
Result on the same card: 2232 slots (4.29 GiB), 360 MiB free at the end (the engine's own
paging threshold is 256 MiB; the 8 GB laptop's 0.1.62 ran at 336 MiB, a forced 250 MiB paged).

The start-up now prints what the load took after the cache against what was priced ("after the
expert cache was written N MiB were free; M MiB were taken since ..."), so the price can be
checked on any card from one log.

Tests: low_vram_rules_test (the price, and that it never exceeds the plain rule's).
2026-11-23 20:20:09 +01:00
..