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++

sycl: the stream-all prompt walk by default when the VRAM holds >90% of the experts

maxfridbe63024cd848ca
diff --git a/docs/INTEL.md b/docs/INTEL.md
index c386055ed..38b331eed 100644
--- a/docs/INTEL.md
+++ b/docs/INTEL.md
@@ -559,6 +559,28 @@ page-locked batches of 64, and a batch's copies run while the next one is read.
(0.33 -> 1.34 GB/s); a whole Coder start from the engine's launch to its first token 82 s -> 26 s, the IQ2_XS
120 s -> 41 s (its 8.2 GB host mirror is ~9 s of the rest). Output identical. `STRATA_FILL_SERIAL=1` is the old fill.
+**The stream-all prompt walk is back (2026-10-03).** It copies every expert the VRAM cache does not hold, layer by
+layer ahead of the compute, instead of only the routed ones. It hung on the B70 until the stager and PLE fixes of
+2026-10-02 and runs since. It now runs by default when the VRAM holds more than 90% of the (layer, expert) pairs;
+past that it would copy several times the routed experts (the IQ2_XS keeps a quarter of them in the RAM mirror: a
+2,184-token prompt fell from ~560 to 254 tok/s with it). `STRATA_PREFILL_STREAM_ALL=1` / `=0` force it on or off.
+Coder, outputs identical either way:
+
+| prompt | routed-only | stream-all |
+|---|---|---|
+| 40K int8 | 1,106 tok/s | 1,160 |
+| 128K int8, KV streaming | 897 | 920 |
+| 128K k8v4 | 1,006 | 1,041 |
+| 256K int8, KV streaming | 760 | 780 |
+
+Measured alongside: the 2,184-token prompt reads 784-799 tok/s on both the 0.1.35+PR and the 0.1.38 build (three
+runs each), so the 825 seen once on 0.1.35 was session variance, not a regression. The prompt path at 40K (Coder,
+GPU timeline): expert dequant 15.7%, expert GEMMs 23.4%, host grouping 6.5%, gather 5.7%, combine 2.4%, prompt
+attention 19.2%, QSA select 6.8%, DeltaNet recurrence 5.8%, hyper-connection reads 4.6%. Upstream's sm_90 cluster
+kernels (greedy sampler, QSA top-k) would save next to nothing here: the sampler reads ~6 MB a round against a 13 ms
+token. Q4_0 tensor-core prompt attention (#452) is not worth porting: the port's XMX prompt attention is 2-3x slower
+than the plain kernel it uses for every KV format.
+
**The 0.1.38 merge (2026-10-03).** Upstream 0.1.35 -> 0.1.38 (83 commits) merged the seven PRs the port had taken
early, so their header forks in `sycl/include` are gone; the merge base for the 3-way merge was the port's own "main +
PRs" migration. New in the port with it: the DeltaNet output norm without its dead FP32 store, two prompt-path
diff --git a/sycl/src/prefill/prefill.cpp b/sycl/src/prefill/prefill.cpp
index 6059597f1..0c3882ea4 100644
--- a/sycl/src/prefill/prefill.cpp
+++ b/sycl/src/prefill/prefill.cpp
@@ -108,6 +108,8 @@ inline int64_t stream_all_min() {
return v;
}
double g_pinned_share = 1.0;
+// SYCL port: the share of (layer, expert) pairs the VRAM cache does not hold (set_nonresident_share, from generate.cpp)
+double g_nonres_share = 0.0;
// The streamed ring: 384 slots when (nearly) every streamed expert is DMA'd from pinned RAM - measured on Q2_0,
// 8192-token chunks: 96 slots 1153 tok/s, 384 1294 (the next layer's experts arrive during its attention half) -
// and 96 when a large share goes through host copies (IQ3_S on 64 GB, a third unpinned: 96 slots 1216, 256 1070 -
@@ -154,11 +156,16 @@ inline int ring_slots(size_t T) {
const int pinned_ring = fused_ring() ? 1024 : 384;
const int r = v ? std::atoi(v) : g_ring_override > 0 ? g_ring_override : (g_pinned_share >= 0.9 ? pinned_ring : 96);
if (v && r == STAGE) return STAGE; // Explicit opt-in to routed-only staging, including large chunks.
- // SYCL port: routed-only staging by default. The stream-all walk (every non-resident expert of every layer, copied
- // ahead across layers) hangs on the B70 in its first large chunk - the copy engine stops on a barrier (xe resets bcs
- // on kill) - with any ring size and either issuer, while the per-layer walk streams correctly (8,000 tokens with
- // 4,051 streamed experts, 2026-09-30). STRATA_PREFILL_STREAM_ALL=1 restores it for debugging.
- static const bool stream_all_ok = [] { const char* e = std::getenv("STRATA_PREFILL_STREAM_ALL"); return e && e[0] == '1'; }();
+ // SYCL port: the stream-all walk (every non-resident expert of every layer, copied ahead across layers) hung on the
+ // B70 in its first large chunk until 2026-10-02 - the stager's and the PLE upload's host waits on queue events,
+ // which the Level Zero v2 adapter did not survive (Stager::issued_one, ple_done_seq). It runs since, and reads a
+ // 40K prompt 4.8% faster than routed-only staging (1,159 vs 1,106 tok/s, same output): the default again.
+ // STRATA_PREFILL_STREAM_ALL=0 keeps routed-only staging, =1 forces the walk.
+ // It copies EVERY non-resident expert of a layer, routed or not: with a big host tier (the IQ2_XS: a quarter of the
+ // experts in the pinned mirror) that is several times the routed ones, and a 2,184-token prompt fell from ~570 to
+ // 254 tok/s. So by default only while the VRAM holds more than 90% of the pairs (the Coder, and its lent slots).
+ static const int stream_all_env = [] { const char* e = std::getenv("STRATA_PREFILL_STREAM_ALL"); return e ? (e[0] == '1' ? 1 : 0) : -1; }();
+ const bool stream_all_ok = stream_all_env == 1 || (stream_all_env == -1 && g_nonres_share < 0.10);
if (!stream_all_ok) return STAGE;
const int big = r < 16 ? 16 : r > ring_cap() ? ring_cap() : r;
return (int64_t) T >= stream_all_min() ? big : STAGE;
@@ -1408,6 +1415,7 @@ catch (sycl::exception const &exc) {
}
void Prefill::set_pinned_share(double share) { g_pinned_share = share; }
+void set_nonresident_share(double share) { g_nonres_share = share; } // SYCL port (see ring_slots)
void Prefill::set_ring_override(int slots) { g_ring_override = slots > 0 ? slots : 0; }
double Prefill::pinned_share() { return g_pinned_share; }
diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cpp
index acb6e6f48..d082ab67d 100644
--- a/sycl/src/program/generate.cpp
+++ b/sycl/src/program/generate.cpp
@@ -32,6 +32,7 @@
#include "strata/core/coupled_draft.hpp"
#include "strata/core/expert_source.hpp"
#include "strata/core/gguf_expert_source.hpp"
+namespace strata::prefill { void set_nonresident_share(double share); } // SYCL port: prefill.cpp
#include "strata/kernels/resident_plan_mirror.hpp"
#include "strata/core/pinned.hpp"
#include "strata/core/remote_experts.hpp"
@@ -4508,6 +4509,10 @@ int main(int argc, char **argv) try {
if (srcp->pinned(l, e)) pinned += b;
}
strata::prefill::Prefill::set_pinned_share(total ? (double) pinned / (double) total : 1.0);
+ // SYCL port: the pairs outside the VRAM cache decide the prompt path's stream-all walk (prefill.cpp ring_slots)
+ int64_t nonres = 0;
+ for (const int32_t r : host_res) nonres += r < 0;
+ strata::prefill::set_nonresident_share(host_res.empty() ? 1.0 : (double) nonres / (double) host_res.size());
}
auto lend_slots = [&](int64_t c) -> int64_t {
const uint64_t need = strata::prefill::Prefill::bytes_needed(g, ss, c);