[PR #2340] [CLOSED] sycl mmvq: Q6_K decode kernels no longer ALU-bound; Q6_K output heads as aligned planes; int4 activation loads #3991

Closed
opened 2026-11-07 15:32:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2340
Author: @leadgtr7
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: sycl-mmvq-q6k


📝 Commits (1)

  • fd3a00f sycl mmvq: Q6_K decode kernels no longer ALU-bound; output heads as aligned planes; int4 activation loads

📊 Changes

4 files changed (+286 additions, -12 deletions)

View changed files

📝 sycl/include/strata/kernels/native_mmvq.hpp (+12 -0)
📝 sycl/src/core/mtp.cpp (+17 -1)
📝 sycl/src/core/native_head.cpp (+2 -0)
📝 sycl/src/kernels/cuda/native_mmvq.dp.cpp (+255 -11)

📄 Description

What it changes (SYCL port only, sycl/):

  • Q6_K six-bit offset as SWAR. The Q6_K wide kernel (and the planar one below) computed v - 32 with dpct's per-byte saturating char4 subtract (dpct::vectorized_binary(sub_sat)), which compiles to a per-byte loop on Xe. No byte can saturate there, so a 4-operation SWAR form gives the same bits. Q6_K dense matvec: 59.5 -> 30.8 us (1 row), 77.4 -> 45.5 us (4 rows).
  • STRATA_Q6_PLANAR (on by default, =0 turns it off). The Q6_K LM head and the MTP draft head are converted at load into ql / qh / scales / d planes (the same bytes; the GGUF-layout allocation is freed, so VRAM does not change), so each lane's loads are single aligned 16-byte loads. The draft head's subset is gathered from the planar head. native_q6_k_mmvq serves every registered matrix at any column count.
  • ld_i4_a4: the Q8_1 activation quants (4-byte aligned) are read as one dword-vector load in the Q4_K / Q5_K / IQ4_XS wide kernels (Q5_K, 4 rows: 81 -> 68 us).

These are three parts of one kernel pass and are sent together. Each gives bitwise-equal outputs; I can split them if you prefer.

What it leaves alone: CUDA and HIP (src/), the prompt path, every other quant type's math. Greedy output is byte-identical to the build without the change (below).

How it was checked, on one Arc Pro B65 32 GB (Xe2, AOT bmg-g31, xe driver, oneAPI 2026.1 strata-sycl-dev image), Swift 1.5 GSQ-RCO IQ3_S with --stream-experts (about 13,000 of 24,576 expert slots in VRAM, the rest in the pinned host mirror), --spec 4 + MTP, single slot, v0.1.44 (ed4773eb) with and without this commit, same config, 3 interleaved pairs, 3 greedy 256-token prompts + one ~9.4K-token prompt per arm:

v0.1.44 + this PR
decode tok/s (per pair) 37.0 / 36.8 / 36.8 39.3 / 39.5 / 39.0
decode, mean 36.9 39.3 (+6.6%)
prompt reading tok/s 818 817
greedy replies byte-identical 12 / 12

The kernel timings above were measured on 0.1.41 with the same kernels. The same change has been in our daily server since 0.1.41.

Not tested: Arc A-series (i915) and Arc B580/B570 (bmg-g21); models whose expert tensors are Q6_K (the Unsloth UD files); the SYCL kernel parity tests (not registered in our build image: no numpy). Windows (no SYCL launcher there).

🤖 Generated with Claude Code


🔄 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/2340 **Author:** [@leadgtr7](https://github.com/leadgtr7) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `sycl-mmvq-q6k` --- ### 📝 Commits (1) - [`fd3a00f`](https://github.com/Niko1221/Strata/commit/fd3a00f5352e177aedc2bfa43b9cdeb52dcfe09b) sycl mmvq: Q6_K decode kernels no longer ALU-bound; output heads as aligned planes; int4 activation loads ### 📊 Changes **4 files changed** (+286 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `sycl/include/strata/kernels/native_mmvq.hpp` (+12 -0) 📝 `sycl/src/core/mtp.cpp` (+17 -1) 📝 `sycl/src/core/native_head.cpp` (+2 -0) 📝 `sycl/src/kernels/cuda/native_mmvq.dp.cpp` (+255 -11) </details> ### 📄 Description **What it changes (SYCL port only, `sycl/`):** - **Q6_K six-bit offset as SWAR.** The Q6_K wide kernel (and the planar one below) computed `v - 32` with dpct's per-byte saturating `char4` subtract (`dpct::vectorized_binary(sub_sat)`), which compiles to a per-byte loop on Xe. No byte can saturate there, so a 4-operation SWAR form gives the same bits. Q6_K dense matvec: 59.5 -> 30.8 us (1 row), 77.4 -> 45.5 us (4 rows). - **`STRATA_Q6_PLANAR` (on by default, `=0` turns it off).** The Q6_K LM head and the MTP draft head are converted at load into ql / qh / scales / d planes (the same bytes; the GGUF-layout allocation is freed, so VRAM does not change), so each lane's loads are single aligned 16-byte loads. The draft head's subset is gathered from the planar head. `native_q6_k_mmvq` serves every registered matrix at any column count. - **`ld_i4_a4`:** the Q8_1 activation quants (4-byte aligned) are read as one dword-vector load in the Q4_K / Q5_K / IQ4_XS wide kernels (Q5_K, 4 rows: 81 -> 68 us). These are three parts of one kernel pass and are sent together. Each gives bitwise-equal outputs; I can split them if you prefer. **What it leaves alone:** CUDA and HIP (`src/`), the prompt path, every other quant type's math. Greedy output is byte-identical to the build without the change (below). **How it was checked**, on one Arc Pro B65 32 GB (Xe2, AOT `bmg-g31`, xe driver, oneAPI 2026.1 `strata-sycl-dev` image), Swift 1.5 GSQ-RCO IQ3_S with `--stream-experts` (about 13,000 of 24,576 expert slots in VRAM, the rest in the pinned host mirror), `--spec 4` + MTP, single slot, v0.1.44 (`ed4773eb`) with and without this commit, same config, 3 interleaved pairs, 3 greedy 256-token prompts + one ~9.4K-token prompt per arm: | | v0.1.44 | + this PR | |---|---|---| | decode tok/s (per pair) | 37.0 / 36.8 / 36.8 | 39.3 / 39.5 / 39.0 | | decode, mean | 36.9 | 39.3 (+6.6%) | | prompt reading tok/s | 818 | 817 | | greedy replies byte-identical | | 12 / 12 | The kernel timings above were measured on 0.1.41 with the same kernels. The same change has been in our daily server since 0.1.41. **Not tested:** Arc A-series (i915) and Arc B580/B570 (`bmg-g21`); models whose expert tensors are Q6_K (the Unsloth UD files); the SYCL kernel parity tests (not registered in our build image: no numpy). Windows (no SYCL launcher there). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:32:18 +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#3991
No description provided.