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 sampler's top_p/temperature tail accumulates in float (FP64 is emulated on Arc Alchemist); B70 IQ3_S findings in docs/INTEL.md
Niko12213838a40a0c79
diff --git a/docs/INTEL.md b/docs/INTEL.mdindex 38b331eed..edafe0ec8 100644--- a/docs/INTEL.md+++ b/docs/INTEL.md@@ -631,6 +631,71 @@ test an SM-holding NVIDIA bench (not built). Outputs identical to 0.1.33 (Coder- Speculative decoding on the llama.cpp path (the GGUF carries no draft layer llama.cpp can use). The SYCLport has it (MTP draft layer, `--mtp`).+## Arc Pro B70 with a model that does not fit: Flash-Next IQ3_S (2026-10-07, branch f-141-intel)++The earlier B70 rows are for models whose experts all fit in VRAM. IQ3_S has 24,576 experts of 1.97 MB (46 GB): the 32 GB+card holds 11.5k of them (22 GiB of cache) and the rest sit in a pinned host mirror that the GPU reads over PCIe. Tested on+the B70 VM (xe driver, kernel 7.0, oneAPI 2026.1, PCIe measured at 13.3 GB/s host to device), engine 0.1.40-sycl.++**Two things made it produce garbage, both fixed or documented here.**++- **Aliased pages in big allocations (fixed in the engine).** The xe driver returned the 22 GiB expert-cache arena with two+ of its 2 MiB pages mapped onto the same memory: a write at +2 MiB showed at +1022 MiB. Cache slots there held other+ experts' bytes, and the prompt came out NaN at the first layer that routed to one (layer 4, expert 249); the same run+ with another `--max-context`, or with an MTP window of 4 instead of 6, was clean. `STRATA_VERIFY_ALL_SLOTS=1`+ (`STRATA_VERIFY_FIND=1`, `STRATA_VERIFY_DUMP=dir`) reads every filled slot back and compares it with the GGUF; that is how+ the aliasing was found (the wrong bytes were slot 0's blob). Every allocation of 32 MiB or more now goes through+ `strata::malloc_device_guarded`: it tags every 64 KiB, reads the tags back in a second kernel, and allocates again behind a+ growing spacer until the range is clean (a warning names each retry; the check costs under 0.5 s at startup;+ `STRATA_ARENA_ALIAS_CHECK=0` skips it). `sycl/probe/arena_rw.cpp` and `alias_scan.cpp` do not reproduce it on their own: it+ needs the engine's allocation history.+- **`STRATA_VERIFY_NO_HOST=1` is required whenever part of the experts is not in VRAM.** `sycl/serve/strata-sycl.sh` sets+ it; a by-hand run must too. Without it the per-layer host/GPU handshake is not visible across the bus on xe and the logits+ turn NaN a few tokens into the answer, differently on every run. With it (and the mirror covering every miss) the run is+ deterministic: two runs gave identical tokens.++**Numbers** (greedy, `--spec 4 --spec-min-p 0.5 --mtp`, INT8 KV, 32K context, `--stream-experts --vram-reserve-mib 1024+--ple-io ram`, 11.5k experts resident; the 10-prompt `mg_norepeat` gate passes 10 of 10, the xe error counters did not move):++| | before | after |+|---|---|---|+| 4,095-token prompt, `--prefill auto` (2,048-token chunks) | 618 tok/s | 730 |+| 4,095-token prompt, `--prefill 4096` | 784 | **980-1,002** |+| 8,169-token prompt: auto / 4096 / 8192 lending cache slots / 8192 own buffers | 676 | 953 / 1,037 / 1,117 (9.4k slots) |+| decode, 200-token story (66% of drafts accepted, 1.98 tokens per round) | 31.4 tok/s | 30.5 with 4096-token chunks (700 fewer cache slots) |+| decode, 200-token code answer (90% accepted, 3.65 tokens per round) | not measured | 40.8 with 4096-token chunks |++(Interleaved A/B pairs, medians of 3-5. "Before" is the same build with the old short first chunk; the decode figures are+the old default and `--prefill 4096`.)++**Why the prompt is slow here, and the two changes.** Every prompt chunk streams the experts the cache does not hold over+PCIe, and a 4K prompt touches nearly all 512 experts of every layer: 13.5k missing experts x 1.97 MB = 26 GB, 2 s of the+bus per chunk. So the prompt reads faster in fewer, bigger chunks, and the short first chunk (`STRATA_PREFILL_FIRST`, 256+tokens, there to start the GPU while the PLE rows are read) cost a whole extra pass of that stream. It is now 256 only when+the cache holds every expert, else 0. `setup_intel.py` writes `--prefill 4096` for a card with 24 GB or more (the chunk's+buffers take ~700 cache slots; `--prefill 8192 --prefill-borrow` lends cache slots instead and keeps all of them for decode,+at ~1 s of refill per prompt). Where the 4K prompt's GPU time goes now (GPU timeline, timing on): expert dequant 20%, the two+expert GEMMs 34%, QSA attention 14%, host grouping 6.5%, GDN 9%, hyper-connection reads 4.6%.++**Draft length** (200 tokens, medians of 5 interleaved pairs, `--spec-min-p 0.5`): `--spec 6` against `--spec 4` is +6.5% on+code (43.4 against 40.8 tok/s, 84% accepted against 90%) and -1.5% on prose (29.9 against 30.4). A 2-run sweep of the rest+(`--spec 2/3/5`, min-p 0.3/0.7) was within the run-to-run noise of ~1 tok/s; the setup default (4, 0.5) stays.++**FP64.** Arc Alchemist emulates it (`IGC_EnableDPEmulation=1`); on the A750 one row of the sampler's top_p/temperature tail+costs 451 us in double and 20 us in float (`sycl/probe/fp64_cost.cpp`), and a sampled decode ran at 7.6 tok/s against 12 for+a greedy one. On the B70 the same kernels cost 3.4 against 2.1 us, so FP64 is not a B70 problem. Of the kernels that use+double, the native-pack path (the packs setup builds) runs only the sampler (a 16-token greedy run created 173 kernels, the+double ones among them: `sample_tokens` only; the native router, combine, gate and norm kernels are float). The sampler's tail+now accumulates in `strata::samp_acc_t`, float by default (`-DSTRATA_SYCL_SAMPLER_FP64=1` keeps double): A750 sampled decode+7.62 -> 8.10 tok/s (medians of 5 interleaved pairs, runs 7.1-9.2), `sampler_parity` 0 failures on both cards, and the B70 gate's+sampled cases picked the same tokens.++**XMX.** oneMKL's FP16 GEMMs already run on the matrix engines; per expert the dequant (42 us for a gate/up matrix) costs+twice the GEMM (20 us), and the fused dequant+XMX kernel (`xmx_gemm_bench`) is 0.22x of the pair on this card. The speed left+on this card for this model is the dequant kernels (at ~200 GB/s against a 600 GB/s card), the host grouping, and the QSA+prompt attention (14%); the multi-column int8 DPAS decode kernels of llama.cpp PR 29864 target K-quant and Q8_0 weights, not+the IQ-quant experts, and were not ported.+## Measured, 2026-10-01, Arc Pro B70, Coder IQ1_M, 32K context, INT8 KV: the SYCL port (engine 0.1.31-sycl)| | |diff --git a/docs/INTEL_ARC.md b/docs/INTEL_ARC.mdindex 2f65b3bde..462bb5c48 100644--- a/docs/INTEL_ARC.md+++ b/docs/INTEL_ARC.md@@ -22,6 +22,7 @@ There is **no ready-made Intel engine** in the release zips. You build it from s| Community | 2x Arc Pro B60 24 GB, `--layer-split` | Coder IQ1_M: 56.6 tok/s decode, 428 tok/s prompt (2,129 tokens); Flash-Next IQ2_XS: 58.6-61.3 tok/s decode, 436 tok/s prompt; all experts in VRAM; 8K context | [bench/results/2026-10-04-community-2x-arc-pro-b60](../bench/results/2026-10-04-community-2x-arc-pro-b60/README.md) || Community | one Arc Pro B60 24 GB | Coder IQ1_M with 4,042 of 12,288 experts mirrored in RAM: 11.9 tok/s decode (needs the ring-wait fix from the same report) | same || Strata maintainers | no Arc | compile check and kernel tests on a CPU device only (below) | this release |+| Strata maintainers (0.1.41 work) | Arc Pro B70 32 GB (xe) and Arc A750 8 GB (i915), test machines | Flash-Next IQ3_S on the B70 with 11.5k of 24.6k experts resident: 10-prompt gate passes, prompt 980-1,000 tok/s on 4K tokens, decode 30 (prose) to 41 (code) tok/s; the xe aliased-pages fix and the `NO_HOST` requirement are in [INTEL.md](INTEL.md) | INTEL.md, "Arc Pro B70 with a model that does not fit" |The 0.1.39 port re-migrates 0.1.38's port onto the 0.1.39 engine sources (the #606 NaN fix, the #649 verifytrace, the new prompt paths). 0.1.39's `sycl/` did not compile against 0.1.39's own engine sources (#784: thediff --git a/sycl/include/strata/sycl_math.hpp b/sycl/include/strata/sycl_math.hppindex 58ccd2cae..38e4170d5 100644--- a/sycl/include/strata/sycl_math.hpp+++ b/sycl/include/strata/sycl_math.hpp@@ -13,3 +13,15 @@ inline int32_t dp4a(A a, B b, C c) {return dpct::dp4a((int32_t) a, (int32_t) b, (int32_t) c);}} // namespace strata++namespace strata {+// The accumulator of the sampler's top_p / temperature tail (exp, sum, cumulative scan over the <= 64 kept logits). FP64 is+// emulated on an Arc Alchemist (an A750: the tail of one row costs ~450 us against 20 us in float, which made sampled+// decode ~40% slower than greedy) and is not hardware on any Arc. Float is the default; -DSTRATA_SYCL_SAMPLER_FP64=1+// keeps the reference's double.+#if defined(STRATA_SYCL_SAMPLER_FP64) && STRATA_SYCL_SAMPLER_FP64+using samp_acc_t = double;+#else+using samp_acc_t = float;+#endif+} // namespace stratadiff --git a/sycl/probe/fp64_cost.cpp b/sycl/probe/fp64_cost.cppnew file mode 100644index 000000000..96f43fe5f--- /dev/null+++ b/sycl/probe/fp64_cost.cpp@@ -0,0 +1,105 @@+// fp64_cost: what does FP64 (emulated on Arc Alchemist and Battlemage) cost in the engine's small reduction kernels?+// Same one-warp-per-row sum of squares + 1/sqrt as gdn_l2_norm / gdn_out_norm / the PLE rms norm, once with a double+// accumulator (the engine today) and once in float, plus a silu over n values the way silu_inplace does it.+// fp64_cost [launches=4000] (the A750 needs IGC_EnableDPEmulation=1 OverrideDefaultFP64Settings=1 for the double kernels)+#include <sycl/sycl.hpp>+#include <chrono>+#include <cmath>+#include <cstdio>+#include <cstdlib>+#include <vector>++template <class F>+static double us_per_launch(sycl::queue& q, int n, F&& f) {+ for (int i = 0; i < 50; ++i) f();+ q.wait();+ const auto t0 = std::chrono::steady_clock::now();+ for (int i = 0; i < n; ++i) f();+ q.wait();+ return std::chrono::duration<double, std::micro>(std::chrono::steady_clock::now() - t0).count() / n;+}++template <class Acc>+static void l2norm(sycl::queue& q, float* x, int rows, int cols, float eps) {+ q.parallel_for(sycl::nd_range<1>(rows * 32, 32), [=](sycl::nd_item<1> it) [[sycl::reqd_sub_group_size(32)]] {+ const int row = it.get_group(0);+ float* p = x + (size_t) row * cols;+ auto sg = it.get_sub_group();+ Acc acc = 0;+ for (int i = it.get_local_id(0); i < cols; i += 32) acc += (Acc) p[i] * (Acc) p[i];+ for (int off = 16; off > 0; off >>= 1) acc += sycl::shift_group_left(sg, acc, off);+ acc = sycl::group_broadcast(sg, acc, 0);+ const float inv = (float) ((Acc) 1 / sycl::sqrt(acc + (Acc) eps));+ for (int i = it.get_local_id(0); i < cols; i += 32) p[i] *= inv;+ });+}++template <class Acc>+static void silu(sycl::queue& q, float* x, int n) {+ q.parallel_for(sycl::nd_range<1>((n + 255) / 256 * 256, 256), [=](sycl::nd_item<1> it) {+ const int i = it.get_global_id(0);+ if (i >= n) return;+ const Acc v = (Acc) x[i];+ x[i] = (float) (v / ((Acc) 1 + sycl::exp(-v)));+ });+}+++// the sampler's tail: top_p cut and temperature draw over k kept logits, one warp (like sampled_tail_warp), 3 exps per element+template <class Acc>+static void sampler_tail(sycl::queue& q, const float* sel, int* out, int k, float top_p, float u) {+ q.parallel_for(sycl::nd_range<1>(32, 32), [=](sycl::nd_item<1> it) [[sycl::reqd_sub_group_size(32)]] {+ const int lane = it.get_local_id(0);+ Acc sum = 0;+ float mx = sel[0];+ for (int i = lane; i < k; i += 32) sum += sycl::exp((Acc) sel[i] - (Acc) mx);+ sum = sycl::reduce_over_group(it.get_sub_group(), sum, sycl::plus<Acc>());+ Acc cum = 0;+ int cut = k;+ if (lane == 0) {+ for (int i = 0; i < k; ++i) { cum += sycl::exp((Acc) sel[i] - (Acc) mx) / sum; if (cum >= (Acc) top_p) { cut = i + 1; break; } }+ Acc c2 = 0; int pick = cut - 1;+ for (int i = 0; i < cut; ++i) { c2 += sycl::exp((Acc) sel[i] - (Acc) mx) / sum; if ((Acc) u < c2) { pick = i; break; } }+ out[0] = pick;+ }+ });+}++int main(int argc, char** argv) {+ const int n = argc > 1 ? std::atoi(argv[1]) : 4000;+ sycl::queue q{sycl::gpu_selector_v, sycl::property::queue::in_order{}};+ std::printf("device %s, fp64 %s\n", q.get_device().get_info<sycl::info::device::name>().c_str(),+ q.get_device().has(sycl::aspect::fp64) ? "yes" : "NO (double kernels skipped)");+ const bool fp64 = q.get_device().has(sycl::aspect::fp64);+ float* x = sycl::malloc_device<float>(1 << 20, q);+ q.fill(x, 0.5f, 1 << 20).wait();+ struct Shape { const char* what; int rows, cols; };+ const Shape shapes[] = {{"gdn l2 norm (rows 48, cols 128)", 48, 128}, {"gdn out norm (rows 48, cols 128)", 48, 128},+ {"ple rms (rows 8, cols 2560)", 8, 2560}, {"wide (rows 6, cols 2560)", 6, 2560}};+ for (const Shape& s : shapes) {+ const double f = us_per_launch(q, n, [&] { l2norm<float>(q, x, s.rows, s.cols, 1e-6f); });+ double d = -1;+ if (fp64) d = us_per_launch(q, n, [&] { l2norm<double>(q, x, s.rows, s.cols, 1e-6f); });+ std::printf("%-34s float %6.2f us double %6.2f us\n", s.what, f, d);+ }+ for (int cnt : {2560, 10240, 61440}) {+ const double f = us_per_launch(q, n, [&] { silu<float>(q, x, cnt); });+ double d = -1;+ if (fp64) d = us_per_launch(q, n, [&] { silu<double>(q, x, cnt); });+ std::printf("silu over %-24d float %6.2f us double %6.2f us\n", cnt, f, d);+ }+ {+ float* sel = sycl::malloc_device<float>(64, q);+ int* o = sycl::malloc_device<int>(1, q);+ std::vector<float> h(64);+ for (int i = 0; i < 64; ++i) h[i] = 10.f - 0.3f * i;+ q.memcpy(sel, h.data(), 64 * 4).wait();+ for (int k : {20, 64}) {+ const double f = us_per_launch(q, n, [&] { sampler_tail<float>(q, sel, o, k, 0.95f, 0.5f); });+ double d = -1;+ if (fp64) d = us_per_launch(q, n, [&] { sampler_tail<double>(q, sel, o, k, 0.95f, 0.5f); });+ std::printf("sampler tail, k=%-21d float %6.2f us double %6.2f us\n", k, f, d);+ }+ }+ return 0;+}diff --git a/sycl/probe/gemm_launch.cpp b/sycl/probe/gemm_launch.cppindex 88af0dceb..4879b30d8 100644--- a/sycl/probe/gemm_launch.cpp+++ b/sycl/probe/gemm_launch.cpp@@ -4,6 +4,8 @@// gemm_launch [calls=2000]#include <sycl/sycl.hpp>#include <oneapi/mkl.hpp>+#include <dpct/dpct.hpp>+#include <dpct/blas_utils.hpp>#include <chrono>#include <cstdio>#include <cstdlib>@@ -36,8 +38,22 @@ int main(int argc, char** argv) {const auto t0 = std::chrono::steady_clock::now();run(calls);const double us = std::chrono::duration<double, std::micro>(std::chrono::steady_clock::now() - t0).count() / calls;- const double gflop = 2.0 * (double) s.n * (double) T * (double) s.k * 1e-9;- std::printf("%-20s T=%5lld: %7.1f us/call (%6.1f TFLOP/s)\n", s.name, (long long) T, us, gflop / us * 1e-3 * 1e3 / 1e3);+ auto* h = new dpct::blas::descriptor();+ h->set_queue(&q);+ const float alpha = 1.0f, beta = 0.0f;+ auto run2 = [&](int cnt) {+ for (int i = 0; i < cnt; ++i)+ dpct::blas::gemm(h, oneapi::mkl::transpose::trans, oneapi::mkl::transpose::nontrans, (int) s.n, (int) T, (int) s.k, &alpha, W,+ dpct::library_data_t::real_half, (int) s.k, X, dpct::library_data_t::real_half, (int) s.k, &beta, Y,+ dpct::library_data_t::real_float, (int) s.n, dpct::compute_type::f32);+ q.wait();+ };+ run2(50);+ const auto t1 = std::chrono::steady_clock::now();+ run2(calls);+ const double us2 = std::chrono::duration<double, std::micro>(std::chrono::steady_clock::now() - t1).count() / calls;+ delete h;+ std::printf("%-20s T=%5lld: mkl %7.1f us/call dpct::blas::gemm %7.1f us/call\n", s.name, (long long) T, us, us2);}}return 0;diff --git a/sycl/probe/gemm_vary.cpp b/sycl/probe/gemm_vary.cppnew file mode 100644index 000000000..ab647a76b--- /dev/null+++ b/sycl/probe/gemm_vary.cpp@@ -0,0 +1,47 @@+// gemm_vary: the expert GEMMs of a prompt see a different row count every call. Does oneMKL pay per distinct M (kernel+// generation / lookup), and how much do rows that are not a multiple of 8, 16 or 32 cost?+// gemm_vary [calls=3000]+#include <sycl/sycl.hpp>+#include <oneapi/mkl.hpp>+#include <chrono>+#include <cstdio>+#include <cstdlib>+#include <random>+#include <vector>++int main(int argc, char** argv) {+ const int calls = argc > 1 ? std::atoi(argv[1]) : 3000;+ sycl::queue q{sycl::gpu_selector_v, sycl::property::queue::in_order{}};+ using half = sycl::half;+ const int64_t N = 2560, maxT = 1536;+ half* X = sycl::malloc_device<half>(maxT * N, q);+ half* W = sycl::malloc_device<half>(N * 1280, q);+ float* Y = sycl::malloc_device<float>(maxT * N, q);+ q.memset(X, 0, maxT * N * 2); q.memset(W, 0, N * 1280 * 2); q.wait();+ struct Shape { const char* name; int64_t n, k; };+ const Shape shapes[] = {{"gate/up", 1280, N}, {"down", N, 640}};+ std::mt19937 rng(7);+ std::vector<int> ts(calls);+ // skewed like a prompt's per-expert row counts: many small, a few large+ for (int& t : ts) { const double u = std::generate_canonical<double, 20>(rng); t = 1 + (int) (400.0 * u * u * u * u * 3.8); if (t > 1500) t = 1500; }+ double mean_t = 0; for (int t : ts) mean_t += t; mean_t /= calls;+ std::printf("rows per call: mean %.0f\n", mean_t);+ for (const Shape& s : shapes) {+ auto pass = [&](bool round8) {+ const auto t0 = std::chrono::steady_clock::now();+ for (int i = 0; i < calls; ++i) {+ int64_t T = ts[i];+ if (round8) T = (T + 15) / 16 * 16;+ oneapi::mkl::blas::column_major::gemm(q, oneapi::mkl::transpose::trans, oneapi::mkl::transpose::nontrans, s.n, T, s.k, 1.0f, W, s.k, X, s.k,+ 0.0f, Y, s.n);+ }+ q.wait();+ return std::chrono::duration<double, std::micro>(std::chrono::steady_clock::now() - t0).count() / calls;+ };+ const double first = pass(false);+ const double second = pass(false);+ const double rounded = pass(true);+ std::printf("%-8s first pass %7.1f us/call, second %7.1f, rows rounded up to 16: %7.1f\n", s.name, first, second, rounded);+ }+ return 0;+}diff --git a/sycl/src/kernels/cuda/sampler.dp.cpp b/sycl/src/kernels/cuda/sampler.dp.cppindex 6c86dfae8..e9206fdb4 100644--- a/sycl/src/kernels/cuda/sampler.dp.cpp+++ b/sycl/src/kernels/cuda/sampler.dp.cpp@@ -23,6 +23,7 @@#include <sycl/sycl.hpp>#include <dpct/dpct.hpp>#include "strata/sycl_queue.hpp"+#include "strata/sycl_math.hpp"#include "strata/kernels/sampler.hpp"#include "strata/core/coupled_draft.hpp"#include "strata/core/emulate.hpp"@@ -583,16 +584,16 @@ __dpct_inline__ void sampler_kernel(const float *__restrict__ logits,#pragma unrollfor (int i = 1; i < k; ++i) mx = sycl::fmax(mx, sel_logit[i]);if (p.top_p < 1.0f) {- double sum = 0.0;+ strata::samp_acc_t sum = 0.0;#pragma unrollfor (int i = 0; i < k; ++i) sum +=- sycl::exp((double)sel_logit[i] - (double)mx);- double cum = 0.0;+ sycl::exp((strata::samp_acc_t)sel_logit[i] - (strata::samp_acc_t)mx);+ strata::samp_acc_t cum = 0.0;int cut = k;#pragma unrollfor (int i = 0; i < k; ++i) {- cum += sycl::exp((double)sel_logit[i] - (double)mx) / sum;- if (cum >= (double) p.top_p) { cut = i + 1; break; }+ cum += sycl::exp((strata::samp_acc_t)sel_logit[i] - (strata::samp_acc_t)mx) / sum;+ if (cum >= (strata::samp_acc_t) p.top_p) { cut = i + 1; break; }}if (cut < p.min_keep) cut = p.min_keep < k ? p.min_keep : k;n_keep = cut;@@ -613,17 +614,17 @@ __dpct_inline__ void sampler_kernel(const float *__restrict__ logits,float smx = scaled(0);#pragma unrollfor (int i = 1; i < n_keep; ++i) smx = sycl::fmax(smx, scaled(i));- double sum = 0.0;+ strata::samp_acc_t sum = 0.0;#pragma unrollfor (int i = 0; i < n_keep; ++i) sum +=- sycl::exp((double)scaled(i) - (double)smx);+ sycl::exp((strata::samp_acc_t)scaled(i) - (strata::samp_acc_t)smx);const float u = philox_uniform(p.seed, p.counter + (uint64_t) t);- double cum = 0.0;+ strata::samp_acc_t cum = 0.0;int pick = sel_ids[n_keep - 1];#pragma unrollfor (int i = 0; i < n_keep; ++i) {- cum += sycl::exp((double)scaled(i) - (double)smx) / sum;- if ((double) u < cum) { pick = sel_ids[i]; break; }+ cum += sycl::exp((strata::samp_acc_t)scaled(i) - (strata::samp_acc_t)smx) / sum;+ if ((strata::samp_acc_t) u < cum) { pick = sel_ids[i]; break; }}if (item_ct1.get_local_id(2) == 0) out[t] = pick;}@@ -689,7 +690,7 @@ __dpct_inline__ void warp_first(float &bv, int &bi) {template <bool kProb = false>inline void sampled_tail_warp(const int *sel_ids, const float *sel_logit, int k,const SamplerParams &p, int t,- int *__restrict__ out, double *ex,+ int *__restrict__ out, strata::samp_acc_t *ex,float *prob_out = nullptr) {const int lane =(int)(sycl::ext::oneapi::this_work_item::get_nd_item<3>().get_local_id(@@ -703,9 +704,9 @@ inline void sampled_tail_warp(const int *sel_ids, const float *sel_logit, int k,if (p.top_p < 1.0f) {#pragma unrollfor (int i = lane; i < k; i += 32)- ex[i] = sycl::exp((double)sel_logit[i] - (double)mx);+ ex[i] = sycl::exp((strata::samp_acc_t)sel_logit[i] - (strata::samp_acc_t)mx);sycl::group_barrier(sycl::ext::oneapi::this_work_item::get_sub_group());- double sum = 0.0;+ strata::samp_acc_t sum = 0.0;if (lane == 0)#pragma unrollfor (int i = 0; i < k; ++i) sum += ex[i];@@ -725,11 +726,11 @@ inline void sampled_tail_warp(const int *sel_ids, const float *sel_logit, int k,sycl::group_barrier(sycl::ext::oneapi::this_work_item::get_sub_group());int cut = k;if (lane == 0) {- double cum = 0.0;+ strata::samp_acc_t cum = 0.0;#pragma unrollfor (int i = 0; i < k; ++i) {cum += ex[i];- if (cum >= (double) p.top_p) { cut = i + 1; break; }+ if (cum >= (strata::samp_acc_t) p.top_p) { cut = i + 1; break; }}}/*@@ -759,9 +760,9 @@ inline void sampled_tail_warp(const int *sel_ids, const float *sel_logit, int k,smx = sycl::fmax(smx, sel_logit[i] * inv_t);#pragma unrollfor (int i = lane; i < n_keep; i += 32)- ex[i] = sycl::exp((double)(sel_logit[i] * inv_t) - (double)smx);+ ex[i] = sycl::exp((strata::samp_acc_t)(sel_logit[i] * inv_t) - (strata::samp_acc_t)smx);sycl::group_barrier(sycl::ext::oneapi::this_work_item::get_sub_group());- double sum = 0.0;+ strata::samp_acc_t sum = 0.0;if (lane == 0)#pragma unrollfor (int i = 0; i < n_keep; ++i) sum += ex[i];@@ -778,13 +779,13 @@ inline void sampled_tail_warp(const int *sel_ids, const float *sel_logit, int k,sycl::group_barrier(sycl::ext::oneapi::this_work_item::get_sub_group());if (lane == 0) {const float u = philox_uniform(p.seed, p.counter + (uint64_t) t);- double cum = 0.0;+ strata::samp_acc_t cum = 0.0;int pi = n_keep > 0 ? n_keep - 1 : 0;int pick = sel_ids[pi];#pragma unrollfor (int i = 0; i < n_keep; ++i) {cum += ex[i];- if ((double) u < cum) { pick = sel_ids[i]; pi = i; break; }+ if ((strata::samp_acc_t) u < cum) { pick = sel_ids[i]; pi = i; break; }}out[t] = pick;if constexpr (kProb) *prob_out = n_keep > 0 ? (float) ex[pi] : 1.0f;@@ -859,7 +860,7 @@ sampler_one_block_kernel(const float *__restrict__ logits, int n_vocab,*sycl::ext::oneapi::group_local_memory_for_overwrite<float[kSelMax]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());auto &ex =- *sycl::ext::oneapi::group_local_memory_for_overwrite<double[kSelMax]>(+ *sycl::ext::oneapi::group_local_memory_for_overwrite<strata::samp_acc_t[kSelMax]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());auto &sv = *sycl::ext::oneapi::group_local_memory_for_overwrite<float[32]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());@@ -1146,7 +1147,7 @@ sampler_split_merge_kernel(const sycl::int2 *__restrict__ cand, int n_blocks,*sycl::ext::oneapi::group_local_memory_for_overwrite<float[kSelMax]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());auto &ex =- *sycl::ext::oneapi::group_local_memory_for_overwrite<double[kSelMax]>(+ *sycl::ext::oneapi::group_local_memory_for_overwrite<strata::samp_acc_t[kSelMax]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());const sycl::int2 *src = cand + (size_t)t * n_blocks * k;#pragma unroll@@ -1247,7 +1248,7 @@ __dpct_inline__ void coupled_merge_kernel(*sycl::ext::oneapi::group_local_memory_for_overwrite<float[kSelMax]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());auto &ex =- *sycl::ext::oneapi::group_local_memory_for_overwrite<double[kSelMax]>(+ *sycl::ext::oneapi::group_local_memory_for_overwrite<strata::samp_acc_t[kSelMax]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());auto &pick = *sycl::ext::oneapi::group_local_memory_for_overwrite<int[1]>(sycl::ext::oneapi::this_work_item::get_work_group<3>());