mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3714
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1841
Author: @demetree
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:expert-cache-vram-headroom📝 Commits (3)
e4aedeaserve: an opt-in VRAM headroom for--expert-cache auto(#1549)d056f92docs: the expert cache headroom A/B on an RTX 5070 Ti - no difference (#1549)e79b976docs: why the B70 hits the cliff and the 5070 Ti does not, and what the GEMM probe settled (#1549)📊 Changes
4 files changed (+254 additions, -0 deletions)
View changed files
➕
docs/EXPERT_CACHE_HEADROOM.md(+199 -0)📝
docs/TEST_REQUESTS.md(+1 -0)📝
include/strata/core/expert_cache.hpp(+43 -0)📝
src/program/generate.cpp(+11 -0)📄 Description
What this changes
--expert-cache autosizes the VRAM-resident expert tier to every byte the card reports free. On a cardthat ends up nearly full that is wrong by a lot: the prompt path then reads tens of times slower while
doing exactly the same work.
It adds one opt-in setting and changes no default:
the share of free device memory
autokeeps for the session's other buffers instead of experts. Thehelper is
strata::core::expert_cache_headroom()ininclude/strata/core/expert_cache.hpp, read bythe CUDA/HIP sizing in
src/program/generate.cpp.What it leaves alone. The default is zero, so every backend keeps the sizing it always had and the
default path is byte-identical to the last release: with the variable unset, the old expression is
evaluated. An explicit
--expert-cache Nis the user's own budget and is never cut. When the headroomwould leave no room at all, the old sizing stands. Nothing in the prompt, decode or expert paths is
touched - the cache is just sized smaller.
Why, and what it was measured on
An Arc Pro B70 (32 GB, driver 32.0.101.8976), the Qwen3.8-Flash-Next IQ3_XXS pack, OpenCL backend,
eager,
--prefill 4096, greedy, 64-token prompt. The same 3,668 gate/up and 3,668 down naive GEMM callsat every cache size - only the cache size and the memory left over change:
autobefore)A cliff, not a slope: every size up to 14,704 slots is stable at ~10 s and every size from 15,382 up
takes minutes. The two expert GEMM phases are 95.8% of the GPU timeline in the slow arm, and the phase
waiting for the host-to-device staging copies is 34 ms of 957,283 - the bytes are not the problem.
Memory during the slow pass peaks at 31.2 GiB of dedicated memory (the card full) and holds ~15 GiB
shared; the fast one peaks at 30.08 GiB dedicated and ~3.4 GiB shared. That is consistent with WDDM
paging an over-subscribed allocation to system memory, which the engine's own comment at the sizing
describes, but it is not proven.
Ruled out, each measured: the host mirror (35% of the same pack mirrored over PCIe costs nothing, 2.05
ms per call against 2.01 with every expert resident); the prompt length (the cost is fixed per expert
call, not per token); subnormals in the dequantized weights or activations (none in either pack);
--kv-resident(7,589 ms against 7,587 ms). The kernel calls and their shapes are identical in everyarm. No accuracy cost: the cut and the uncut sizing give identical greedy output tokens - eight tokens,
271 71093 271 550 18381 198 12 1510, from a scrambled 48-token prompt.docs/EXPERT_CACHE_HEADROOM.mdhas the full findings, the A/B protocol for a card this has not beenmeasured on, and what each outcome would mean;
docs/TEST_REQUESTS.mdgets a row for it.How I checked it
free_roomis the expression the last release evaluates - no code pathchanges.
1/6set on the B70, the knob reproduces the measurement: 14,688 slots (23.83 GiB) against17,687 (28.82 GiB) unset, with identical output tokens.
nvccorhipcc, so the CUDA/HIP sources in this pull requestwere not built where the change was written. The call site is the same statement the SYCL port makes
against the same helper.
What this is not
This is not a claim that the effect is real on NVIDIA or AMD. It is Windows/WDDM evidence from one
Intel card, offered as a knob so it can be measured elsewhere. If it turns out to be a no-op on CUDA
the default stays zero, and if the cliff is real there the numbers from the A/B are what would justify
turning it on.
Closes the sizing half of #1549.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.