mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2968] [Engine] prompt path: experts staged from the resident arena keep the full streamed ring and 8 copy threads (unpinned 32K +5-19%); STRATA_ARENA_PIN_GIB=none #4369
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4369
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2968
Author: @sergqwer
Created: 10/17/2026
Status: 🔄 Open
Base:
main← Head:pr/unpinned-staging📝 Commits (1)
2681789prompt path: experts staged from the resident arena keep the full streamed ring and get 8 copy threads, 64 buffers; STRATA_ARENA_PIN_GIB=none📊 Changes
5 files changed (+49 additions, -10 deletions)
View changed files
📝
include/strata/core/pinned.hpp(+2 -1)📝
include/strata/prefill/prefill.hpp(+3 -0)📝
src/core/pinned.cu(+5 -0)📝
src/prefill/prefill.cpp(+31 -5)📝
src/program/generate.cpp(+8 -4)📄 Description
Problem and result
Some experts the GPU cannot DMA directly: the arena's pin is capped or refused (a multi-GPU run under WDDM, which caps it at 8 GiB by default,
STRATA_ARENA_PIN_GIB, the remainderSTRATA_PIN_BY_NEEDleaves). The prompt path's stager copies these into pinned buffers and DMAs them from there. When more than 10% of the bytes are unpinned, the streamed ring is cut to a quarter (96 slots) and the stager keeps 4 copy threads and 16 buffers. The 96 slots were measured where the host copies were the limit (file reads, IQ3_S on a 64 GB PC). From the expert arena these copies are plain memcpy from resident RAM, so the small ring only slows the prompt.maine88ee39d), a 32K prompt read with nothing pinned: 3086 / 3289 tok/s at the default 8K chunks, 5774 / 5808 with--prefill auto:32768; with an 8 GiB pin (88% not pinned) 3393 / 3286.Related discussion
None beyond this PR. It was #2968 before the 0.2.0-beta tracker reset, unchanged except for the rebase. It changes no output and no default on one GPU (the arena is pinned whole there); on a multi-GPU Windows run, whose arena pin is capped by default, it changes the staging sizes as measured below.
Approach
Prefill::set_resident_stage, set where the engine sets the pinned share): the ring keeps its pinned size (384, or 1024 fused), and the stager gets max(4, min(8, CPUs/4)) threads and 64 buffers.STRATA_STAGE_RESIDENT=0restores the old sizing,=1forces the new one;STRATA_STAGER_THREADS,STRATA_STAGER_RINGandSTRATA_PREFILL_RINGstill take precedence.prefill: 100% of the expert bytes are not pinned: the stager copies them from resident RAM with 8 threads into 64 pinned buffers (169 MiB) and the streamed ring keeps its pinned size ....STRATA_ARENA_PIN_GIB=nonepins nothing: the unpinned arm by name.0keeps meaning "the whole arena", as documented; until now nothing pinned needed a 1 GiB cap below a layer's 1.32 GiB slice.noneis a one-byte cap, so no slice is registered; the arena stays resident through the working-set lock or its large pages.--no-prefill-borrowthat stays reserved). Pinned host memory: 64 stage buffers = 169 MiB, up from 16.Validation
Revision: this branch, one commit
2681789bonmaine88ee39d(v0.2.0-beta + 12 commits), against a build ofmaine88ee39dwith the same configure. RTX 5090 (PCIe 5), Ryzen 9 9950X3D, 128 GB DDR5 (dual channel), Windows 11; MSVC 2022 17.14, CUDA 13.3, release configure (-DSTRATA_PORTABLE=ON,75-real;86-real;89-real;120-real, ggml at the pinned 3cf03257). Model: the NVFP4 GPTQ pack (Maximilian228/Qwen3.8-Flash-Next-NVFP4-GPTQ-Strata, upstream setup's--family nvfp4 --model NVFP4files).Passed:
Identity with the default whole-arena pin:
strata --servewith setup's model files plus--expert-cache 3000 --prefill auto --spec 6 --spec-min-p 0.7 --max-context 262144 --kv int8 --gpu 0 --pcie-frac 0 --adapt-every 1000000, envSTRATA_PREFILL_CPU_SHARE=0 STRATA_PCIE_BALANCE=0 STRATA_IQ_MT_MIN=1 STRATA_DUMP_FIRST_LOGITS=<file>; a 2,100-token and a 32,037-token prompt, 32 greedy tokens each: first-token logits and tokens byte-identical tomain's (2K1e9c612c2e6c7a32..., 4 tokens; 32Kf5b2872c7ac30b17..., 20 tokens).Prompt speed. One GPU,
strata --servewith setup's model files plus--expert-cache auto --vram-reserve-mib 2048 --prefill auto --spec 6 --spec-min-p 0.7 --max-context 262144 --kv int8(at the default 700 MiB reserve the cache filled the card and WDDM paged in an earlier batch). Each start reads a 32K prompt twice and a 2K prompt three times, each fresh (a distinct first token); prompt tok/s from the engine'sprompt ... read inline. "Nothing pinned" isSTRATA_ARENA_PIN_GIB=1onmain(no 1.32 GiB slice fits, 0 slices pinned) and=noneon this branch. Two starts per arm, the order alternating:main32K, 1st / 2nd readmain2K--prefill auto:32768--prefill auto:32768(main, 1 start)main-> this branch: nothing pinned +4.5% (the first pair +0.3%, the second +8.4%), 8 GiB +13.1%, nothing pinned with 32K chunks +18.8%. Unpinned with 32K chunks went from 83% to 98% of the pinned arena.Failed: none observed.
Not run:
STRATA_ARENA_PIN_GIB.STRATA_PIN_BY_NEEDwith a partial pin.prefill.cpp,pinned.cuandgenerate.cpp; no ROCm or Mac here. SYCL keeps its own copies (unchanged).Limits
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.