[GH-ISSUE #4346] [Engine] q36 hybrid mode: the packed Q8_0 decode copies cost more than the expert slots they hold (decode +9-10%, prompt +6%) #1918

Open
opened 2026-11-04 01:55:18 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @rynwang on GitHub (Oct 27, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4346

Area: [Engine] (speed, kernels, models, the server and API)

Desktop app, Terminal or source? Source checkout, built from git

Reproduction status: Reproduced locally

Strata version: 0.2.11 (main 9f7d977, engine 0.1.57); first reported on 0.1.52. Built with CUDA 12.4, -DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES="61;89"

Graphics card, memory and system: RTX 4080 SUPER 16 GB (sm_89), WSL2 Ubuntu 22.04, i7-14700KF, 24 GB of RAM given
to WSL, driver 581.80. Engine and model file on ext4.

Model, size and settings: Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf (Unsloth, 22.85 GB, sha256
55983c5a75a1ab969824077b3bb3de4146e82a9234072b48ad4e8f92ad3fe9f1), --gpu 0 --max-context 8192|32768 --tokens <4096 ids> --n 128 --chunk 4096 --mtp 0 (decode measured without MTP in this table, and with --mtp 2 in the last row).

What I measured

This model does not fit a 16 GB card, so the q36 engine runs the hybrid mode and keeps a set of packed Q8_0 decode
copies
in VRAM (1.78 GiB, place_experts, given back only when that makes every expert fit). Those copies speed up
the dense 1-4 column GEMVs of the decode — but in the hybrid mode the decode waits on the CPU expert pool instead, so
the same VRAM is worth more as expert slots: 66 → 92 of 256 per layer at 8192 cells (50 → 76 at 32768).

Three alternating runs per arm, same binary, STRATA_Q36_KEEP_PACKED=1 keeps the copies:

cells packed copies slots/layer prompt tok/s (ms) decode tok/s
8192 kept 66 1,285 (3,187 / 3,083 / 3,246) 45.6 (45.6 / 44.5 / 45.6)
8192 given back 92 1,361 (2,973 / 3,017 / 3,010) 49.9 (50.5 / 49.9 / 49.5)
32768 kept 50 1,307 43.3
32768 given back 76 1,324 / 1,398 47.6 / 48.5

With the MTP drafts on (--mtp 2, 8192 cells), the same arms were 60.8 vs 63.8 tok/s. So giving the copies back is
about +9% decode and +6% prompt at 8K and +10% decode at 32K here, and the text is unaffected (the decode reads
the GGUF layout then, bitwise the same outputs — the existing give-back path already does this when the experts fit).

Re-tested on 0.2.11 (2026-11-06)

Rebuilt main 9f7d977 and repeated the decode arm (4-token prompt, 256 generated, --chunk 4096 --mtp 2, two
alternating pairs): copies kept 68.4 / 76.4 tok/s at 65 experts per layer, copies given back 86.5 / 85.1 tok/s at 92
(+17%). 0.2.11 still gives the copies back only when every expert fits, so the report still applies.

Proposal

Extend the existing give-back to the hybrid mode when the slots are the scarce thing (fewer than a third of the
experts fit with the copies). A card that holds most of the experts keeps them, where the dense GEMVs are what the
decode waits on, and STRATA_Q36_KEEP_PACKED=1 keeps today's behaviour either way. The patch is small (it reuses the
give-back block and E.use_mmq), and I have it running and measured; I can send it as a PR.

What I have not tested

  • A hybrid placement that holds most experts (e.g. 24 GB with a 26 GB model): the one-third line keeps the copies
    there by construction, but I could not run it.
  • HIP, SYCL, Metal, the Windows build (the change is host-side VRAM placement in place_experts).
  • --batch (the give-back is placement-wide, so it applies to batched sessions too).

Related: #4332 is a different lever on the same hybrid mode (prompt chunk).

Originally created by @rynwang on GitHub (Oct 27, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4346 **Area:** `[Engine]` (speed, kernels, models, the server and API) **Desktop app, Terminal or source?** Source checkout, built from git **Reproduction status:** Reproduced locally **Strata version:** 0.2.11 (`main` 9f7d977, engine 0.1.57); first reported on 0.1.52. Built with CUDA 12.4, `-DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES="61;89"` **Graphics card, memory and system:** RTX 4080 SUPER 16 GB (sm_89), WSL2 Ubuntu 22.04, i7-14700KF, 24 GB of RAM given to WSL, driver 581.80. Engine and model file on ext4. **Model, size and settings:** `Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf` (Unsloth, 22.85 GB, sha256 `55983c5a75a1ab969824077b3bb3de4146e82a9234072b48ad4e8f92ad3fe9f1`), `--gpu 0 --max-context 8192|32768 --tokens <4096 ids> --n 128 --chunk 4096 --mtp 0` (decode measured without MTP in this table, and with `--mtp 2` in the last row). ## What I measured This model does not fit a 16 GB card, so the q36 engine runs the hybrid mode and keeps a set of **packed Q8_0 decode copies** in VRAM (1.78 GiB, `place_experts`, given back only when that makes every expert fit). Those copies speed up the dense 1-4 column GEMVs of the decode — but in the hybrid mode the decode waits on the CPU expert pool instead, so the same VRAM is worth more as expert slots: **66 → 92 of 256 per layer at 8192 cells** (50 → 76 at 32768). Three alternating runs per arm, same binary, `STRATA_Q36_KEEP_PACKED=1` keeps the copies: | cells | packed copies | slots/layer | prompt tok/s (ms) | decode tok/s | | --- | --- | --- | --- | --- | | 8192 | kept | 66 | 1,285 (3,187 / 3,083 / 3,246) | 45.6 (45.6 / 44.5 / 45.6) | | 8192 | given back | 92 | **1,361** (2,973 / 3,017 / 3,010) | **49.9** (50.5 / 49.9 / 49.5) | | 32768 | kept | 50 | 1,307 | 43.3 | | 32768 | given back | 76 | **1,324 / 1,398** | **47.6 / 48.5** | With the MTP drafts on (`--mtp 2`, 8192 cells), the same arms were 60.8 vs 63.8 tok/s. So giving the copies back is about **+9% decode and +6% prompt at 8K** and **+10% decode at 32K** here, and the text is unaffected (the decode reads the GGUF layout then, bitwise the same outputs — the existing give-back path already does this when the experts fit). ## Re-tested on 0.2.11 (2026-11-06) Rebuilt `main` 9f7d977 and repeated the decode arm (4-token prompt, 256 generated, `--chunk 4096 --mtp 2`, two alternating pairs): copies kept 68.4 / 76.4 tok/s at 65 experts per layer, copies given back 86.5 / 85.1 tok/s at 92 (**+17%**). 0.2.11 still gives the copies back only when every expert fits, so the report still applies. ## Proposal Extend the existing give-back to the hybrid mode when the slots are the scarce thing (fewer than a third of the experts fit with the copies). A card that holds most of the experts keeps them, where the dense GEMVs are what the decode waits on, and `STRATA_Q36_KEEP_PACKED=1` keeps today's behaviour either way. The patch is small (it reuses the give-back block and `E.use_mmq`), and I have it running and measured; I can send it as a PR. ## What I have not tested - A hybrid placement that holds most experts (e.g. 24 GB with a 26 GB model): the one-third line keeps the copies there by construction, but I could not run it. - HIP, SYCL, Metal, the Windows build (the change is host-side VRAM placement in `place_experts`). - `--batch` (the give-back is placement-wide, so it applies to batched sessions too). Related: #4332 is a different lever on the same hybrid mode (prompt chunk).
Author
Owner

@rynwang commented on GitHub (Oct 27, 2026):

Adding a small-card datapoint: on the 11 GB GTX 1080 Ti (sm_61, same model, --chunk 4096 --mtp 2) the 1.78 GiB of copies take almost every slot there is — 3 of 256 experts per layer with them, 30 without — decode 31.1 → 33.5 tok/s, prompt 6,867 → 7,171 ms (-4%). The PR is #4347 (branch q36-hybrid-drop-packed).

<!-- gh-comment-id:6450427531 --> @rynwang commented on GitHub (Oct 27, 2026): Adding a small-card datapoint: on the 11 GB GTX 1080 Ti (sm_61, same model, `--chunk 4096 --mtp 2`) the 1.78 GiB of copies take almost every slot there is — **3 of 256 experts per layer with them, 30 without** — decode 31.1 → 33.5 tok/s, prompt 6,867 → 7,171 ms (-4%). The PR is #4347 (branch `q36-hybrid-drop-packed`).
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660278868 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Author
Owner

@rynwang commented on GitHub (Nov 6, 2026):

Re-tested on 0.2.11 (main 9f7d977, engine 0.1.57), built from source here (CUDA 12.4, sm_89 + sm_61), RTX 4080 SUPER 16 GB, WSL2, Qwen3.6-35B-A3B-UD-Q4_K_XL, --gpu 0 --max-context 8192 --chunk 4096 --mtp 2, a 4-token prompt and 256 generated tokens, two alternating pairs, page cache dropped before each run:

arm experts/layer in VRAM decode tok/s
copies kept (STRATA_Q36_KEEP_PACKED=1) 65 / 256 68.4 / 76.4
copies given back (the PR) 92 / 256 86.5 / 85.1

So it still applies on 0.2.11: the engine there gives the copies back only when every expert fits, and giving them back in this hybrid placement is +17% decode (65 -> 92 slots). The PR (#4347) is rebased onto 0.2.11 as 911fde4 and mergeable; the validators' controls on the earlier head (same-chunk logits bitwise equal, released placement equals main with an explicit 89-slot placement) still describe the code, which is unchanged between 0.1.54 and 0.1.57 except for two unrelated hunks (#4708 warmup, #4590 penalties).

/reopen

<!-- gh-comment-id:6674099204 --> @rynwang commented on GitHub (Nov 6, 2026): Re-tested on 0.2.11 (`main` 9f7d977, engine 0.1.57), built from source here (CUDA 12.4, sm_89 + sm_61), RTX 4080 SUPER 16 GB, WSL2, Qwen3.6-35B-A3B-UD-Q4_K_XL, `--gpu 0 --max-context 8192 --chunk 4096 --mtp 2`, a 4-token prompt and 256 generated tokens, two alternating pairs, page cache dropped before each run: | arm | experts/layer in VRAM | decode tok/s | | --- | --- | --- | | copies kept (`STRATA_Q36_KEEP_PACKED=1`) | 65 / 256 | 68.4 / 76.4 | | copies given back (the PR) | 92 / 256 | **86.5 / 85.1** | So it still applies on 0.2.11: the engine there gives the copies back only when every expert fits, and giving them back in this hybrid placement is **+17% decode** (65 -> 92 slots). The PR (#4347) is rebased onto 0.2.11 as `911fde4` and mergeable; the validators' controls on the earlier head (same-chunk logits bitwise equal, released placement equals `main` with an explicit 89-slot placement) still describe the code, which is unchanged between 0.1.54 and 0.1.57 except for two unrelated hunks (`#4708` warmup, `#4590` penalties). /reopen
Author
Owner

@rynwang commented on GitHub (Nov 6, 2026):

/reopen

Re-tested on 0.2.11 today (see the body): copies kept 68.4/76.4 tok/s at 65 experts per layer, given back 86.5/85.1 at 92 (+17%). 0.2.11 still gives them back only when every expert fits, so this still applies.

<!-- gh-comment-id:6674135935 --> @rynwang commented on GitHub (Nov 6, 2026): /reopen Re-tested on 0.2.11 today (see the body): copies kept 68.4/76.4 tok/s at 65 experts per layer, given back 86.5/85.1 at 92 (+17%). 0.2.11 still gives them back only when every expert fits, so this still applies.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 6, 2026):

Reopened, thank you. A maintainer will pick it up from here.

<!-- gh-comment-id:6674139578 --> @github-actions[bot] commented on GitHub (Nov 6, 2026): Reopened, thank you. A maintainer will pick it up from here.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1918
No description provided.