[PR #478] [CLOSED] prefill: MMQ prompt kernels for Q6_K experts (STRATA_MMQ_KQUANTS) #2657

Closed
opened 2026-11-04 02:02:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/478
Author: @yannickloth
Created: 10/2/2026
Status: ❌ Closed

Base: main ← Head: feat/mmq-q6k


📝 Commits (10+)

  • cacffa9 CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier stats
  • a348c7a Merge branch 'f-131-srv' into r131-q4
  • b93a00c Merge branch 'f-q4-on242' into r131-q4
  • 8f5148c CS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on
  • 5ffda19 CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory)
  • ed6c124 #253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down
  • 450149d --split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV
  • 6926e0b Merge branch 'f-131-amd' into r131-amd
  • c7aa3e5 Revert #257 (AVX2 two-block Q2_0 unpack): bit-exact but not faster on an AVX2-only CPU (Ryzen 9 3900X: gate/up -2.6..-4.7% at 1 token, down -3..-5% at 2 tokens)
  • 2736bd0 CS-T: the partial pin locks only what it does not register and ends at an expert boundary; the Q4_K/Q5_1/Q8_0 multi-token kernels opt-in (STRATA_KQ256=1)

📄 Description

STRATA_MMQ_KQUANTS builds the CUDA MMQ prompt kernels for Q4_K, Q5_K and Q5_1. Q6_K is the same K-quant family and ggml already ships an MMQ instance for it (ggml/src/ggml-cuda/template-instances/mmq-instance-q6_k.cu), so experts stored as Q6_K currently fall back to dequant-to-FP16 + cuBLAS on the prompt path.

This wires Q6_K through the same build option:

  • CMakeLists.txt: append q6_k to _strata_mmq_cuda_types under STRATA_MMQ_KQUANTS; option comment/description now say Q4_K / Q5_K / Q5_1 / Q6_K.
  • src/prefill/moe_mmq.cu: GGML_TYPE_Q6_K in supported() and the mul_mat_q_case dispatch, both inside the existing #ifdef STRATA_MMQ_KQUANTS.
  • tests/cuda/prefill_mmq_kquant_test.cpp: screen Q6_K gate/up (1280 x 2560) against the dequantized reference, and drop the "Q6_K should not be covered" assertion (it is covered now).

The option stays off by default, for the same reason as the others: the kernels load eagerly and cost VRAM / expert slots.

Status — please read before merging (opened as a draft):

  • I could not build CUDA where this was prepared. The change is mechanical and the Q6_K MMQ instance / DECL_MMQ_CASE(GGML_TYPE_Q6_K) exist in the pinned llama.cpp, but this needs a build of prefill_mmq_kquant_test (STRATA_MMQ_KQUANTS=ON, STRATA_BUILD_TESTS=ON) and CI.
  • No A3000 prompt-speed numbers for a Q6_K pack are attached yet; the sm_86 figures in the fork are for the Q4_K/Q5_K/Q5_1 option.
  • Design question: I extended the existing option rather than adding a new one. If you'd rather keep STRATA_MMQ_KQUANTS scoped to UD-Q4_K_XL's formats, Q6_K can move behind its own option instead.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/478 **Author:** [@yannickloth](https://github.com/yannickloth) **Created:** 10/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/mmq-q6k` --- ### 📝 Commits (10+) - [`cacffa9`](https://github.com/Niko1221/Strata/commit/cacffa95aff016939edd7c15534c0067ec0ee93c) CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier stats - [`a348c7a`](https://github.com/Niko1221/Strata/commit/a348c7a4ed64f5f7f24ce3f1cba2d1439f673fed) Merge branch 'f-131-srv' into r131-q4 - [`b93a00c`](https://github.com/Niko1221/Strata/commit/b93a00c65a21fcc5b6431b8091e348d2976259f0) Merge branch 'f-q4-on242' into r131-q4 - [`8f5148c`](https://github.com/Niko1221/Strata/commit/8f5148c14d34c404e8a2d6a45188088714f3c9bb) CS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on - [`5ffda19`](https://github.com/Niko1221/Strata/commit/5ffda19098202b82943fc80281ce0eb34d8e08a3) CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory) - [`ed6c124`](https://github.com/Niko1221/Strata/commit/ed6c1244dcd31789007540cb9d8498fbd4134b7f) #253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down - [`450149d`](https://github.com/Niko1221/Strata/commit/450149d3f248438d8a2526c600b5a75c3dbea6c6) --split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV - [`6926e0b`](https://github.com/Niko1221/Strata/commit/6926e0b4f4f72cda4f95a0218a89500135af7e4e) Merge branch 'f-131-amd' into r131-amd - [`c7aa3e5`](https://github.com/Niko1221/Strata/commit/c7aa3e5c18a57433d2fe3e131bf3e44da9f82c0d) Revert #257 (AVX2 two-block Q2_0 unpack): bit-exact but not faster on an AVX2-only CPU (Ryzen 9 3900X: gate/up -2.6..-4.7% at 1 token, down -3..-5% at 2 tokens) - [`2736bd0`](https://github.com/Niko1221/Strata/commit/2736bd0a70c0295c19c4670f1a8c18c75fed2f6d) CS-T: the partial pin locks only what it does not register and ends at an expert boundary; the Q4_K/Q5_1/Q8_0 multi-token kernels opt-in (STRATA_KQ256=1) ### 📄 Description `STRATA_MMQ_KQUANTS` builds the CUDA MMQ prompt kernels for Q4_K, Q5_K and Q5_1. Q6_K is the same K-quant family and ggml already ships an MMQ instance for it (`ggml/src/ggml-cuda/template-instances/mmq-instance-q6_k.cu`), so experts stored as Q6_K currently fall back to dequant-to-FP16 + cuBLAS on the prompt path. This wires Q6_K through the same build option: - `CMakeLists.txt`: append `q6_k` to `_strata_mmq_cuda_types` under `STRATA_MMQ_KQUANTS`; option comment/description now say Q4_K / Q5_K / Q5_1 / Q6_K. - `src/prefill/moe_mmq.cu`: `GGML_TYPE_Q6_K` in `supported()` and the `mul_mat_q_case` dispatch, both inside the existing `#ifdef STRATA_MMQ_KQUANTS`. - `tests/cuda/prefill_mmq_kquant_test.cpp`: screen Q6_K gate/up (1280 x 2560) against the dequantized reference, and drop the `"Q6_K should not be covered"` assertion (it is covered now). The option stays off by default, for the same reason as the others: the kernels load eagerly and cost VRAM / expert slots. **Status — please read before merging (opened as a draft):** - I could not build CUDA where this was prepared. The change is mechanical and the Q6_K MMQ instance / `DECL_MMQ_CASE(GGML_TYPE_Q6_K)` exist in the pinned llama.cpp, but this needs a build of `prefill_mmq_kquant_test` (`STRATA_MMQ_KQUANTS=ON`, `STRATA_BUILD_TESTS=ON`) and CI. - No A3000 prompt-speed numbers for a Q6_K pack are attached yet; the sm_86 figures in the fork are for the Q4_K/Q5_K/Q5_1 option. - Design question: I extended the existing option rather than adding a new one. If you'd rather keep `STRATA_MMQ_KQUANTS` scoped to UD-Q4_K_XL's formats, Q6_K can move behind its own option instead. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:08 +07:00
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#2657
No description provided.