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: long prompts - 693 tok/s at 2k tokens; the streaming source is a thread-safe 512-slot keyed cache
maxfridbe1a234406dcea
diff --git a/sycl/include/strata/core/gguf_expert_source.hpp b/sycl/include/strata/core/gguf_expert_source.hppindex a08a0a21b..b5c4df430 100644--- a/sycl/include/strata/core/gguf_expert_source.hpp+++ b/sycl/include/strata/core/gguf_expert_source.hpp@@ -15,7 +15,9 @@#include "strata/core/expert_source.hpp"#include <cstdint>+#include <mutex>#include <string>+#include <unordered_map>#include <vector>namespace strata::core {@@ -44,7 +46,10 @@ private:std::vector<std::string> names_;std::vector<int> layer_fd_; ///< per layer: index into fds_std::vector<std::vector<uint8_t>> ring_;+ std::vector<int64_t> ring_key_; ///< (layer << 20 | expert) held by each slot, -1 = empty+ std::unordered_map<int64_t, size_t> where_; ///< key -> slotsize_t ring_next_ = 0;+ std::mutex mu_;int64_t n_layers_ = 0, n_expert_ = 0;int64_t reads_ = 0;};diff --git a/sycl/src/core/gguf_expert_source.cpp b/sycl/src/core/gguf_expert_source.cppindex ae0595874..c6cb56b99 100644--- a/sycl/src/core/gguf_expert_source.cpp+++ b/sycl/src/core/gguf_expert_source.cpp@@ -9,14 +9,14 @@namespace strata::core {namespace {-constexpr size_t kRing = 8; // blobs alive at once: the fill holds one, verify_slot a second; the rest is slack+constexpr size_t kRing = 512; // blobs alive at once: the prompt path holds a layer's worth of streamed experts}GgufExpertSource::~GgufExpertSource() { close(); }void GgufExpertSource::close() {for (int fd : fds_) if (fd >= 0) ::close(fd);- fds_.clear(); names_.clear(); layer_fd_.clear(); ring_.clear();+ fds_.clear(); names_.clear(); layer_fd_.clear(); ring_.clear(); ring_key_.clear(); where_.clear();ring_next_ = 0;}@@ -43,6 +43,7 @@ bool GgufExpertSource::open(const std::string& shard1, int64_t n_layers, int64_tif (fd_of(l, err) < 0) { close(); return false; }ring_.resize(kRing);for (auto& b : ring_) b.resize((size_t) lay.max_blob);+ ring_key_.assign(kRing, -1);return true;}@@ -70,14 +71,25 @@ const uint8_t* GgufExpertSource::blob(int64_t layer, int64_t expert) {const uint64_t per[3] = {fm.up_off, fm.up_off, blob - fm.down_off};const uint64_t at[3] = {0, fm.up_off, fm.down_off};const int fd = fds_[(size_t) layer_fd_[(size_t) layer]];- std::vector<uint8_t>& buf = ring_[ring_next_];- ring_next_ = (ring_next_ + 1) % ring_.size();+ const int64_t key = ((int64_t) layer << 20) | expert;+ size_t slot;+ {+ std::lock_guard<std::mutex> lk(mu_);+ auto it = where_.find(key);+ if (it != where_.end()) { ++reads_; return ring_[it->second].data(); } // still resident+ slot = ring_next_;+ ring_next_ = (ring_next_ + 1) % ring_.size();+ if (ring_key_[slot] >= 0) where_.erase(ring_key_[slot]);+ ring_key_[slot] = key;+ where_[key] = slot;+ }+ std::vector<uint8_t>& buf = ring_[slot];for (int r = 0; r < 3; ++r) {const uint64_t src = lay.gguf_off[(size_t) (3 * layer + r)] + per[r] * (uint64_t) expert;uint64_t done = 0;while (done < per[r]) {const ssize_t n = ::pread(fd, buf.data() + at[r] + done, (size_t) (per[r] - done), (off_t) (src + done));- if (n <= 0) return nullptr;+ if (n <= 0) { std::lock_guard<std::mutex> lk(mu_); where_.erase(key); ring_key_[slot] = -1; return nullptr; }done += (uint64_t) n;}}