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++
[Engine] SYCL: a pipelined window never self-commits, so --pipeline-windows 2 is token-exact
Niko1221bf8d88b9dd71
diff --git a/sycl/include/strata/core/verify.hpp b/sycl/include/strata/core/verify.hppindex b38249f4d..540323ac6 100644--- a/sycl/include/strata/core/verify.hpp+++ b/sycl/include/strata/core/verify.hpp@@ -205,6 +205,11 @@ public:/// expert evicted on the host (the pool then computes it on the CPU) before the device table follows. Also turns/// the device-planned layers (E-6) off. Before `init`.void set_always_publish(bool on) { always_publish_ = on; }+ /// The pipelined windows never let a one-token window advance the state itself: its graph may run *speculatively*+ /// (ahead of the previous window's verdict), so a self-commit would land before the state it must build on is+ /// final. With this set, record_window does not self-commit and pl_commit_async always queues the commit graph -+ /// the configuration that measures token-identical to the serial path. Before `capture_all`.+ void set_self_commit_off(bool on) { self_commit_off_ = on; }dpct::queue_ptr stream() const { return cs_; }int device() const { return device_; }/// Capture every window size and the commit graph now (a capture syncs the stream: never with a window in flight).@@ -267,6 +272,7 @@ private:// batch windows (see init_slots)std::vector<SessionState*> slots_;bool batch_rec_ = false; ///< record_window is capturing a batch window+ bool self_commit_off_ = false; ///< set_self_commit_off: the pipelined windows commit through the graphint row_base_ = 0; ///< ... its hand-off rows start here (a pipeline group's own rows)int brow_[8] = {}; ///< ... and row t is slot brow_[t]bool last_batch_ = false; ///< the last run was a batch window (set_plan_slot: one group)diff --git a/sycl/src/core/verify.cpp b/sycl/src/core/verify.cppindex f3aaa208a..2811b5a00 100644--- a/sycl/src/core/verify.cpp+++ b/sycl/src/core/verify.cpp@@ -841,7 +841,8 @@ bool Verifier::record_window(int T, dpct::queue_ptr cs, std::string &err) {const bool ple_on = ss.ple.ready() && ple_stage();auto Rt = [&](int t) { return R_ + (size_t) t * HC * N; };const int G = (split_ && T >= 2 && !batch_rec_) ? 2 : 1; // a batch window is one group- const bool self_commit = T == 1 && !batch_rec_ && !g_qfuse() && one_token_self_commit(); // see Verifier::commit+ const bool self_commit = T == 1 && !batch_rec_ && !g_qfuse() && one_token_self_commit() &&+ !self_commit_off_; // see Verifier::commitstatic const bool dec_batch = [] { const char* v = std::getenv("STRATA_DEC_BATCH"); return v == nullptr || std::atoi(v) != 0; }();// 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.@@ -2693,7 +2694,7 @@ bool Verifier::commit(int n_keep, std::string &err) try {h_commit_[0] = n_keep;h_commit_[1] = n_keep - 1;for (int t = 0; t < max_t_; ++t) h_commit_[2 + t] = t < n_keep ? (int32_t) (last_pos0_ + t) : -1;- if (last_t_ == 1 && one_token_self_commit()) {+ if (last_t_ == 1 && one_token_self_commit() && !self_commit_off_) {// a one-token window has advanced the state itself (record_window): no commit graph} else {std::atomic_thread_fence(std::memory_order_seq_cst);@@ -4009,7 +4010,7 @@ bool Verifier::pl_commit_async(int n_keep, std::string &err) try {// single-token window; the first decode window is always one token, so the two paths' GDN states were// equal after the prompt and different after that window (STRATA_PIPELINE_DUMP), and the tokens diverged// at the fourth. With this skip the pipelined windows are token-identical to the serial path.- if (last_t_ == 1 && one_token_self_commit()) {+ if (last_t_ == 1 && one_token_self_commit() && !self_commit_off_) {h_commit_[0] = n_keep;h_commit_[1] = n_keep - 1;for (int t = 0; t < max_t_; ++t) h_commit_[2 + t] = t < n_keep ? (int32_t) (last_pos0_ + t) : -1;diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cppindex 52eb10c58..3db8caef9 100644--- a/sycl/src/program/generate.cpp+++ b/sycl/src/program/generate.cpp@@ -7279,10 +7279,14 @@ int main(int argc, char **argv) try {for (strata::core::Verifier* v : {&ver, &ver_b}) {v->set_stream(pl_stream[0]);v->set_always_publish(true);+ v->set_self_commit_off(true); // a pipelined window may run speculatively: never let it+ // advance the state itself, the commit graph always does}for (strata::core::Verifier* v : {&stages[0]->ver, &stages[0]->ver_b}) {v->set_stream(pl_stream[1]);v->set_always_publish(true);+ v->set_self_commit_off(true); // a pipelined window may run speculatively: never let it+ // advance the state itself, the commit graph always does}}if (n_stages > 1) {@@ -11551,17 +11555,33 @@ int main(int argc, char **argv) try {const size_t n = (size_t) ss.gdn_alloc * (size_t) gdn_floats;std::vector<float> h(n);(void) DPCT_CHECK_ERROR(s0->memcpy(h.data(), ss.gdn_state, n * sizeof(float)).wait());- uint64_t hs = 1469598103934665603ull;- double sum = 0.0;- for (size_t i = 0; i < n; ++i) {- uint64_t b = 0;- std::memcpy(&b, &h[i], sizeof(float));- hs = (hs ^ b) * 1099511628211ull;- sum += (double) h[i];+ // the recurrence state and the conv history hashed apart: a wrong row shows which half it is+ const size_t n_rec = (size_t) g.ssm_state_size * g.ssm_v_heads * g.ssm_state_size;+ const size_t n_cnv = (size_t) g.ssm_conv_channels * (g.ssm_d_conv - 1);+ double rec_sum = 0.0, cnv_sum = 0.0;+ uint64_t rec_hash = 1469598103934665603ull, cnv_hash = 1469598103934665603ull;+ for (int64_t l = 0; l < ss.gdn_alloc; ++l) {+ const size_t base = (size_t) l * (size_t) gdn_floats;+ uint64_t rh = 1469598103934665603ull, ch = 1469598103934665603ull;+ for (size_t i = 0; i < n_rec; ++i) {+ uint64_t b = 0;+ std::memcpy(&b, &h[base + i], sizeof(float));+ rh = (rh ^ b) * 1099511628211ull;+ rec_sum += (double) h[base + i];+ }+ for (size_t i = 0; i < n_cnv; ++i) {+ uint64_t b = 0;+ std::memcpy(&b, &h[base + n_rec + i], sizeof(float));+ ch = (ch ^ b) * 1099511628211ull;+ cnv_sum += (double) h[base + n_rec + i];+ }+ rec_hash = (rec_hash ^ rh) * 1099511628211ull;+ cnv_hash = (cnv_hash ^ ch) * 1099511628211ull;}if (std::FILE* df = std::fopen(pl_dump, "a")) {- std::fprintf(df, "pos %lld windows %lld gdn %zu sum %.9g hash %016llx\n", (long long) p,- (long long) dec_windows, n, sum, (unsigned long long) hs);+ std::fprintf(df, "pos %lld windows %lld rec %.9g %016llx cnv %.9g %016llx\n", (long long) p,+ (long long) dec_windows, rec_sum, (unsigned long long) rec_hash, cnv_sum,+ (unsigned long long) cnv_hash);std::fclose(df);}}@@ -11781,17 +11801,32 @@ int main(int argc, char **argv) try {const size_t n = (size_t) ss.gdn_alloc * (size_t) gf;std::vector<float> h(n);(void) DPCT_CHECK_ERROR(ver.stream()->memcpy(h.data(), ss.gdn_state, n * sizeof(float)).wait());- uint64_t hs = 1469598103934665603ull;- double sum = 0.0;- for (size_t i = 0; i < n; ++i) {- uint64_t bb = 0;- std::memcpy(&bb, &h[i], sizeof(float));- hs = (hs ^ bb) * 1099511628211ull;- sum += (double) h[i];+ const size_t n_rec = (size_t) g.ssm_state_size * g.ssm_v_heads * g.ssm_state_size;+ const size_t n_cnv = (size_t) g.ssm_conv_channels * (g.ssm_d_conv - 1);+ double rec_sum = 0.0, cnv_sum = 0.0;+ uint64_t rec_hash = 1469598103934665603ull, cnv_hash = 1469598103934665603ull;+ for (int64_t l = 0; l < ss.gdn_alloc; ++l) {+ const size_t base = (size_t) l * (size_t) gf;+ uint64_t rh = 1469598103934665603ull, ch = 1469598103934665603ull;+ for (size_t i = 0; i < n_rec; ++i) {+ uint64_t bb = 0;+ std::memcpy(&bb, &h[base + i], sizeof(float));+ rh = (rh ^ bb) * 1099511628211ull;+ rec_sum += (double) h[base + i];+ }+ for (size_t i = 0; i < n_cnv; ++i) {+ uint64_t bb = 0;+ std::memcpy(&bb, &h[base + n_rec + i], sizeof(float));+ ch = (ch ^ bb) * 1099511628211ull;+ cnv_sum += (double) h[base + n_rec + i];+ }+ rec_hash = (rec_hash ^ rh) * 1099511628211ull;+ cnv_hash = (cnv_hash ^ ch) * 1099511628211ull;}if (std::FILE* df = std::fopen(sd, "a")) {- std::fprintf(df, "pos %lld serial gdn %zu sum %.9g hash %016llx\n", (long long) (p + a + 1), n,- sum, (unsigned long long) hs);+ std::fprintf(df, "pos %lld serial rec %.9g %016llx cnv %.9g %016llx\n", (long long) (p + a + 1),+ rec_sum, (unsigned long long) rec_hash, cnv_sum,+ (unsigned long long) cnv_hash);std::fclose(df);}}