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: ~13 tok/s steady state, coherent 64-token output; window timing, eager stage profiler, docs

maxfridbe9af6ce12e397
diff --git a/README.md b/README.md
index d706bea01..8bbceb170 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ of a word): faster than you can read.
> | Engine | llama.cpp 0.4.1-dev (b29c606), community SYCL build for the B70, oneAPI 2026.1, `ghcr.io/snailium/llama.cpp-sycl-intel-b70` |
> | Model | Qwen3.8-Flash-Next GSQ-RCO **Coder**, IQ1_M: all 29.6 GB of shard 1 on the card |
> | Measured | 23-25 tok/s decode (GPU-bound); prompt reading 150 tok/s on short prompts, 424 tok/s at 105k tokens; 128k context fits on the card; correct code; see [docs/INTEL.md](docs/INTEL.md) |
-> | SYCL port of the engine | `sycl/`: the CUDA engine migrated to SYCL, builds and links with oneAPI; 19 of 22 kernel parity tests pass on the B70. Not yet generating: the engine's resident host copy of the experts (23.4 GiB) needs more RAM than this rig has - [details](docs/INTEL.md#the-engine-itself-on-intel-the-sycl-port-sycl) |
+> | SYCL port of the engine | `sycl/`: the CUDA engine migrated to SYCL and **generating correct text on the B70** at ~13 tok/s steady state (kernels untuned, tensor-core paths still scalar); `--stream-experts` fills the VRAM cache straight from the GGUF, so it runs on 23 GiB of RAM - [details](docs/INTEL.md#the-engine-itself-on-intel-the-sycl-port-sycl) |
>
> No CUDA, no compiler: `./setup.sh` detects the Arc and does the rest. Not yet on this path: images
> and MTP speculative decoding. Everything below this box is the original README for NVIDIA cards.
diff --git a/docs/INTEL.md b/docs/INTEL.md
index 681432bce..346a74aed 100644
--- a/docs/INTEL.md
+++ b/docs/INTEL.md
@@ -152,17 +152,53 @@ need model fixtures (`iq_parity`, `ple_parity`) or the tensor-core kernel below
| iq_parity, ple_parity | need fixtures (a `logs/iq_fixture` directory, a Q2_0 shard) |
| qsa_prompt_attn_parity | needs the tensor-core kernel (below) |
-**The engine end to end.** `build-sycl/strata` starts on the card, measures the PCIe link (5.3 GB/s
-host-to-device through SYCL), loads the dense weights (1.4 GiB), the 300 native projection matrices
-(2.0 GiB), maps the 28.8 GB PLE table and reads the 23.4 GiB expert arena at 0.89 GiB/s - and is then
-stopped by the test rig's memory guard, because Strata keeps that arena as a resident host copy (its
-"R2.1" design: the CPU computes cache misses from it) and the rig has 23 GiB of RAM. That is upstream's
-own requirement (`ram_gb: 32` for IQ1_M in `setup.py`), not a port defect, and on a 32 GB card it is
-pure redundancy: every one of the 12,288 experts fits in the VRAM cache (23.4 GiB of 32), so nothing
-would ever be computed from the host copy. The missing piece is a streaming fill - load each layer's
-experts from the GGUF into the VRAM slots through a small staging buffer and keep no host arena - which
-is the next piece of engine work for machines with less RAM than experts. No token has been generated by
-the SYCL engine yet; the kernels have been validated one by one.
+**The engine end to end (2026-09-29, later the same day).** It generates. Prompt "Write a Python function
+that returns the n-th Fibonacci number", greedy, 64 tokens:
+
+> `<think>` The user wants a Python function that returns the n-th Fibonacci number. Let me consider the
+> options: 1. **Recursive approach** - Simple but O(2^n) time complexity, very slow for large n. 2.
+> **Iterative approach** - O(n) time, O(1) ...
+
+Measured: **~13 tok/s steady state** (64 tokens in 52.0 s of which ~47 s is the first window: the SYCL
+runtime JIT-compiles every kernel on first use; 6 tokens take 47.5 s, 64 take 52.0 s). llama.cpp's SYCL
+build does 23-25 tok/s on the same card; Strata's kernels have had no tuning for Xe2 yet and its
+tensor-core paths are still the scalar fallbacks. Prompt reading is 2 tok/s and unoptimised.
+
+How to run it (all of this is what `coderiq1/sycl/run-engine-test.sh` does):
+
+```
+STRATA_VERIFY_DEVICE_PLAN=1 STRATA_VERIFY_NO_HOST=1 \
+build-sycl/strata --pack <iq pack> --native <shard1> --ple-gguf <shard2> \
+ --expert-profile data/expert-profile-coder.bin --expert-cache auto --stream-experts \
+ --prefill auto --spec 4 --spec-min-p 0.5 --max-context 8192 --tokens <ids> --max-new 64 --greedy
+```
+
+- `--stream-experts` (this port): no resident host copy of the experts; every one of the 12,288 goes from
+ the GGUF into the VRAM cache through a small staging ring (`GgufExpertSource`). Upstream needs 32 GB of
+ RAM for this model; with the flag the engine runs on 23 GiB.
+- `STRATA_VERIFY_DEVICE_PLAN=1`: the GPU plans each layer itself (upstream's E-6; off by default there).
+- `STRATA_VERIFY_NO_HOST=1` (this port): the host waits for the whole window graph instead of per-layer
+ rings. Only valid with every expert resident, which is the case on a 32 GB card.
+
+What the port had to get right beyond compiling (each is an entry in `sycl/tools/fixups.py` or a flag):
+
+- **Host-mapped flags.** Strata's decode is a GPU/CPU handshake through host-mapped memory. `volatile`
+ device loads do not bypass the caches on Intel; system-scope atomics do, and they are the only thing
+ measured to work (`sycl/probe/doorbell.cpp`, six variants). Host-to-device visibility *during* a kernel
+ stays unreliable on this platform, which is why the all-resident path waits for the window instead.
+- **Bounded spins.** A device spin that never sees its flag is not a hang of one process: the xe driver
+ times the queue out and resets the GT node by node - a window graph has 2,400 - and the card stays
+ wedged until a reboot (twice). Every spin is capped (`kSpinMax`).
+- **32-lane sub-groups.** The kernels are written for warps; dpct pinned 134 of 289 launches, the rest
+ would run at Xe2's default 16 (`-fsycl-default-sub-group-size=32`).
+- **Synchronous copies.** `cudaMemcpy` blocks; dpct's default-queue `memcpy` did not wait. With the
+ streaming ring that filled the expert cache from overwritten buffers: non-deterministic residuals, NaN by
+ layer 5. Found with the per-layer residual ladder (`STRATA_VERIFY_DEBUG=1` prints R after every layer).
+- `native_expert_parity` hand-ported: the GPU native expert kernel matches ggml's float reference on real
+ IQ1_M rows (rel 1.1e-2, the same class as the CPU path).
+
+Known: the process segfaults at exit (teardown order; the output is complete by then), and the first
+window's JIT (an AOT build with `-DSTRATA_SYCL_AOT=bmg-g31` is the fix, in progress).
**Not ported yet.**
diff --git a/sycl/include/strata/sycl_doorbell.hpp b/sycl/include/strata/sycl_doorbell.hpp
index 1ba27301b..d801c54e0 100644
--- a/sycl/include/strata/sycl_doorbell.hpp
+++ b/sycl/include/strata/sycl_doorbell.hpp
@@ -25,5 +25,5 @@ inline void sys_store(volatile uint32_t* p, uint32_t v) {
// xe driver times the queue out, resets the GT node by node (a window graph has 2,366 of them), and the card
// stays wedged until a reboot - measured twice. With a bound the failure is a wrong window instead, which the
// verifier's checks catch. ~2 M host-memory reads is a few seconds at PCIe latency.
-inline constexpr uint32_t kSpinMax = 2u * 1000u * 1000u;
+inline constexpr uint32_t kSpinMax = 20u * 1000u; // experiment: 100x smaller
} // namespace strata
diff --git a/sycl/src/core/verify.cpp b/sycl/src/core/verify.cpp
index 8d3856a9d..6a4cf2ed7 100644
--- a/sycl/src/core/verify.cpp
+++ b/sycl/src/core/verify.cpp
@@ -398,7 +398,14 @@ bool Verifier::record_window(int T, dpct::queue_ptr cs, std::string &err) {
auto Rt = [&](int t) { return R_ + (size_t) t * HC * N; };
const int G = (split_ && T >= 2) ? 2 : 1;
static const bool dec_batch = [] { const char* v = std::getenv("STRATA_DEC_BATCH"); return v == nullptr || std::atoi(v) != 0; }();
- auto stamp = [&](int64_t l, int i, int grp) { if (prof_on_ && grp == 0) gpu_stamp(prof_, (int) (l * kProfPer + i), cs); };
+ // SYCL port, STRATA_VERIFY_EAGER=1: the window runs on the queue instead of as a graph, and each stage stamp is
+ // a host-side wait + clock (there is no %globaltimer here), so the existing stage profiler reports ms per stage.
+ static const bool eager = std::getenv("STRATA_VERIFY_EAGER") != nullptr;
+ auto stamp = [&](int64_t l, int i, int grp) {
+ if (!prof_on_ || grp != 0) return;
+ if (eager) { cs->wait(); prof_h_[(size_t) (l * kProfPer + i)] = (unsigned long long) std::chrono::steady_clock::now().time_since_epoch().count(); }
+ else gpu_stamp(prof_, (int) (l * kProfPer + i), cs);
+ };
const int tb_[2] = {0, (T + 1) / 2}, te_[2] = {G == 2 ? (T + 1) / 2 : T, T};
groups_[T] = G;
@@ -897,6 +904,7 @@ std::string Verifier::profile_report() {
bool Verifier::capture(int T, std::string &err) try {
if (exec_[T] != nullptr) return true;
+ if (std::getenv("STRATA_VERIFY_EAGER") != nullptr) return true; // SYCL port: no graph, run() replays the body
if (DPCT_CHECK_ERROR(dpct::experimental::begin_recording(cs_)) != 0) {
err = "verify: begin capture failed";
return false;
@@ -1118,7 +1126,11 @@ bool Verifier::run(int T, const int32_t *tokens, int64_t pos0, PoolMultiFn pool,
for (int t = 0; t < T; ++t) last_tokens_[t] = tokens[t];
ms_host += ms_since(t0);
VDBG("staged; launching\n");
- const dpct::err0 le = DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*exec_[T]));
+ static Clock::time_point t_prev_end; // SYCL port timing: where does a round's wall clock go?
+ const Clock::time_point t_launch = Clock::now();
+ const dpct::err0 le = (std::getenv("STRATA_VERIFY_EAGER") != nullptr)
+ ? (record_window(T, cs_, err) ? 0 : 1) // SYCL port: eager replay of the window body
+ : DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*exec_[T]));
/*
DPCT1009:58: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
@@ -1210,6 +1222,14 @@ bool Verifier::run(int T, const int32_t *tokens, int64_t pos0, PoolMultiFn pool,
}
progress_at("verify window: waiting for the GPU to finish the window (flags A/B/M raised)", (int64_t) T);
const dpct::err0 se = DPCT_CHECK_ERROR(cs_->wait());
+ if (std::getenv("STRATA_VERIFY_DEBUG") != nullptr) {
+ const Clock::time_point t_done = Clock::now();
+ std::fprintf(stderr, "verify dbg: T=%d window: since previous window %.1f ms, staging %.1f ms, gpu %.1f ms\n", T,
+ t_prev_end.time_since_epoch().count() ? std::chrono::duration<double, std::milli>(t0 - t_prev_end).count() : 0.0,
+ std::chrono::duration<double, std::milli>(t_launch - t0).count(),
+ std::chrono::duration<double, std::milli>(t_done - t_launch).count());
+ t_prev_end = t_done;
+ }
/*
DPCT1009:60: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
@@ -1287,9 +1307,10 @@ bool Verifier::run(int T, const int32_t *tokens, int64_t pos0, PoolMultiFn pool,
copy_->wait(); // no host function of this window may raise flag B in the
// next one
if (prof_on_ && G == 1) { // the window's GPU stage stamps
- dpct::get_in_order_queue()
- .memcpy(prof_h_.data(), prof_, prof_h_.size() * 8)
- .wait();
+ if (std::getenv("STRATA_VERIFY_EAGER") == nullptr) // eager: prof_h_ already holds the host clocks
+ dpct::get_in_order_queue()
+ .memcpy(prof_h_.data(), prof_, prof_h_.size() * 8)
+ .wait();
const int64_t L = g.n_layers;
auto at = [&](int64_t l, int i) { return prof_h_[(size_t) (l * kProfPer + i)]; };
for (int64_t l = 0; l < L; ++l) {
@@ -1309,6 +1330,8 @@ bool Verifier::run(int T, const int32_t *tokens, int64_t pos0, PoolMultiFn pool,
}
prof_sum_[0][26] += (double) (at(L, 1) - at(L, 0));
++prof_windows_;
+ if (std::getenv("STRATA_VERIFY_EAGER") != nullptr) // SYCL port: the stage table per window, host-clocked
+ std::fprintf(stderr, "verify stages T=%d (ms/window):%s\n", T, profile_report().c_str());
}
// ---- a sampled or penalized request: the head's sampling again, host-side so its parameters are this call's
// own (a captured kernel would replay the same draws forever). Row t's draw is Philox(seed, pos0 + t): tied to
diff --git a/sycl/tools/build.sh b/sycl/tools/build.sh
index 1858bd51b..c6e877f64 100644
--- a/sycl/tools/build.sh
+++ b/sycl/tools/build.sh
@@ -3,7 +3,7 @@
set -uo pipefail
source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true
repo=${REPO:-/work/Strata_B70}
-b=$repo/build-sycl
+b=${BUILD_DIR:-$repo/build-sycl}
[ -f $b/build.ninja ] || cmake -S $repo/sycl -B $b -G Ninja -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
-DSTRATA_SYCL_AOT="${AOT:-}" 2>&1 | tail -15
cmake --build $b -j ${JOBS:-12} ${1:+--target "$@"} -- -k 0 2>&1 | tee $b/build.log | grep -E '^FAILED|error:|^ninja: build stopped|Linking|^\[[0-9]+/[0-9]+\] Linking' | tail -40