Pull requests / #2812

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

open · @hotschmoe · 0 コメント · GitHub で見る

BenchmarksMulti-GPUAMD / HIPNVIDIA / CUDAModels & quantsDocumentation

本文

## Title
sycl: STRATA_GR_FUSED=1, the two-kernel BF16 hyper-connection read (opt-in)

Issue: Resolves #2811
Depends on #2810 (sycl: STRATA_HC_Q8=1 reads the Q8_0 hyper-connection projections) - this branch is that one
plus one commit and reuses its argument struct, scratch and helpers; merge that PR first.

## Summary

An opt-in hyper-connection read for the SYCL (Intel) build, `STRATA_GR_FUSED=1`: the norm, the down projection and
its partial reduction in one kernel, the up projection in a second, instead of the port's default four launches per
layer half (norm, sliced down, reduce, up). Same BF16 weights, no extra VRAM, the default read's per-element
arithmetic, another summation order. Default off: with the flag unset the default read runs unchanged (outputs and
draft counts identical to `main`, checked). It is the structure of the Q8_0 read of the PR it builds on, applied to
the BF16 weights, for the cases that keep BF16: an exact-weights read is wanted, or the Q8_0 copies' extra VRAM is
not. With `STRATA_HC_Q8=1` set the Q8_0 read runs and this flag changes nothing.

Not bitwise the default read (another summation order: lo / rs / mixed differ at FP32 rounding level, like upstream's
opt-in `STRATA_GR_V3`; greedy output changes after a near-tie). Bitwise: the default path; R_out (the pending write)
between the two reads; a captured graph's replays against the direct call; the fixed-stride fallback.

Measured, 2x Intel Arc Pro B70 32 GB (kernel 7.1, Compute Runtime 26.22.38646.4, oneAPI 2026.1, AOT bmg-g31),
upstream main 296b59d2 vs this branch with the flag, Qwen3.8-Flash-Next ISTA GSQ-RCO IQ3_XXS, `--layer-split 30
--prefill 8192 --kv int8 --spec 4 --mtp <BF16 draft layer> --mtp-max-t 4 --spec-min-p 0 --stream-experts
--expert-cache auto --max-context 65536`, one slot, greedy, a fixed prompt with a 512-token coding reply, 3 runs:

- verify window 39.4 / 39.5 / 39.7 -> 38.8 / 38.1 / 38.7 ms (-2.5%; independent of draft acceptance - the effect of
  the read);
- decode 81.8 / 79.5 / 78.7 -> 86.8 / 79.0 / 88.3 tok/s; the spread is mostly a different draft acceptance of the
  changed output (drafts accepted 360/462, 342/510, 362/456), so the per-window number is the one to read;
- a turn at a 40,796-token context 76.0 -> 79.4 tok/s (output differs); prompt reading unchanged (4K 993 -> 986 tok/s);
- kernel level (one card, graph replay, random weights not L2-resident, us per read, default -> two-kernel): T = 1
  38.7 -> 34.8 (-10%), T = 4 50.8 -> 41.5 (-18%), T = 6 62.0 -> 47.1 (-24%);
- `gr_fused_parity --selftest`: 33 of 33 cases pass. Coherence and per-card health after every run: pass.

## What changed

- `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 = half a stream; stages `R' * w_norm` unscaled for the T rows with the slab's
  sums of squares, each lane's 2 rows' BF16 chunks over its sub-group's 80 columns, the 16 sub-group partials added in
  a fixed order; the LAST work-group of a row group to arrive applies rs per stream, writes lo / the injection and rs,
  resets the counter), `gr_fused_up_kernel` (16 columns x 4 streams = 64 rows per work-group, K = 320 in 4 quarters
  over the sub-groups summed in a fixed order, then the default read's epilogue: pending write, gate, stream mean),
  the launchers, `on()` (the env, or `fused_gr_set_fused`'s override), `read()`. The hook in `fused_gr_read_multi`,
  right after the Q8_0 one: `if (gr_fused::on() && gr_fused::read(m, st)) return false;`. Arguments not at the
  callers' fixed strides fall back to the default read with one line on stderr. `fused_gr_set_fused(int)`: 1 / 0 /
  -1 (= the env), for the parity test.
- `sycl/include/strata/kernels/fused_gr_fused.hpp` (new, the port's include tree): declares `fused_gr_set_fused`.
- `sycl/src/kernels/gr_fused_parity.cpp` (new) + `sycl/CMakeLists.txt` (one name in the `--selftest` loop): real
  geometry, T = 1..8 x pending write on / off x inject rows on / off; both reads against an FP64 reference (within
  1e-4 of the largest value) and against each other (within 1e-4; the differences printed), R_out bitwise, a captured
  graph replayed twice bitwise the direct call, the fixed-stride fallback bitwise the default read.
- `docs/INTEL.md`: a section: what it does, what is and is not bitwise, the numbers, the shapes tried.

Not changed: anything under `src/` or `include/`; the default SYCL read (flag unset: the new code is never entered);
the Q8_0 read of the PR below it (this PR adds a sibling namespace and one hook line after its hook).

## Extra Notes

- The name: `STRATA_GR_*` is the port's prefix for its hyper-connection read switches (`STRATA_GR_DOWN_SLICED`,
  `STRATA_GR_NORM_SPLIT`, `STRATA_GR_UP_COLS`, ...).
- The down kernel's shape (rows per lane x columns per sub-group) at T = 6 in a development tree with the same
  kernels: (1, 80) 30.6, (2, 40) 26.9, (1, 40) 30.2, (2, 80) 23.6 us - (2, 80) is built. The kernel-level numbers above
  come from the same probe; everything else was measured on this branch against `main`.
- Built: the SYCL engine and `gr_fused_parity` (oneAPI 2026.1, AOT bmg-g31). CUDA and HIP are not touched.
- 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)

関連リンク

インストール・モデル・リリースへの站内リンク。