mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3508] [Engine] qwen36 (qwen35moe) on sm_61 Pascal 16GB: expert cache fixed at 73/256 in VRAM, 18.75 GiB all in pageable host memory, 6.98 GiB VRAM free unused, runtime flags ignored #1439
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#1439
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?
Originally created by @visualpha on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3508
Area
[Engine] (speed, kernels, models, the server and API)
Desktop app, Terminal or source?
Desktop app (Windows, Strata-0.2.1-windows-cuda12.exe) + setup.py CLI
Reproduction status
Reproduced locally
Strata version
0.2.1 (engine 0.1.46)
Graphics card, memory and system
Quadro P5000 16 GB, compute capability 6.1 (sm_61), driver 582.78, CUDA 12.9 · Xeon E3-1230 v5, 4 cores / 8 threads, AVX2 · 32 GB RAM (page file 16 GB) · Windows 10 LTSC (10.0.19044) · Model: Qwen3.6-35B-A3B-UD-Q4_K_XL (unsloth, 22.85 GB, 753 tensors, MTP block inside)
Related: #3430 (App does not detect Quadro P6000 Pascal), #3444 (vision start error on the same card). This report adds a third Pascal-side finding: the qwen36 engine's expert placement on a 16 GB Pascal card (Quadro P5000, sm_61) leaves 6.98 GiB of VRAM free while putting 18.75 GiB of experts into pageable host memory. #3303 (qwen35moe KV always fp32) is also related but targets the KV path, not the expert-cache placement.
What happened
On this 16 GB Pascal card, the qwen36 engine (
strata-q36) allocates the expert cache at a fixed 73 of 256 experts per layer (5.35 GiB in VRAM) and puts all 18.75 GiB of the experts into pageable host memory, leaving 6.98 GiB of VRAM free while RAM usage climbs to ~30 GB.The allocation is decided at engine start and is not affected by any runtime flag:
--expert-vram 13STRATA_MEMORY_LIMIT_MIB=20480hybrid experts: 73 of 256 ... 18.75 GiB in pageable host memoryline is byte-identicalSTRATA_SM60_PERF=1STRATA_SM61_TABLE=1--kv int8,--kv-grow,--mmap-experts,--expert-cache Nstrata-q36: ignoring --kv int8 (not an option of this engine)— all rejected by the qwen36 engineThe engine's own log at start:
nvidia-smiduring idle after load:15659 MiB / 16384 MiB used(95.6%).nvidia-smiduring decode: peak util 78-83%, power 75-95 W, no thermal throttle (SM clock 1771 MHz, memory 2999 MHz, both at max).RAM during idle after load:
30.1 GB / 32 GB used. strata.exe Private = 34.5 GB (> physical RAM), WorkingSet = 29.1 GB.Reproduction steps
Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf(22.85 GB) andmmproj-F16.ggufin a folder.hybrid experts: 73 of 256 ... 18.75 GiB in pageable host memory ... 6.98 GiB of VRAM free.Expected (from the engine's own
--helpfor the generic engine):--expert-vram GiBshould set the experts' budget, and with a 16 GB card the budget should be closer to 10-13 GiB, which would put 120-160 of 256 experts in VRAM and cut the pageable host memory from 18.75 GiB to roughly 8-10 GiB.Actual: 73 of 256 experts in VRAM regardless of
--expert-vram 13orSTRATA_MEMORY_LIMIT_MIB=20480.What this costs
Measured decode speed with the current (fixed) allocation:
draft_nin timings is always 0 (MTP block is inside the GGUF, not a separate layer — expected for qwen36).A community benchmark on an RTX 5060 Ti 16 GB (Blackwell) with the same model, same quantization, same 32K context reports 126-133 tok/s decode at 32K (issue #3303). The P5000 has 2x the memory bandwidth of a 1050 Ti and 3.3x the CUDA cores, yet only reaches ~31 tok/s, which points at the expert placement (73/256 in VRAM, 18.75 GiB pageable) rather than at raw GPU capability.
A Pascal-only community data point (GTX 1050 Ti 4 GB mobile, 48 GB RAM, Qwen3.6 35B at a ~14 GB quantization) reports 24.53 tok/s decode at 8K context — the smaller quantization means a much smaller pageable expert footprint, which is consistent with the "pageable host memory" cost being the dominant factor here.
Why this looks like a sm_61 / 16 GB gap
BUILD.jsonlistsarchs: [60, 61, 70, 75, 80, 86, 89], so sm_61 is compiled in.setup.py'ssm60_card(arch)treats60 <= arch <= 70as one class, so sm_60 (Tesla P100, 16 GB HBM2) and sm_61 (Quadro P5000 / GTX 1080 Ti, 16 GB GDDR5X) share the same code path.strata-q36) rejects--kv,--kv-grow,--mmap-experts,--expert-cachewithignoring ... (not an option of this engine).--expert-vram 13is accepted but only moves 3 experts into VRAM (70 -> 73), which suggests the flag is parsed but the placement decision uses a different (hard-coded or sm_60-derived) budget.The result is that a 16 GB Pascal card behaves as if it had ~8 GB of usable expert VRAM, while the remaining ~7 GB of VRAM stays free and the 18.75 GiB of experts sit in pageable host memory, competing with the 22.85 GB of weights for 32 GB of RAM.
Suggested fix directions
--expert-vram GiBactually set the expert cache budget on the qwen36 path (currently it is parsed but the placement does not follow it).--expert-vramis given.--mmap-experts-style file-backed paging when RAM is tight (the 18.75 GiB pageable tier is the main RAM pressure).--expert-cache N,--mmap-experts,--resident-experts) on the qwen36 path, or document why they are not applicable.Logs
Full engine log (last start,
STRATA_MEMORY_LIMIT_MIB=20480):nvidia-smi --query-gpu=memory.used,memory.total,utilization.gpu,clocks.current.sm,clocks.current.memory,power.draw,temperature.gpu --format=csv,noheaderduring decode:nvidia-smi -q -d PERFORMANCEthrottle states:RAM / commit during idle after load:
What would make this verifiable on our side
strata-q36startup line that prints the detected VRAM and the chosen expert budget (slots and GiB) in the same line ashybrid experts: ....docs/QWEN36.mdabout the expected expert placement on 8 GB / 12 GB / 16 GB Pascal cards.Happy to run any A/B arm on this machine and attach the logs. The full session transcript (including the
--expert-vram 13,STRATA_MEMORY_LIMIT_MIB=20480,STRATA_Q36_FIXED_SLOTS=1,STRATA_Q36_STREAM_ALL=1,STRATA_Q36_KEEP_PACKED=1runs) is available on request.Limits of this report: single machine, single model, single quantization, Windows only. No Linux or sm_60 (Tesla P100) comparison. No token-parity check was run (the flags above do not change the answers, only the placement). The 1050 Ti data point cited above comes from a community article, not from a controlled benchmark on our side.
@github-actions[bot] commented on GitHub (Oct 20, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@visualpha commented on GitHub (Oct 21, 2026):
A/B results and three new findings (0.2.2, engine 0.1.47)
Upgrading to 0.2.2 / engine 0.1.47 changed nothing on this machine's qwen36 path. The
hybrid expertsline is byte-identical to 0.2.1, and I ran a 6-arm A/B to separate the knobs.Finding 0 (new, highest impact): MTP never fires on Windows qwen36 —
drafts accepted 0 of 0on every requestEvery serve log line on this machine shows the MTP block loaded but never used:
All 10 recent requests:
drafts accepted 0 of 0. For comparison, #3303's log on an RTX 5060 Ti (Linux, same model, same--mtp 2) showsdrafts accepted 237/324, 229/342— a 73% acceptance rate.--mtp 0vs--mtp 2on this machine changes decode by only +0.4 tok/s (29.8 vs 30.2, inside noise), which is consistent with the draft loop never running. The MTP block is loaded (startup time differs: 61 s with MTP=2 vs 97 s with MTP=0), so the weights are there; the verify window appears not to be calling the drafter on this path. If MTP worked at #3303's 73% acceptance, decode here should be roughly 20-30% higher — a larger lever than the expert placement below.A/B matrix (same model, same machine, 6 restarts, 5 requests each, thinking off, 300 output tokens)
hybrid expertsline--expert-vram, no env)--expert-vram 8--expert-vram 13--mtp 0STRATA_HC_Q8=1 STRATA_ROUTE_TAIL_SKIP=0onlyAll arms land in 29.8-30.7 tok/s (<3% spread, inside noise). The
hybrid expertsline never changes except for the two--expert-vramarms, which move 70 → 73 and stop there.Finding 1:
--expert-vramis a boolean, not a budget8 GiBand13 GiBproduce the identical placement (73/256, 5.35 GiB). The flag is parsed (noignoringmessage) but the placement does not follow the value. On a 16 GB card, 13 GiB of expert budget should put ~120-160 of 256 experts in VRAM, not 73.Finding 2: engine 0.1.47 did not touch the qwen36 path
Arm 5 runs the previous binary (0.1.46) with the same config: identical
hybrid expertsline, speed within noise (30.0 vs 30.2). The 0.2.2 release notes do not mention qwen36 / qwen35moe expert placement.Finding 3: the app's "Load model" path differs from the CLI path (three concrete deltas)
Loading the same model from the desktop app (0.2.2) instead of
strata.py serve --profileproduced:(a) The app passes flags the q36 engine rejects:
The app's qwen36 path apparently carries the Flash-Next flag set; both flags are silently dropped.
(b) The app's start OOM'd once before succeeding:
Same line and same failure as #3303 (the fp32 KV allocation). On this machine it recovered on a retry, but it means the app path is closer to the KV wall than the CLI path — likely because the rejected
--vram-reserve-mib 1536was meant to make room.(c) The app's start is ~20% slower than the CLI's:
Part of this is the missing env switches (arm 6 vs arm 1: 29.9 vs 30.2, so ~0.3), so most of the gap is elsewhere — possibly the OOM/retry, or the app's extra flags changing engine state. Worth a look if anyone reproduces it.
Why this issue may not have shown up before
needs 32 GB RAMfor UD-Q4_K_XL, so the reachable audience is 32 GB RAM + 12-16 GB VRAM PCs — a small slice.Downloaded), but its picture-reader download then failed on my network, which is a separate issue.The four open qwen36 reports I can find (#3508, #3303, #3294, #3298) all point at the same file:
src/qwen35/q36_engine.cu— KV not parsed (#3303), expert budget not honored (this issue), single-GPU only (#3294),--mtp 2treated as a path (#3298, fixed). It reads like the qwen36 path is behind the generic path rather than any single card being wrong.Cross-card comparison (same model, same quant, same 32K)
The VRAM-side numbers are within 10% of each other, which argues against an sm_61-specific cause. The difference I see is the host-memory tier:
pageablehere (Windows + 32 GB RAM, Private bytes 34.5 GB > physical) versuspinnedon Linux. I can test a pinned build if someone points me at one.What would settle it
strata-q36startup line printing the detected VRAM and the chosen expert budget on the same line ashybrid experts: ...(I still cannot tell whether the 73 comes from a fixed table, an sm_60-era heuristic, or a free-VRAM calculation that ignores--expert-vram).STRATA_Q36_EXPERT_VRAM=<GiB>forcing the budget, so I can A/B 73/256 against a larger budget on this card and attach before/after speed plus an identity gate.--vram-reserve-mib, either honour it or drop it from the generated args so the log stops advertising flags the engine refuses.Full logs for all six arms and both start paths are available on request.
Limits: one machine, Windows only, one quantization, decode-only. The A/B arms are 5 requests each, medians, no identity gate — they separate knobs, they do not establish that any of them changes the answers. The app-vs-CLI comparison is one run of each and includes a config difference (env switches) and one OOM retry, so treat the 24 vs 30 gap as a lead, not a measurement.
@visualpha commented on GitHub (Oct 21, 2026):
Root cause found in
src/qwen35/q36_engine.cu:2897— the budget is clamped back to free VRAMI read the engine source this evening (0.2.2). The placement logic in
place_experts()explains both symptoms reported above — the fixed 73/256 slots and the--expert-vram 8=--expert-vram 13equality:On this card at engine start:
fr = 6.98 GiB,staging = 1.10 GiB, so the L2897 clamp givesslot_bytes ≈ 5.38 GiB→ 73 slots — identical with or without--expert-vram. The 13 GiB budget never reaches the slot computation at L2899.This also explains why the flag is accepted (no
ignoringmessage):expert_vramis parsed at L3778, used at L2812 to computebudget, and then silently overwritten at L2897.Suggested fix
Only clamp when no explicit budget was given:
(The second argument of the ternary also has a typo:
512 << 0instead of512 << 20in the current code — worth fixing in the same pass.)Expected outcome on this machine
With the fix and
--expert-vram 13:I can A/B the patch on this machine if someone builds a test engine with it — the A/B protocol from the previous comment (6 arms, 5 requests each, medians) is ready to run.
Reproduction (unchanged from above)
--expert-vram 8→ 73/256;--expert-vram 13→ 73/256. Both identical.@Niko1221 commented on GitHub (Oct 22, 2026):
The A/B and the place_experts() root-cause note are enough to triage this; nothing else is needed from you. Thanks for the follow-up — the 0.2.2 comparison is what makes it actionable.
@github-actions[bot] commented on GitHub (Oct 26, 2026):
Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection.
To bring it back: fix the title (area prefix) and the missing parts, then comment
/reopen. A check runs and reopens it, or tells you what is still missing. See CONTRIBUTING.md.