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++
Merge branch 'f-142-mgpu' into f-142
Niko122143b105a753e5
diff --cc src/program/generate.cppindex bbfe020bc,46c9d1c56..dc8c5d3c7--- a/src/program/generate.cpp+++ b/src/program/generate.cpp@@@ -59,12 -59,10 +60,14 @@@#include "strata/core/mtp.hpp"#include "strata/prefill/prefill.hpp"#include "strata/core/native_dense.hpp"-#include "strata/program/split_ring.hpp"+#include "strata/program/batch_read.hpp"#include "strata/program/logits_selection.hpp"#include "strata/program/conv_cache.hpp"+#include "strata/program/split_rules.hpp"+#include "strata/prefill/share_rules.hpp"+#include "strata/platform/host_limits.hpp"++#include "strata/program/split_ring.hpp"+ #include "strata/program/draft_kv_plan.hpp"#include "strata/program/message_boundary.hpp"#include "strata/spec/draft_policy.hpp"#include "strata/spec/draft_source.hpp"@@@ -2013,39 -1988,18 +2037,50 @@@ int main(int argc, char** argv)if (const char* e = std::getenv("STRATA_HOST_CORE")) hc = e;if (hc == "last") strata::kernels::cpu::set_host_core(strata::kernels::cpu::HostCore::Last);}+ { // --aux-cpus / STRATA_AUX_CPUS: read the CPUs this process may use now, before any thread is pinned; the plan+ // follows once the pool exists (it needs the workers' CPUs)+ std::string ac = o.aux_cpus;+ if (ac.empty())+ if (const char* e = std::getenv("STRATA_AUX_CPUS")) ac = e;+ std::string aerr;+ if (!strata::aux_cpus::configure(ac, aerr)) {+ std::fprintf(stderr, "strata generate: STRATA_AUX_CPUS: %s\n", aerr.c_str());+ return 2;+ }+ }strata::core::set_peer_portable(o.peer_device >= 1); // multi-GPU: the Portable flag on mapped host buffers only with a peer device (before any allocation)+ { // the RAM guard (parking, session save/restore): --memory-limit-mib, else STRATA_MEMORY_LIMIT_MIB, else none+ int64_t mib = o.memory_limit_mib;+ if (mib < 0) {+ const char* env = std::getenv("STRATA_MEMORY_LIMIT_MIB");+ if (env != nullptr && env[0] != '\0') {+ const size_t len = std::strlen(env);+ const auto parsed = std::from_chars(env, env + len, mib);+ if (parsed.ec != std::errc{} || parsed.ptr != env + len || mib < 0 || mib > INT64_MAX / (1024 * 1024)) {+ std::fprintf(stderr, "STRATA_MEMORY_LIMIT_MIB needs a nonnegative integer within range (got \"%s\")\n", env);+ return 2;+ }+ } else mib = 0;+ }+ strata::core::set_memory_limit_bytes((uint64_t) mib << 20);+ if (o.serve || mib > 0) {+ constexpr double GiB = 1073741824.0;+ const auto mem = strata::core::sample_host_memory();+ if (!mem) {+ std::fprintf(stderr, "strata generate: memory guard: the available RAM cannot be read; parking and session "+ "save/restore are refused\n");+ } else {+ std::fprintf(stderr, "strata generate: memory guard: limit %.1f GiB (source: %s), current %.1f GiB, "+ "reclaimable cache credited %.1f GiB; available %.1f GiB (MemAvailable %.1f GiB%s), "+ "floor %lld MiB\n",+ (double) mem->limit / GiB, strata::core::memory_source_name(mem->source),+ (double) mem->current / GiB, (double) mem->credit / GiB, (double) mem->available / GiB,+ (double) mem->mem_available / GiB,+ mib > 0 ? (", --memory-limit-mib " + std::to_string((long long) mib)).c_str() : "",+ (long long) o.conversation_cache_min_free_mib);+ }+ }+ }if (o.serve && o.conversation_cache_mib > 0 && (o.prompt_cache == 0 || o.conversation_cache_slots == 0))std::fprintf(stderr, "strata serve: warning: conversation caching is disabled by %s\n",o.prompt_cache == 0 ? "--prompt-cache 0" : "--conversation-cache-slots 0");@@@ -6418,17 -6354,11 +6535,11 @@@// bytes -> slots for one cache: exact when it knows its per-slot offsets (a native pack's blobs differ// per layer), otherwise max_blob each.auto cache_slots_for = [&](const strata::core::ExpertCache& xc, uint64_t need) -> int64_t {- if (xc.slot_offsets() != nullptr) { // sized slots: from the end until they hold `need`- int64_t k = 0;- while (k < xc.slots() &&- (uint64_t) (xc.bytes() - (int64_t) xc.slot_offsets()[xc.slots() - k]) < need) ++k;- return k;- }- const int64_t blob = (int64_t) strata::kernels::cpu::expert_layout().max_blob;- return (int64_t) ((need + (uint64_t) blob - 1) / (uint64_t) blob);+ return strata::program::split_lend_slots(xc.slots(), xc.bytes(), xc.slot_offsets(),+ (uint64_t) strata::kernels::cpu::expert_layout().max_blob, need);};auto part_slots = [&](const PfPart& p, int64_t c) -> int64_t {- return cache_slots_for(*p.cache, strata::prefill::Prefill::bytes_needed(g, *p.ses, c));+ return cache_slots_for(*p.cache, strata::prefill::Prefill::bytes_needed(g, *p.ses, c, srcp != nullptr));};auto part_bytes = [&](const PfPart& p, int32_t first) -> uint64_t {strata::core::ExpertCache& xc = *p.cache;