Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

setup/docs: KV streaming for the SYCL engine from 64K - 256K context decodes at 31 tok/s (from 4-5)

maxfridbe21ccac1b013b
diff --git a/docs/INTEL.md b/docs/INTEL.md
index 6ddf2e17b..38973b4ba 100644
--- a/docs/INTEL.md
+++ b/docs/INTEL.md
@@ -300,8 +300,10 @@ repeated to length, 64 greedy tokens after it:
| 256K | int8 | 718 tok/s | 3.7 tok/s | 30.7 GB | 10,923 |
Every configuration completes and answers coherently; decode after the prompt is set by how many experts the KV
-leaves room for. At 128K use `--kv q4_0`. At 256K all three evict 470-1,400 experts; KV streaming
-(`--kv-resident`) is the next thing to try there. k8v4 works through the FP32 attention fallback; its dedicated
+leaves room for. **KV streaming fixes it** (`--kv-resident 32768`: the whole KV in pinned host memory, only the
+attended window in VRAM): every expert stays in VRAM and decode after the prompt is 38.7 tok/s at 128K int8
+(from 8.5), 35.3 at 128K q4_0, 31.3 at 256K int8 (from 3.7) and 31.5 at 256K q4_0 (from 5.0); the prompt pays
+5-13% (725-860 tok/s). setup.py turns it on from 64K up for the SYCL engine and keeps INT8. k8v4 works through the FP32 attention fallback; its dedicated
prompt kernel is the XMX one below.
**XMX prompt attention v2.** 64-cell chunks, vector-packed K^T and V, hi+lo Q in one accumulator per scale group,
@@ -349,6 +351,19 @@ of drafts accepted), 30-39 tok/s on a chat answer with prose (55-72%); sampling
nothing measurable. The engine used to abort at exit in serve mode (a queue wait in a destructor after the
runtime's teardown began); it now exits directly once its requests are done.
+**Planned (2026-09-30), in order.** Ranked by payoff on this card; the first three are in progress.
+
+1. Expert dot products on XMX in integer mode: a decode window (up to 6 tokens) fits one INT8 DPAS (1-8 rows), the
+ i-quant grids decode to small integers, the activations are already INT8. Today: scalar dp4a, ALU-bound (77%).
+2. Experts missing from VRAM read from pinned host memory over PCIe instead of the SSD (the 256K decode collapse).
+3. KV streaming (`--kv-resident`) from 64K up: only the attended window of the KV in VRAM. **Done**: 256K decodes at
+ 31 tok/s (from 4-5).
+4. QSA block selection on XMX: every query against every pooled block, a dense product that grows with the context.
+5. The hot decode kernels re-tuned for Xe2's native 16-wide sub-groups (twice the registers per thread).
+6. INT8 prompt GEMMs: experts dequantized to INT8, oneMKL/oneDNN INT8 on XMX (half the dequant bytes, 2x rate).
+7. Fewer graph nodes per decode round (~2,500 at ~5 us): norm+rope, scores+top-k, gate+quantize fused.
+8. Wider speculation (two draft branches per verify window): the kernels are latency-bound, so it is nearly free.
+
**Keeping up with upstream.** A merge of upstream `main` into `b70` leaves the copies in `sycl/` behind
wherever upstream touched a file they mirror. They are refreshed by re-migration, not by hand (done for
0.1.25-0.1.27, 2026-09-30):
diff --git a/setup.py b/setup.py
index ebd446888..194f797e4 100644
--- a/setup.py
+++ b/setup.py
@@ -2038,8 +2038,7 @@ def main() -> int:
ctx = 131072
ok(f"context: {ctx} tokens")
# the KV cache (the model's memory of the conversation): 8-bit, or 4-bit after a Hadamard rotation (PR #21)
- kv = "fp16" if ctx <= 8192 else (a.kv or ("q4_0" if backend == "sycl" and ctx > 65536 else "int8"))
- # (the B70 at 128K: only 4-bit KV leaves every expert in VRAM - decode 33 vs 8.5 tok/s with INT8, docs/INTEL.md)
+ kv = "fp16" if ctx <= 8192 else (a.kv or "int8")
if ctx > 8192 and not a.kv and not a.yes:
say()
say(" KV cache precision (the model's memory of the conversation):")
@@ -2253,10 +2252,13 @@ def main() -> int:
"--cvec-mode", "project", "--cvec-dir", "per-layer"]
if backend == "sycl":
# the container's paths, experts read from the GGUF (no host copy: every expert must fit VRAM, so the reserve
- # is the smallest that leaves the KV and the prompt buffers room - docs/INTEL.md), no KV streaming (untested)
- if "--kv-resident" in args:
- i = args.index("--kv-resident")
- del args[i:i + 2]
+ # is the smallest that leaves the KV and the prompt buffers room - docs/INTEL.md). KV streaming from 64K up
+ # keeps them all there: the B70 at 256K decodes at 31 tok/s with it, 4-5 without. Its RAM check above is the
+ # CUDA engine's (experts in RAM); here the experts are in VRAM, so only the KV copy and the engine count.
+ kv_ram = ctx * (13 * (576 if kv == "q4_0" else 1056)) / 1e9
+ if kv != "k8v4" and ctx >= 65536 and "--kv-resident" not in args and ram >= kv_ram + 6:
+ args += ["--kv-resident", "32768"]
+ ok(f"KV streaming on: the context's KV cache lives in RAM ({kv_ram:.1f} GB), every expert stays in VRAM")
for flag in ("--pack", "--native", "--ple-gguf", "--expert-profile", "--mtp"):
if flag in args:
args[args.index(flag) + 1] = sycl_path(args[args.index(flag) + 1])