mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1820] [CLOSED] qwen35moe follow-ups: VRAM cap + quality mode, MTP for F16 draft tensors, chunked GDN, 256/8 route-resident #3696
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#3696
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/1820
Author: @atomicmilkshake
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:qwen36-upstream📝 Commits (10+)
42bf2ffQwen3.6-35B-A3B and Ornith-1.5-35B-A3B (qwen35moe): a second, smaller model for 8-12 GB cards64ec4ceMerge upstream/main (0.1.40.2) into qwen36-35b-supportaa7ab97Merge upstream/main (0.1.41) into qwen36-35b-support20f4d4bqwen35moe: 16-bit K/V at 8K, and the server below sm_755c92395qwen35moe: --kv-resident past the resident cells (KV streaming with dense attention)48534f3setup: KV streaming for the 35B-A3B models: needed below 9 GB free from 128K, asked otherwise59ba507Add Huihui abliterated Qwen3.6 setup family27c3820MTP: accept F16 draft tensors in a single-file GGUF22d3ad1Use qwen35moe active expert count for router lookahead66af273Port opt-in chunked DeltaNet recurrence to qwen35moe📊 Changes
69 files changed (+5529 additions, -910 deletions)
View changed files
📝
CMakeLists.txt(+13 -1)📝
README.md(+5 -0)➕
data/expert-profile-qwen36.bin(+0 -0)📝
docs/DETAILS.md(+14 -0)📝
docs/MODELS.md(+22 -1)➕
docs/QWEN36.md(+226 -0)📝
include/strata/artifact/gguf_reader.hpp(+11 -1)📝
include/strata/core/expert_source.hpp(+2 -0)📝
include/strata/core/layout.hpp(+28 -0)📝
include/strata/core/mtp.hpp(+8 -0)📝
include/strata/core/peer_experts.hpp(+1 -1)📝
include/strata/core/remote_experts.hpp(+2 -1)📝
include/strata/core/verify.hpp(+17 -2)📝
include/strata/core/vmm.hpp(+1 -0)➕
include/strata/core/vram_floor.hpp(+21 -0)📝
include/strata/kernels/cpu/expert_layout.hpp(+5 -1)📝
include/strata/kernels/kv_stream.hpp(+6 -5)📝
include/strata/kernels/native_router.hpp(+8 -3)📝
include/strata/kernels/qsa.hpp(+4 -0)📝
include/strata/kernels/qsa_decode_attn.hpp(+12 -0)...and 49 more files
📄 Description
What this is
A stacked PR on top of #1402 (qwen35moe support). It contains the qwen35moe follow-up work we built
and measured while validating that PR on one machine (RTX 3080 10 GB, Windows 11, CUDA 13.2, sm_86):
--vram-frac) and a quality cap mode (--vram-cap-mode quality)that keeps every expert miss on the same GPU kernel as a hit;
merged with our 256/8 implementation);
Base: #1402 head
48534f3. The first commits in the diff are #1402's; the 16 commits listed below arethis PR's content. The five upstream PRs we also adopted locally (#1700, #1660, #1659, #1696, #1720) are
deliberately not included — they are separate PRs and should land on their own.
The repo's guide is one change per pull request. This is a stack of related qwen35moe follow-ups; I am
happy to split it into separate PRs (MTP-F16; cap+quality; chunked GDN; route-resident 256/8) if that is
easier to review. The MTP F16 commit is the smallest and probably the most valuable on its own.
Commits
MTP for third-party GGUFs
MTP: accept F16 draft tensors in a single-file GGUF— the draft-layer loader took F32 for norms andBF16/F32 for routers, so a single-file GGUF whose MTP block keeps
ffn_gate_inp.weightat F16 refused tostart. F16→F32 is exact; F16→BF16 uses the same round-to-nearest-even as the F32 path. The finite cases
check out over all 65,536 half bit patterns; NaN needed a later fix (the first checker skipped NaNs, and
the rounded addition carried them into infinity/signed zero — see the follow-up commit below). Measured on
the Huihui Q4_K file: 62.5 tok/s vs 26.0 without MTP, 21/25 drafts accepted.
Gate Huihui MTP on the F16 draft loader capability— setup only offers MTP for that family when theloader supports it.
Opt-in VRAM cap + quality mode
Add opt-in total VRAM fraction cap through cache reserves—--vram-frac Fsizes the expert cache sothe engine's own use stays under F of the card; a floor is kept free and the plan is frozen pre-touch
(post-touch readings only accept or refuse; no resize).
Add opt-in uniform-GPU VRAM cap quality mode—--vram-cap-mode qualityroutes every expert missthrough the grouped GPU kernel, no CPU fallback. Measured 20/20 token-identical outputs vs the
uncapped run, 6,759 vs 9,397 MiB peak.
Book late VRAM and refuse serve requests that cross the floor+cap booking: keep the named late allocations, leave graphs to the slack + refusal— books the chunked-GDN scratch and MTP prefill recordsin the frozen budget, re-checks the floor on the serve path and after
cudaGraphInstantiate, and logsfree memory at READY / first capture / first chunked launch / first checkpoint. Validated: free
3,511–3,577 MiB against the 2,048 MiB floor, no refusals, prefix reuse intact.
qwen35moe prefill and routing
Port opt-in chunked DeltaNet recurrence to qwen35moe— opt-in (STRATA_GDN_CHUNKED), parity-checkedagainst the default recurrence.
Use qwen35moe active expert count for router lookahead— width 8 instead of qwen4exp's 10.Port opt-in route-resident routing to 256-expert top-8 models— the 256/8 counterpart of #1737.route-resident: one warp per token for the 512/10 and 256/8 swap— merges #1737's warp-shuffle swapwith the 256/8 implementation into one templated kernel (
route_resident_impl<NE,K>). This commit canreplace #1737 if preferred: it contains its approach for 512/10 and adds 256/8.
Determinism, setup, SYCL
Make expert-cache auto use one fixed 1 GiB haircut+Bucket the qwen35moe auto-cache haircut and check the reserve— fixes the auto-cache non-reproducibility on Windows/WDDM (2,974 vs 3,494 slots betweenidentical runs) and refuses cleanly instead of stalling under low headroom.
Add Huihui abliterated Qwen3.6 setup family— the family insetup.pywith tests.Keep the shared Qwen36 setup test harness offline on Windows.qsa: mirror the dense-attention validate() fix into the SYCL twin— the CUDA fix in #1402 did not touchthe SYCL twin.
SYCL generate: explicitly refuse the CUDA-only VRAM cap flags— fail closed instead of ignoring them.Validation (RTX 3080 10 GB, Windows 11, CUDA 13.2, sm_86)
Measured on this exact branch (stacked on
48534f3):ctest: 96 passed, 1 skipped (expert_multi_test), 1 failed (ple_parity, missing Flash-NextQ2_0 fixture, not present on this machine). The two cap tests are
vram_cap_test(169 CPU checks)and
vram_cap_quality_test(2,529 CPU checks); the other suites are the repo's own.line (64/64),
--expert-cache 3200capped to 1430 slots, free 3,513 MiB after the first capture.Measured on the integrated line this work sits in (
95f205d+ the cap-floor fix, shad58e8ded;it also contains the five upstream PRs we adopted locally — #1700/#1660/#1659/#1696/#1720 — which this PR
deliberately excludes):
7,269–7,371 MiB under the 8,192 ceiling; server prefix reuse 1,005/1,012 with TTFT 1.89 s → 0.098 s;
chunked kernel launches confirmed under Nsight Systems; HumanEval 39/40 at 2,048 and 39/40 at 4,096
(no truncations; the single miss is HumanEval/132's wrong implementation).
haircut reduces but cannot eliminate sensitivity when the pre-touch reading crosses a bucket boundary, so
a run can still open a different slot count. Cache size does not change the output tokens in quality mode
(20/20 identical), but the slot count is not guaranteed bit-identical run to run. Clean refusal (no stall)
when the reserve cannot be met.
SYCL changes are verified by inspection only, which does not meet
AGENTS.md's build-every-touched-backendrule; an Intel/HIP machine should build them before this is merged.
What this leaves alone
change the qwen35moe fast-mode auto-cache path: the bucketed haircut activates under WDDM for eligible
native non-indexed models even without
--vram-frac, and the router lookahead uses the model's activeexpert count (8 instead of 10). qwen4exp keeps its measured-shortfall loop; no other default path changes.
measured-shortfall loop for qwen4exp.
templated 512/10 + 256/8 commit here).
Follow-up fixes from an adversarial review (2026-10-10)
Three review findings were fixed on top of the stack:
MTP F16: keep NaN NaN in the F16/BF16 conversion— the rounded addition carried NaN into infinity or asigned zero; NaN now keeps a nonzero BF16 mantissa.
SYCL: refuse a malformed STRATA_VRAM_FRAC like the CUDA build does— 0, NaN, empty, trailing junk andunderflow-to-zero were silently ignored; they now exit 2 as on CUDA.
VRAM cap: check the floor at every chunk, at serve decode admission, before pipelined windows— thefloor was checked only before the first prompt chunk; a long prefill, a fully reused prompt, and the
--pipeline-windowsdecode loop could step past it. Prefill now has a per-chunk guard, serve re-checksat decode admission, all five
pl_launchsites are guarded (the initial A, the speculative B, thepromoted A's stage-1 launch, and both prompt-pipeline launches), and the first-use chunked-GDN scratch
allocation checks the floor before taking its bytes.
Still open from that review (not fixed here): the stack does not meet the repo's one-change-per-PR rule,
and HIP/SYCL builds are not run.
Known limits
available.
because the whole arena cannot be pinned (a host limit, unrelated to these paths).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.