[PR #2810] [Engine] sycl: STRATA_HC_Q8=1 reads the Q8_0 hyper-connection projections (it loaded them and never read them) #4275

Open
opened 2026-11-07 15:34:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2810
Author: @hotschmoe
Created: 10/16/2026
Status: 🔄 Open

Base: main ← Head: pr/sycl-hc-q8


📝 Commits (1)

  • f1cdc43 sycl: STRATA_HC_Q8=1 reads the Q8_0 hyper-connection projections (it loaded them and never read them)

📊 Changes

6 files changed (+829 additions, -22 deletions)

View changed files

📝 docs/INTEL.md (+46 -0)
📝 sycl/CMakeLists.txt (+1 -1)
➕ sycl/include/strata/kernels/fused_gr_q8.hpp (+16 -0)
📝 sycl/src/core/native_dense.cpp (+29 -20)
📝 sycl/src/kernels/cuda/fused_gr.dp.cpp (+411 -1)
➕ sycl/src/kernels/gr_q8_parity.cpp (+326 -0)

📄 Description

Problem and result

On the SYCL (Intel) build STRATA_HC_Q8=1 did nothing. The loader kept a Q8_0 copy of the hyper-connection projections only when the GGUF stored them as Q8_0 (the ISTA files store BF16, so nothing was copied), and the port's fused_gr_read_multi had no Q8_0 read: it ignored q8_down / q8_up and read the BF16 copies whatever the flag said (fused_gr.dp.cpp: "the Q8_0 reads (S23 STRATA_HC_Q8) are not built"). Still the case on 0.2.0-beta.

With this change the flag does on SYCL what it does on CUDA: the hyper-connection down / up projections (the layers' and the final mixer's) are read as Q8_0 in the verify window, from the GGUF's own Q8_0 blocks or from its BF16 values quantized at load. Flag unset: nothing changes.

Result on 0.2.0-beta, two B70s, one stream: verify window 39.4 / 40.0 -> 36.8 / 36.9 ms (-7%), decode 70.6 / 73.9 -> 82.4 / 87.8 tok/s (part of it a different draft acceptance of the changed output). Prompt reading unchanged. Costs 0.63 GiB of VRAM (below).

Bug report #2809 (closed in the 0.2.0 tracker reset). #2812 (STRATA_GR_FUSED=1) is stacked on this branch.

Approach

  • sycl/src/kernels/cuda/fused_gr.dp.cpp, namespace gr_q8: two kernels. The down kernel stages a 512-column slab of R' * w_norm for the T rows with the slab's sums of squares, each lane holds 4 rows' quants over its sub-group's 32 columns, the 16 sub-groups add their partials in a fixed order, and the last work-group of a row group to arrive (an atomic counter, no waiting, so it is safe inside a SYCL graph) applies rs per stream and resets the counter. The up kernel splits K = 320 over five sub-groups summed in a fixed order, then the default read's epilogue. One guarded line in fused_gr_read_multi; null pointers (the default) skip it. Rows not at the callers' fixed strides fall back to the BF16 read with one stderr line. Scratch per queue, allocated outside any capture.
  • sycl/src/core/native_dense.cpp: with the flag, hyper-connection tensors of GGUF type 8 (Q8_0) and type 30 (BF16, quantized on the host with the file's q8_0_of, ggml's rounding) are uploaded in the split layout, shape-checked, another stage's layers skipped in a layer split.
  • sycl/include/strata/kernels/fused_gr_q8.hpp (new), sycl/src/kernels/gr_q8_parity.cpp (new, in the --selftest loop), docs/INTEL.md.

Not changed: src/, include/ (CUDA / HIP / Mac untouched), the default SYCL read, STRATA_GR_V3, STRATA_HC_SPLIT.

Validation

Setup: 0.2.0-beta main e88ee39d against this branch rebased on it. 2x Intel Arc Pro B70 32 GB, kernel 7.1, Compute Runtime 26.22.38646.4 at run time; built with the repository dev image (sycl/tools/Dockerfile on the current llama-sycl-b70:stable, IGC 2.41.5; an older cached base with IGC 2.36.3 cannot build 0.2.0, see #3219), AOT bmg-g31. Model Qwen3.8-Flash-Next ISTA GSQ-RCO IQ3_XXS, --layer-split 30 --prefill 8192 --max-context 32768 --vram-reserve-mib 512 --kv int8 --spec 4 --mtp <BF16 draft layer> --mtp-max-t 4 --spec-min-p 0 --stream-experts --expert-cache auto, one slot, greedy, two fixed coding prompts with 512-token replies, a fresh engine per arm, then a fresh 4K prompt. Coherence check and per-card health after every stop.

Passed:

  • gr_q8_parity --selftest (0.2.0-beta + this branch, head f1cdc43d, one B70): gr_q8_parity: pass (0 failing of 33 cases) (T = 1..8 x pending write x inject rows; against an FP64 reference from the same Q8_0 bytes within 1e-4; R_out bitwise; graph replay bitwise; Q8_0 mixed differs from BF16 by the weights' rounding, which proves the Q8_0 bytes are read; fallback bitwise).
  • Engine A/B at --max-context 32768 --vram-reserve-mib 512 (decode tok/s, tokens per window, ms per window):
prompt 1 prompt 2 4K read tok/s
this branch, flag unset 70.6, 2.78, 39.4 ms 73.9, 2.96, 40.0 ms 1,220
STRATA_HC_Q8=1 82.4, 3.03, 36.8 ms 87.8, 3.24, 36.9 ms 1,226
  • Flag unset: output SHAs and draft counts identical to main e88ee39d (main measured at --max-context 65536; this branch unset gave the same SHAs at 65536 and at 32768). Flag set: coherent, text differs (Q8_0 weights). Coherence true and per-card health passed after every stop.

Failed:

  • At --max-context 65536 with the default 1,024 MiB reserve the engine refuses to start with the flag (REFUSED: 310 experts are neither in VRAM nor mirrored), the same as on 0.1.x: the 0.63 GiB of Q8_0 copies come out of the expert cache. This is the VRAM limit below, not a crash.

Not run: the teacher-forced NLL on 0.2.0 (on 0.1.x, 4,762 tokens: 3.1974 unset vs 3.1699 set, no degradation measured, not claimed as an improvement); kernel timings on 0.2.0 (unchanged code; on 0.1.x BF16 -> Q8_0 read T = 1 / 4 / 6: 38.7 -> 24.7, 50.8 -> 29.3, 62.0 -> 34.4 us); two streams; CUDA/HIP (not touched); ctest as a whole.

Limits

  • VRAM: on this port the BF16 copies stay (the prompt path's GEMMs read them), so the flag adds 0.63 GiB for Flash-Next (0.40 + 0.24 GiB over a two-card split) instead of replacing BF16 as on a single CUDA GPU. Dropping the BF16 copies (add_hc_skip / hc_bf16_view) is not ported here.
  • As on CUDA, not bitwise the BF16 read (Q8_0-rounded weights, another summation order).
  • STRATA_HC_Q8_INJECT has no effect on SYCL: the read takes the inject rows from BF16.
  • The docs/INTEL.md section quotes the 0.1.x measurement (main 296b59d2); I can swap in the 0.2.0 numbers.
  • Prepared with AI assistance (Claude Code): the code, the measurements and this text were produced by Claude on the submitter's two Arc Pro B70s, at the submitter's request.

🤖 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/2810 **Author:** [@hotschmoe](https://github.com/hotschmoe) **Created:** 10/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/sycl-hc-q8` --- ### 📝 Commits (1) - [`f1cdc43`](https://github.com/Niko1221/Strata/commit/f1cdc43d3bd8f8f660995c9689b86ea48b2e8d12) sycl: STRATA_HC_Q8=1 reads the Q8_0 hyper-connection projections (it loaded them and never read them) ### 📊 Changes **6 files changed** (+829 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `docs/INTEL.md` (+46 -0) 📝 `sycl/CMakeLists.txt` (+1 -1) ➕ `sycl/include/strata/kernels/fused_gr_q8.hpp` (+16 -0) 📝 `sycl/src/core/native_dense.cpp` (+29 -20) 📝 `sycl/src/kernels/cuda/fused_gr.dp.cpp` (+411 -1) ➕ `sycl/src/kernels/gr_q8_parity.cpp` (+326 -0) </details> ### 📄 Description ## Problem and result On the SYCL (Intel) build `STRATA_HC_Q8=1` did nothing. The loader kept a Q8_0 copy of the hyper-connection projections only when the GGUF stored them as Q8_0 (the ISTA files store BF16, so nothing was copied), and the port's `fused_gr_read_multi` had no Q8_0 read: it ignored `q8_down` / `q8_up` and read the BF16 copies whatever the flag said (`fused_gr.dp.cpp`: "the Q8_0 reads (S23 STRATA_HC_Q8) are not built"). Still the case on 0.2.0-beta. With this change the flag does on SYCL what it does on CUDA: the hyper-connection down / up projections (the layers' and the final mixer's) are read as Q8_0 in the verify window, from the GGUF's own Q8_0 blocks or from its BF16 values quantized at load. Flag unset: nothing changes. Result on 0.2.0-beta, two B70s, one stream: verify window 39.4 / 40.0 -> 36.8 / 36.9 ms (-7%), decode 70.6 / 73.9 -> 82.4 / 87.8 tok/s (part of it a different draft acceptance of the changed output). Prompt reading unchanged. Costs 0.63 GiB of VRAM (below). ## Related discussion Bug report #2809 (closed in the 0.2.0 tracker reset). #2812 (`STRATA_GR_FUSED=1`) is stacked on this branch. ## Approach - `sycl/src/kernels/cuda/fused_gr.dp.cpp`, `namespace gr_q8`: two kernels. The down kernel stages a 512-column slab of `R' * w_norm` for the T rows with the slab's sums of squares, each lane holds 4 rows' quants over its sub-group's 32 columns, the 16 sub-groups add their partials in a fixed order, and the last work-group of a row group to arrive (an atomic counter, no waiting, so it is safe inside a SYCL graph) applies rs per stream and resets the counter. The up kernel splits K = 320 over five sub-groups summed in a fixed order, then the default read's epilogue. One guarded line in `fused_gr_read_multi`; null pointers (the default) skip it. Rows not at the callers' fixed strides fall back to the BF16 read with one stderr line. Scratch per queue, allocated outside any capture. - `sycl/src/core/native_dense.cpp`: with the flag, hyper-connection tensors of GGUF type 8 (Q8_0) and type 30 (BF16, quantized on the host with the file's `q8_0_of`, ggml's rounding) are uploaded in the split layout, shape-checked, another stage's layers skipped in a layer split. - `sycl/include/strata/kernels/fused_gr_q8.hpp` (new), `sycl/src/kernels/gr_q8_parity.cpp` (new, in the `--selftest` loop), `docs/INTEL.md`. Not changed: `src/`, `include/` (CUDA / HIP / Mac untouched), the default SYCL read, `STRATA_GR_V3`, `STRATA_HC_SPLIT`. ## Validation Setup: 0.2.0-beta `main` e88ee39d against this branch rebased on it. 2x Intel Arc Pro B70 32 GB, kernel 7.1, Compute Runtime 26.22.38646.4 at run time; built with the repository dev image (`sycl/tools/Dockerfile` on the current `llama-sycl-b70:stable`, IGC 2.41.5; an older cached base with IGC 2.36.3 cannot build 0.2.0, see #3219), AOT `bmg-g31`. Model Qwen3.8-Flash-Next ISTA GSQ-RCO IQ3_XXS, `--layer-split 30 --prefill 8192 --max-context 32768 --vram-reserve-mib 512 --kv int8 --spec 4 --mtp <BF16 draft layer> --mtp-max-t 4 --spec-min-p 0 --stream-experts --expert-cache auto`, one slot, greedy, two fixed coding prompts with 512-token replies, a fresh engine per arm, then a fresh 4K prompt. Coherence check and per-card health after every stop. **Passed:** - `gr_q8_parity --selftest` (0.2.0-beta + this branch, head f1cdc43d, one B70): `gr_q8_parity: pass (0 failing of 33 cases)` (T = 1..8 x pending write x inject rows; against an FP64 reference from the same Q8_0 bytes within 1e-4; R_out bitwise; graph replay bitwise; Q8_0 `mixed` differs from BF16 by the weights' rounding, which proves the Q8_0 bytes are read; fallback bitwise). - Engine A/B at `--max-context 32768 --vram-reserve-mib 512` (decode tok/s, tokens per window, ms per window): | | prompt 1 | prompt 2 | 4K read tok/s | |---|---|---|---| | this branch, flag unset | 70.6, 2.78, 39.4 ms | 73.9, 2.96, 40.0 ms | 1,220 | | `STRATA_HC_Q8=1` | 82.4, 3.03, 36.8 ms | 87.8, 3.24, 36.9 ms | 1,226 | - Flag unset: output SHAs and draft counts identical to main e88ee39d (main measured at `--max-context 65536`; this branch unset gave the same SHAs at 65536 and at 32768). Flag set: coherent, text differs (Q8_0 weights). Coherence true and per-card health passed after every stop. **Failed:** - At `--max-context 65536` with the default 1,024 MiB reserve the engine refuses to start with the flag (`REFUSED: 310 experts are neither in VRAM nor mirrored`), the same as on 0.1.x: the 0.63 GiB of Q8_0 copies come out of the expert cache. This is the VRAM limit below, not a crash. **Not run:** the teacher-forced NLL on 0.2.0 (on 0.1.x, 4,762 tokens: 3.1974 unset vs 3.1699 set, no degradation measured, not claimed as an improvement); kernel timings on 0.2.0 (unchanged code; on 0.1.x BF16 -> Q8_0 read T = 1 / 4 / 6: 38.7 -> 24.7, 50.8 -> 29.3, 62.0 -> 34.4 us); two streams; CUDA/HIP (not touched); `ctest` as a whole. ## Limits - VRAM: on this port the BF16 copies stay (the prompt path's GEMMs read them), so the flag adds 0.63 GiB for Flash-Next (0.40 + 0.24 GiB over a two-card split) instead of replacing BF16 as on a single CUDA GPU. Dropping the BF16 copies (`add_hc_skip` / `hc_bf16_view`) is not ported here. - As on CUDA, not bitwise the BF16 read (Q8_0-rounded weights, another summation order). - `STRATA_HC_Q8_INJECT` has no effect on SYCL: the read takes the inject rows from BF16. - The `docs/INTEL.md` section quotes the 0.1.x measurement (main 296b59d2); I can swap in the 0.2.0 numbers. - Prepared with AI assistance (Claude Code): the code, the measurements and this text were produced by Claude on the submitter's two Arc Pro B70s, at the submitter's request. 🤖 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>
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#4275
No description provided.