mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4347] [Engine] q36: give the packed Q8_0 decode copies back to the expert slots in the hybrid mode #5018
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#5018
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/4347
Author: @rynwang
Created: 10/27/2026
Status: 🔄 Open
Base:
main← Head:q36-hybrid-drop-packed📝 Commits (1)
911fde4q36: give the packed Q8_0 decode copies back to the expert slots in the hybrid mode📊 Changes
1 file changed (+21 additions, -13 deletions)
View changed files
📝
src/qwen35/q36_engine.cu(+21 -13)📄 Description
Problem and result
The q36 hybrid mode keeps 1.78 GiB of packed Q8_0 decode copies in VRAM (
place_experts), which speed up the dense1-4 column GEMVs of the decode. In the hybrid mode the decode waits on the CPU expert pool instead, so that VRAM is
worth more as expert slots: 66 → 92 of 256 per layer at 8192 cells (50 → 76 at 32768). Measured on an RTX 4080
SUPER 16 GB (WSL2, i7-14700KF, engine 0.1.54 at
870aedd, CUDA 12.4, Qwen3.6-35B-A3B-UD-Q4_K_XL,--chunk 4096,--mtp 0), three alternating runs per arm, same binary:With the MTP drafts on (
--mtp 2, 8192 cells) the same arms were 60.8 vs 63.8 tok/s. So: decode +9% and prompt +6%at 8K, decode +10% at 32K, with no text change — the give-back path already exists and reads the GGUF layout, which
the engine documents as bitwise the same outputs.
On the 11 GB GTX 1080 Ti (sm_61, the same model and settings) the copies take almost all of the slots there are:
3 of 256 per layer with them, 30 without, decode 31.1 -> 33.5 tok/s, prompt 6,867 -> 7,171 ms (-4%).
Approach
The existing give-back block (which frees the copies when that makes every expert fit) is extended to the hybrid
mode: free them when fewer than a third of the experts fit with them, i.e. when the placement is far from fitting
and the slots are the scarce thing. A hybrid placement that holds most of the experts keeps the copies, where the
dense GEMVs are what the decode waits on.
STRATA_Q36_KEEP_PACKED=1keeps today's behaviour either way, and thelog line says which of the two reasons applied.
Validation
Passed (RTX 4080 SUPER 16 GB, WSL2 Ubuntu 22.04, driver 581.80, CUDA 12.4, sm_89 + sm_61 build):
STRATA_Q36_KEEP_PACKED=1(today's arm) against the new default, three alternating runs per arm at8192 cells and three at 32768 cells (table above).
the packed Q8_0 decode copies (1.78 GiB) given back to the expert slots: the hybrid mode's decode waits on the CPU pool, and the placement is the same as the old code withSTRATA_Q8_PACKED=0(92 against 92 experts per layer).
the decode is 31.1 -> 33.5 tok/s (the prompt is 4% slower in that pair, 6,867 -> 7,171 ms).
ctest(-DSTRATA_BUILD_TESTS=ON): 201 of 205 in the same build; the 4 failures are environment/build onesdescribed in #4335 and none touch
place_experts.Not run:
there by construction, but I could not run it.
--batch), where the give-back applies too.Independent validation (from the comments)
1.6% prefill+generation cost in that arm; with residency frozen, the kept and released placements each match
main's explicit 63 / 89 placement bitwise, and packed on/off at the same 63 slots gives identical logits. Thedynamic-run divergence they first saw reproduces on unmodified
main(the hybrid mode's slot adaptation).decode +14% chat / +9% agent, prompt unchanged. Above the line (92 and 98 kept slots, forced with a local test
switch on this PR's head), releasing gave 119 / 124 slots and +13.2% / +12.2% chat, +9.3% agent, prompt -0.2% — so
the
ne/3line is conservative. This PR keeps it: both validators recommend that until the 90-150 slot range andlong prompts are measured, and the only long-prompt data (Thymos2027's fixed-history arm) shows a prefill cost there.
Limits
contexts measured here and the fact that the copies are meant to speed the dense path.
STRATA_Q36_KEEP_PACKED=1restores today's placement.Related: #4332 (prompt chunk in the same hybrid mode) and #4335 (its PR).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.