[PR #2812] [Engine] sycl: STRATA_GR_FUSED=1, the two-kernel BF16 hyper-connection read (opt-in) #4276

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/2812
Author: @hotschmoe
Created: 10/16/2026
Status: 🔄 Open

Base: main ← Head: pr/sycl-hc-fused-read


📝 Commits (2)

  • f1cdc43 sycl: STRATA_HC_Q8=1 reads the Q8_0 hyper-connection projections (it loaded them and never read them)
  • a703ff1 sycl: STRATA_GR_FUSED=1, the two-kernel BF16 hyper-connection read (opt-in)

📊 Changes

8 files changed (+1472 additions, -22 deletions)

View changed files

📝 docs/INTEL.md (+82 -0)
📝 sycl/CMakeLists.txt (+1 -1)
➕ sycl/include/strata/kernels/fused_gr_fused.hpp (+11 -0)
➕ 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 (+723 -1)
➕ sycl/src/kernels/gr_fused_parity.cpp (+284 -0)
➕ sycl/src/kernels/gr_q8_parity.cpp (+326 -0)

📄 Description

Problem and result

The SYCL port's default hyper-connection read issues four launches per layer half (norm, sliced down projection, reduce, up projection), each small and latency-bound on an Arc Pro B70. STRATA_GR_FUSED=1 does the norm, the down projection and its partial reduction in one kernel and the up projection in a second. Same BF16 weights, no extra VRAM, the default read's per-element arithmetic, another summation order. With the flag unset the default read runs unchanged. With STRATA_HC_Q8=1 set the Q8_0 read runs and this flag changes nothing; this read is for setups that keep BF16 (exact weights wanted, or no VRAM for the Q8_0 copies).

Result on 0.2.0-beta, two B70s, one stream: verify window 39.4 / 40.2 -> 37.9 / 38.2 ms (-4%), decode 70.6 / 73.7 -> 81.4 / 81.2 tok/s (most of the tok/s spread is a different draft acceptance of the changed output; the window time is the read's effect). Prompt reading unchanged.

Feature issue #2811 (closed in the 0.2.0 tracker reset). No maintainer agreement on scope yet. Stacked on #2810 (STRATA_HC_Q8=1): this branch is that one plus one commit and reuses its argument struct, scratch and helpers, so #2810 goes first. The diff of this PR alone is the top commit.

Approach

  • sycl/src/kernels/cuda/fused_gr.dp.cpp, namespace gr_fused: gr_fused_down_kernel (a work-group = 32 rows, 2 per lane, x a 1,280-column slab; stages R' * w_norm with the slab's sums of squares; the 16 sub-group partials added in a fixed order; the last work-group of a row group to arrive applies rs per stream and resets the counter) and gr_fused_up_kernel (16 columns x 4 streams per work-group, K in 4 quarters summed in a fixed order, then the default read's epilogue: pending write, gate, stream mean). The hook in fused_gr_read_multi, right after the Q8_0 one. Arguments not at the callers' fixed strides fall back to the default read with one stderr line. fused_gr_set_fused(int) for the parity test.
  • sycl/include/strata/kernels/fused_gr_fused.hpp (new), sycl/src/kernels/gr_fused_parity.cpp (new, in the --selftest loop), docs/INTEL.md.

Not changed: src/, include/, the default SYCL read, the Q8_0 read of #2810 (a sibling namespace and one hook line after its hook). STRATA_GR_* follows the port's prefix for its read switches.

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 65536 --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 fresh 4K and 32K prompts. Coherence check and per-card health after every stop.

Passed:

  • gr_fused_parity --selftest (0.2.0-beta + #2810 + this commit, head a703ff1e, one B70): gr_fused_parity: pass (0 failing of 33 cases) (T = 1..8 x pending write on/off x inject rows on/off; both reads against FP64 and each other within 1e-4, R_out bitwise, a captured graph replayed twice bitwise the direct call, the fixed-stride fallback bitwise the default read).
  • Engine A/B (decode tok/s, tokens per window, ms per window):
prompt 1 prompt 2 4K / 32K read tok/s
main e88ee39d 70.6, 2.78, 39.4 ms 73.9, 2.96, 40.0 ms 1,219 / 2,078
this branch, flag unset 70.6, 2.78, 39.4 ms 73.7, 2.96, 40.2 ms 1,220 / 2,080
STRATA_GR_FUSED=1 81.4, 3.08, 37.9 ms 81.2, 3.10, 38.2 ms 1,229 / 2,102
  • Flag unset: output SHAs and draft counts identical to main. Flag set: coherent, text differs after a near-tie (another summation order). Coherence true and per-card health passed after every stop.

Failed: none observed.

Not run: kernel-level timings on 0.2.0 (unchanged code; on 0.1.x: T = 1 / 4 / 6 reads 38.7 -> 34.8, 50.8 -> 41.5, 62.0 -> 47.1 us), the 40K-context turn, two streams (--batch-mtp refused on a layer split), CUDA/HIP (not touched), ctest as a whole.

Limits

  • Not bitwise the default read (lo / rs / mixed differ at FP32 rounding level, like the existing opt-in STRATA_GR_V3); greedy output changes after a near-tie.
  • 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/2812 **Author:** [@hotschmoe](https://github.com/hotschmoe) **Created:** 10/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/sycl-hc-fused-read` --- ### 📝 Commits (2) - [`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) - [`a703ff1`](https://github.com/Niko1221/Strata/commit/a703ff1ee98dd60a20893451cf43a4166d992ccd) sycl: STRATA_GR_FUSED=1, the two-kernel BF16 hyper-connection read (opt-in) ### 📊 Changes **8 files changed** (+1472 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `docs/INTEL.md` (+82 -0) 📝 `sycl/CMakeLists.txt` (+1 -1) ➕ `sycl/include/strata/kernels/fused_gr_fused.hpp` (+11 -0) ➕ `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` (+723 -1) ➕ `sycl/src/kernels/gr_fused_parity.cpp` (+284 -0) ➕ `sycl/src/kernels/gr_q8_parity.cpp` (+326 -0) </details> ### 📄 Description ## Problem and result The SYCL port's default hyper-connection read issues four launches per layer half (norm, sliced down projection, reduce, up projection), each small and latency-bound on an Arc Pro B70. `STRATA_GR_FUSED=1` does the norm, the down projection and its partial reduction in one kernel and the up projection in a second. Same BF16 weights, no extra VRAM, the default read's per-element arithmetic, another summation order. With the flag unset the default read runs unchanged. With `STRATA_HC_Q8=1` set the Q8_0 read runs and this flag changes nothing; this read is for setups that keep BF16 (exact weights wanted, or no VRAM for the Q8_0 copies). Result on 0.2.0-beta, two B70s, one stream: verify window 39.4 / 40.2 -> 37.9 / 38.2 ms (-4%), decode 70.6 / 73.7 -> 81.4 / 81.2 tok/s (most of the tok/s spread is a different draft acceptance of the changed output; the window time is the read's effect). Prompt reading unchanged. ## Related discussion Feature issue #2811 (closed in the 0.2.0 tracker reset). No maintainer agreement on scope yet. **Stacked on #2810** (`STRATA_HC_Q8=1`): this branch is that one plus one commit and reuses its argument struct, scratch and helpers, so #2810 goes first. The diff of this PR alone is the top commit. ## Approach - `sycl/src/kernels/cuda/fused_gr.dp.cpp`, `namespace gr_fused`: `gr_fused_down_kernel` (a work-group = 32 rows, 2 per lane, x a 1,280-column slab; stages `R' * w_norm` with the slab's sums of squares; the 16 sub-group partials added in a fixed order; the last work-group of a row group to arrive applies rs per stream and resets the counter) and `gr_fused_up_kernel` (16 columns x 4 streams per work-group, K in 4 quarters summed in a fixed order, then the default read's epilogue: pending write, gate, stream mean). The hook in `fused_gr_read_multi`, right after the Q8_0 one. Arguments not at the callers' fixed strides fall back to the default read with one stderr line. `fused_gr_set_fused(int)` for the parity test. - `sycl/include/strata/kernels/fused_gr_fused.hpp` (new), `sycl/src/kernels/gr_fused_parity.cpp` (new, in the `--selftest` loop), `docs/INTEL.md`. Not changed: `src/`, `include/`, the default SYCL read, the Q8_0 read of #2810 (a sibling namespace and one hook line after its hook). `STRATA_GR_*` follows the port's prefix for its read switches. ## 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 65536 --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 fresh 4K and 32K prompts. Coherence check and per-card health after every stop. **Passed:** - `gr_fused_parity --selftest` (0.2.0-beta + #2810 + this commit, head a703ff1e, one B70): `gr_fused_parity: pass (0 failing of 33 cases)` (T = 1..8 x pending write on/off x inject rows on/off; both reads against FP64 and each other within 1e-4, R_out bitwise, a captured graph replayed twice bitwise the direct call, the fixed-stride fallback bitwise the default read). - Engine A/B (decode tok/s, tokens per window, ms per window): | | prompt 1 | prompt 2 | 4K / 32K read tok/s | |---|---|---|---| | main e88ee39d | 70.6, 2.78, 39.4 ms | 73.9, 2.96, 40.0 ms | 1,219 / 2,078 | | this branch, flag unset | 70.6, 2.78, 39.4 ms | 73.7, 2.96, 40.2 ms | 1,220 / 2,080 | | `STRATA_GR_FUSED=1` | 81.4, 3.08, 37.9 ms | 81.2, 3.10, 38.2 ms | 1,229 / 2,102 | - Flag unset: output SHAs and draft counts identical to main. Flag set: coherent, text differs after a near-tie (another summation order). Coherence true and per-card health passed after every stop. **Failed:** none observed. **Not run:** kernel-level timings on 0.2.0 (unchanged code; on 0.1.x: T = 1 / 4 / 6 reads 38.7 -> 34.8, 50.8 -> 41.5, 62.0 -> 47.1 us), the 40K-context turn, two streams (`--batch-mtp` refused on a layer split), CUDA/HIP (not touched), `ctest` as a whole. ## Limits - Not bitwise the default read (lo / rs / mixed differ at FP32 rounding level, like the existing opt-in `STRATA_GR_V3`); greedy output changes after a near-tie. - 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#4276
No description provided.