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++
prefill: STRATA_TEST_PAGEABLE=1 forces the pageable fallbacks of Prefill::init (#828 test switch)
Niko1221cfe09ab5f55f
diff --git a/src/prefill/prefill.cpp b/src/prefill/prefill.cppindex e76fb6ddc..9ef0d25ec 100644--- a/src/prefill/prefill.cpp+++ b/src/prefill/prefill.cpp@@ -96,6 +96,12 @@ constexpr int kSplitHelpRing = 48; // layer split help: the helper stage's ring// Step 3: from this chunk size on, every non-resident expert of every layer streams in a fixed order through a// ring_slots()-slot ring (nearly all 512 are routed at such a chunk), so the copy engine keeps working through the// attention halves instead of waiting for each layer's routing.+// #828: STRATA_TEST_PAGEABLE=1 makes every pinned host allocation with a pageable fallback in Prefill::init fail, so the+// fallbacks (what an LXC container's memlock limit forces) run on a PC that can pin - for ASan / MALLOC_CHECK_=3 runs.+inline bool force_pageable() {+ static const bool v = [] { const char* e = std::getenv("STRATA_TEST_PAGEABLE"); return e != nullptr && e[0] == '1'; }();+ return v;+}constexpr int RING_MAX = 1024; // the arrays; the ring itself is ring_slots(), at most ring_cap()// The chunk size from which every expert streams: 1024 since 0.1.30 (was 2048). Measured on the 5070, Q2_0 / IQ2_XS,// fixed cache: 1,500-token prompts 621 -> 785 / 612 -> 735 tok/s, 2,000 727 -> 934 / 712 -> 892, 4,000 (its last@@ -285,7 +291,7 @@ struct Stager {dma_done.assign((size_t) kRing, nullptr);pageable.resize(kRing);for (int i = 0; i < kRing; ++i) {- pinned[i] = cudaHostAlloc((void**) &buf[i], blob_bytes, cudaHostAllocDefault) == cudaSuccess;+ pinned[i] = !force_pageable() && cudaHostAlloc((void**) &buf[i], blob_bytes, cudaHostAllocDefault) == cudaSuccess;if (!pinned[i]) {cudaGetLastError();pageable[(size_t) i].resize(blob_bytes);@@ -790,7 +796,8 @@ bool Prefill::init(const core::WeightTable& wt, const core::ModelGeometry& g, com.grp_host = m.grp_dev = nullptr;m.grp_n = m.grp_tk = 0;void *h = nullptr, *d = nullptr;- if (cudaHostAlloc(&h, need * 4, cudaHostAllocMapped | (core::peer_portable() ? cudaHostAllocPortable : 0)) == cudaSuccess &&+ if (!force_pageable() &&+ cudaHostAlloc(&h, need * 4, cudaHostAllocMapped | (core::peer_portable() ? cudaHostAllocPortable : 0)) == cudaSuccess &&cudaHostGetDevicePointer(&d, h, 0) == cudaSuccess) {m.grp_host = (int32_t*) h;m.grp_dev = (int32_t*) d;@@ -804,7 +811,7 @@ bool Prefill::init(const core::WeightTable& wt, const core::ModelGeometry& g, co}for (int b = 0; b < 2; ++b) {if (!m.ple_emb_host[b] &&- cudaHostAlloc((void**) &m.ple_emb_host[b], (size_t) T * N * 4, cudaHostAllocDefault) != cudaSuccess) {+ (force_pageable() || cudaHostAlloc((void**) &m.ple_emb_host[b], (size_t) T * N * 4, cudaHostAllocDefault) != cudaSuccess)) {cudaGetLastError();m.ple_pageable[b].resize(T * N); // pageable: the upload is staged before it returnsm.ple_emb_host[b] = m.ple_pageable[b].data();