Repository navigation
Conversation
low_vram_pin_slots() keys on the cache fraction (< 25% resident) and so applies the 8-16 GiB tiny-cache rule to a 24 GiB card with a large MoE, where it fights the Niko1221#4870 mid-coverage adaptive rule and cost ~4.5% decode (RTX 4090, UD-Q4_K_XL, engine 0.1.66). Pass the card's total VRAM and keep the pinning to <= 16 GiB; unknown VRAM keeps the old fraction-only rule. The unit test covers the 8/12/16/24 GiB boundary.
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and result
low_vram_pin_slots()(v0.2.20,d28c053e6) decides by cache fraction, not card size: any cache below 25% resident pins 25% of its slots. It was measured on 8-16 GiB consumer cards. A 24 GiB card running a large MoE also sits under 25% resident — Qwen3.8-Flash-Next UD-Q4_K_XL on a 72 GB model is 20.8% — so the card pins ~1,105 slots while the #4870 15-65% coverage rule raises adaptive swaps to 2 / 192 / 0.92. The two fight.Same-build A/B (
STRATA_CACHE_PIN_FRAC=0vs the default), RTX 4090 24 GB, Windows WDDM, engine 0.1.66, 256 forced greedy tokens, 4 alternating paired rounds:The wider decode regression and its other parts (the 2/192 rate, the auto cache slots) are tracked in #6799. This PR only stops the low-VRAM pinning from firing on cards it was not measured on.
Result: the pinning behaves exactly as before on <= 16 GiB cards and is off above; unknown VRAM (0) keeps the old fraction-only rule.
Approach
low_vram_pin_slots()takestotal_vram_bytesand returns 0 abovekLowVram16GiB(16 GiB).kLowVram16GiBis new next to the other low-VRAM ceilings.generate.cpppasses the device total fromcudaMemGetInfo(already used a few lines below); a failed query leaves 0, which keeps the old rule.low_vram_rules_test.cppcovers 8/12/16/24 GiB and the unknown-VRAM case.Validation
Passed:
engine/src/core/low_vram_rules_test.cpp:low_vram_rules_test: ok(MSVC 19.44,/std:c++20).--arch 89) and served Qwen3.8-Flash-Next UD-Q4_K_XL withSTRATA_HC_Q8=0(to sidestep the separate [Engine] fix fused_gr Q8 TC kernels calling __ldg on shared memory (q8_smem_ld16) #6714 crash, which is not part of this PR). The engine no longer prints thepinned top …line on the 4090.Failed: none observed.
Not run:
-DSTRATA_BUILD_TESTS=OFF), windows-path tests, and multi-GPU.Limits