The merge is clean: every file of f-hy4-run is new on top of the candidate except
engine/include/strata/artifact/model_family.hpp (+6) and engine/cmake/backends/quant.cmake (+3).
The settings register conflicted on line numbers only. It was taken from the rc,
STRATA_ADAPT_FETCH's status and note were carried from f-fetch16, then
settings_register.py and --docs were run over the merged tree (1125 names);
--check passes.
detail::host_available_memory read a cgroup v1 limit as memory.limit_in_bytes - memory.usage_in_bytes. v1's usage_in_bytes charges the whole page cache, and the kernel
evicts that cache before it fails an allocation at the limit, so a container that had read its model through the file cache sat at its limit with its RAM to spare.
The v2 branch credits the group's clean file pages (and the conversation memory guard and the setup's Python probe credit them on v1 too); this branch did not.
Every figure built on it was short: the default CPU prompt share was "not armed by default: only 0.1 GiB of RAM is free" (the share needs 3.3 GiB), and the arena
verdicts, the resident-budget clamp and the file tier's room read the same number.
Measured on the rented RTX 5090 box (Vast 61335444: Docker, cgroup v1 hybrid, 171 GiB limit, 104 GB model, EPYC 9B14): limit - usage = 2.57 GiB with 99.9 GB of clean file
pages (total_inactive_file + total_active_file) in the group.
arena_cgroup_room_v1 (conversation_memory.cpp): room = limit - (usage - credit), credit = total_inactive_file + total_active_file - total_dirty - total_writeback, never more
than the usage, less min(credit / 2, limit / 64): the rule of the v2 container branch (arena_cgroup_room). shmem (in total_cache, on the anon lists) and mlocked pages are
not on the file lists, so they stay charged. A memory.stat without total_inactive_file or no memory.stat: no credit (limit - usage, as before). STRATA_MEM_CREDIT_INACTIVE=1
credits total_inactive_file alone. The v2 branches are unchanged.
Test: file_expert_source_test (test_host_memory) has the box's memory.stat / usage / limit (2026-11-19 19:01:37 UTC) in the hybrid fixture: the room was 2.57 GiB before and is
92.9 GiB now; memory_guard_test has the pure arena_cgroup_room_v1 cases (shmem, dirty, writeback, bound by the usage, no stat, inactive only).
f-bw-h (a620ffb61, 595d40922) and f-bw-f (38e6a0506) both arm the CPU prefill
share on a layer split. One conflict, engine/src/program/generate.cpp, the
share arming block of the serve start-up, resolved to one rule:
- BW-H first: on a layer split the stages' stream floors are summed; where the
link rule raises the limit above 3,072 (Prefill::arm_cpu_share_split) it arms
the share by itself and sets the limit and the expert width. This is what arms
a split of three or more cards, and it gives a two-card split with a slow link
its larger limit.
- BW-F second: arm_cpu_share(share_pool, share_pool && share_layout &&
share_has_work): one card, or exactly two CUDA cards (STRATA_SPLIT_CPU_SHARE=0,
kSplitShareDefault), armed by default with the default limit. A two-card split
of fast links therefore keeps the share armed, as BW-F measured it.
- set_card_expert_share takes pool.workers() (BW-H) in the one-card condition.
- BW-F's start-up line is kept.
docs/SETTINGS.md is generated (conflict only in its table): regenerated from the
register.
The share is off on a layer split by default. With explicit STRATA_PREFILL_CPU_SHARE=auto and the limit above the split's 8,192-token chunk, experts of up to 64 tokens, 2x RTX 5090 on one board (GPU0 PCIe 4.0 x2
3.6 GB/s first stage, GPU1 x8 14.1 GB/s, 32 pool workers, UD-Q4_K_XL, --layer-split auto, 3 rounds) the prompt takes 0.25-0.68 of the split's default time at 84 / 1,024 / 2,048 / 4,096 / 8,192 / 12,288 /
16,384 / 32,768 tokens (843 -> 327, 1,957 -> 829, 5,549 -> 1,395, 5,949 -> 2,345, 6,783 -> 4,599, 11,052 -> 5,999, 11,233 -> 7,578, 20,026 -> 13,125 ms), decode level; the share with the default limit 3,072 costs
3-4% from 4K up.
Prefill::arm_cpu_share_split(applies, floor_ms, pool_workers, all_cc120) (called before arm_cpu_share in the serve path when the engine runs a layer split): floor_ms is the sum over the stages of (pairs of the
stage's layers - its cache slots) x blob / its link; the share is armed by default only when share_rules::link_rule_floor raises the limit above 3,072 (here 3,556 ms -> 12,032 tokens, 64-token experts), so a
split of fast links keeps the share off as before. With the rule (nothing set against STRATA_PREFILL_CPU_SHARE_AUTO=0): x0.38 / 0.41 / 0.25 / 0.38 / 0.63 / 0.52 / 0.64 / 0.62 of the default at the same
lengths, decode chat 129.2 -> 132.5, code 189.7 -> 203.9, agent 136.3 -> 138.2 tok/s. Forced-token KL on the split against the FP16 prompt path (48 prompts, 12,288 positions, fixed share 0.5): exact 0.01119,
share with 8-token experts 0.980 [0.938, 1.024] of it, share with 64-token experts and limit 16,384 0.979 [0.907, 1.053]. Docs updated (DETAILS.md).
RTX 5050 / 5060 / 5060 Ti / 5070 / 5070 Ti / 5080 and the laptop parts. A card with more memory,
and every other vendor and architecture, keeps it off. A value the user sets (0 included) always wins;
STRATA_ADAPT_FETCH=0 is the way back, STRATA_SM120_PERF=0 and STRATA_DEFAULTS=026 leave it out with the
rest of the sm_120 table.
The switch is read once per process and only a one-card run uses it (a layer split, helper cards, a peer
tier and --batch turn it off), so the engine's main card (STRATA_PRIMARY_DEVICE) decides; its memory is
cudaDeviceProp::totalGlobalMem, read without making a context.
BW-9, 2x RTX 5060 Ti 16 GB, UD-Q4_K_XL, tail skip off, product flags, 3 paired rounds: decode +4 to +43%
by kind (medians 1.087 to 1.325), expert cache hit rate 54.4 -> 62.0%, forced-token KL against the FP16
prompt path 0.948 [0.830, 1.063] of the default's, prompts level except json 169 at +3 to +5%.
The start-up line of the sm_120 defaults names it and says it is not bit-exact; the lines that say the
switch cannot run in a given start (a layer split, --batch, ...) say the default is not used there.
Unit test adapt_fetch_default_test (the card rule, the table, apply_nv_defaults with the user's value,
the off switches); settings register: status default.
The default share took chunks up to 3,072 tokens and experts of at most 8 tokens, a setting measured on one 28 GB/s link. A chunk from the limit up streams every expert the card does not hold in
one pass whose time F (bytes of the missing experts / the link) does not depend on the chunk length; the staged walk with the share grows with it, so the share pays up to a length T* that
grows with F. RTX 5090 cards, UD-Q4_K_XL (8,056 of 24,576 experts on the card), 3 interleaved rounds, the share with 32-token experts against the default: T* 4.2K tokens at 53.6 GB/s (15 pool
workers), 8.8K at 28.3 GB/s (22), 14.0K at 14.1 GB/s (32), 19.7K (32-token experts) / 25K (64-token experts) at 3.6 GB/s; 8 pool workers 7.7K, 16 workers 8.5K (22: 8.8K). At 53.6 GB/s the
default 3,072 beats streaming by 25-34% from 1,536 tokens and above ~4K staged equals streamed, so the rule never goes below 3,072.
share_rules.hpp link_rule(): limit = 3.4 x F (ms) tokens up to F = 3.67 s, +0.76 tokens per ms of F above it, between 3,072 and 20,480, scaled by (workers / 22)^0.15 for smaller pools; experts of
up to 32 tokens (64 from F = 3 s) where the limit is raised. Prefill::set_card_expert_share takes the pool's workers; arm_cpu_share applies the rule to the default-armed share only (an explicit
STRATA_PREFILL_CPU_SHARE, STRATA_PREFILL_CPU_SHARE_MAX and STRATA_PREFILL_CPU_SHARE_NT keep their meaning) and prints one "CPU share rule:" line. STRATA_PREFILL_CPU_SHARE_AUTO: unset = cc 12.0
discrete cards with the link probed, 1 = any CUDA card, any other value = off. Settings register, docs, unit tests (share_rules_test) updated.
BW-G's row_prefetch.hpp (STRATA_ROW_PF) chose the locality with a conditional; __builtin_prefetch needs a constant integer. One call per case, the same three localities. x86 is unchanged (it takes the _mm_prefetch branch).
0.1.62 and before warned "only N MiB of VRAM free at the start of this request" at the first request of every start below 1 GiB (512 MiB off
Windows), also on a card the expert cache fills on purpose. The rule is now strata/core/vram_request_notice.hpp: say it below the safe figure
when the free memory is at least 64 MiB lower than the start-up line reported (generate.cpp keeps that figure in g_startup_vram_free_mib; the
request compares the same figure the start-up line prints) or is under 512 MiB; with no start-up figure the old rule stays. The text is the
owner-approved wording of TEXT-BATCH-0217 item 4 (Windows says "Windows", other systems "the driver"). Once per 128 MiB lower, as before.
Test: vram_request_notice_test (header-only, CPU). docs/DETAILS.md describes the new rule.
Until now the default CPU prefill share (idle pool takes some of the experts a prompt chunk would stream over PCIe, chunks up to 3,072 tokens) was armed on one card only.
A layer split streamed every expert of every short prompt over PCIe, stage after stage, so a prompt of 32 to 566 tokens took 1.4 to 1.8 times as long on two
RTX 5060 Ti 16 GB as on one (UD-Q4_K_XL, DFlash2, PCIe 4.0 x8, 48 cores). The stages already take the pool one at a time (prefill.cpp), and
STRATA_PREFILL_CPU_SHARE=auto works on a split; only the default was missing.
share_rules.hpp: default_share_layout(later_stages, multi_gpu, env, cuda): one card as before; one later stage (two cards) on a CUDA build by default, the
switch both ways; three and four cards, the helper caches and HIP / SYCL builds stay off. generate.cpp (serve): the H11 memory check and arm_cpu_share use it,
one start-up line says so. share_rules_test: the layout table.
Prompt ms, two cards, default share off against on (3 rounds, tail skip off): 32 tokens 605 -> 268, 64: 825 -> 384, 84: 1,193 -> 489, 169: 1,680 -> 669,
566: 3,188 -> 1,574, 1,024: 2,869 -> 1,754, 2,048: 4,547 -> 2,512; 4,096 and longer are above the limit (+2%). Details and the KL gate: phaseA-tests/bw/RESULTS-BW-F.md.
BW-G measured it bit-exact (BASE-05 27 of 27, pool_determinism --reps 20, 124,656 checks) with the CPU pool's window -2.9% on an RTX 5090 + EPYC box.
ExpertPool's constructor reads the variable once: unset or anything but "0" is on. Not under the NUMA split and not for Q2_0 down rows, as before.
A second ctest, pool_determinism_dep_off, runs pool_determinism with STRATA_POOL_DEP=0 so the way back stays covered.
From PR #6023 (midhatn; its engine commit 3440d4609), author kept. The engine, the unit test and the register entry are taken;
the PR's docs (docs/NVIDIA_V100.md rows, the bench report under docs/bench-results/) are not (they describe the mechanisms as
measured on 2x V100-SXM2 NVLink only). What the commit does:
- STRATA_MMQ_TIER_SORT=1 (opt-in): the experts of a prompt chunk go in readiness-tier order (VRAM, pinned RAM, file stager) and
row-count order within a tier (mmq_resident_sort.hpp, mmq_resident_sort_test), in the staged walk, the layer-major walk and the
peer's walk; under it an async P2P copy (cudaMemcpyPeerAsync + an event) hands a chunk's hidden state from one layer-split stage to
the next;
- pf_wmma() (STRATA_PF_WMMA=1, opt-in) is no longer compiled out of an MMQ-free build;
- Prefill::set_peer() works on an MMQ-free build: int8 (q8_1 over P2P) or WMMA expert kernels on the peer card, the peer's gathers
grouped (gather_native_group), the 35 % peer stream over every layer the peer can take;
- the decode peer's output goes straight into the primary's hit_out buffer over P2P (hit_out_dev), and the layer split's hand-off
buffers sit in VRAM when two cards can reach each other;
- the staged walk's stream-ahead window counts pending copies (max_pending), the layer-major walk groups its gathers
(STRATA_PREFILL_GROUP_GATHER, on unless 0).
This commit is the PR as it came; the next commit of this series turns the pieces that change a default (VRAM hand-off buffers,
decode scatter, tail-skip rules, layer-major group gather) into opt-in switches and says why.
From PR #3476 (pugolini; its commits 51d8370a8 and 70813d5b8), author kept; hand port, and the default is changed. The native router is
512 x 10 only, so a 256-expert model (Qwen3.8-Flash-Next Coder) took the per-token moe_route loop in the verify window,
a projection and top-k launch pair per token and layer. moe_route_window (one multi-column BF16 projection and one top-k per
layer, bitwise the per-token calls by route_window_parity) was reachable on gfx906 builds only; the PR made it the default on
every HIP card. Here the branch is compiled on every backend and route_window_on() keeps gfx906's default (on) and makes
every other backend opt-in (STRATA_ROUTE_WIN=1), because we have not repeated the PR's measurement (R9700, Coder IQ1_M,
--spec 4: routing 3.34 to 1.39 ms a window, decode +9%, same output hashes). Also taken from the PR: profile stamp slot 33
("router (proj+topk)", under STRATA_VERIFY_PROFILE=1) splits the routing from the plan / doorbell time, and
route_window_parity now covers T = 1..6. Unset, the launches on CUDA, HIP and Metal are the ones before. The name is in the
settings register (status research); the parity program on the R9700 is in the gate table.
From PR #4333 (xyzzing; its commit 9da37ce3e), author kept, changed from a refusal to a warning.
--mtp-q4 head (and all) requantizes the draft head's token subset, but make_q4_head() is only reached inside the
draft_vocab.bin branch of MtpDrafter::bind(). With no rt/draft_vocab.bin (and no --mtp-draft-vocab) the flag did
nothing and drafting ran over the full head, with no hint (the reporter lost a measurement window to it). bind() now
prints a line that names the missing subset and the fix (tools/draft_vocab.py, or --mtp-q4 proj). The PR made bind()
fail; here it only warns, because the setup config of some machines passes --mtp-q4 all and a pack without a subset
used to start (warnings over refusals). It stays silent for the shared-drafter path and for rebinds, as in the PR.
The usage line, the option comment and the set_q4 header comment state the requirement. Nothing else changes.
From PR #4854 (Keoian; its commits 43e390e0e and 7a68664ac), author kept. On a CPU with AVX and no AVX2 (the older-CPU
source build, STRATA_ISA_FLOOR=avx) q2_native_kernels() admitted AVX2 only, so every native pack's Q2_0 expert ran on
ggml-cpu's own vec_dot and never reached the AVX1 rows of q2_avx1.cpp. It now also admits cpu_avx1_ok(); a CPU
without AVX keeps ggml-cpu. On a CPU with AVX2 nothing changes (the first term is true as before). The AVX1 bit-plane
row (STRATA_Q2_BITPLANE=1) computes a pair's float part in one 256-bit register, block 0 in the low lanes and block 1
in the high ones, each lane with the operations of the 128-bit form, so its bytes do not change; h2f_scale converts a
normal fp16 block scale in four integer operations (h2f's normal branch, bit for bit; zero, subnormals, inf and NaN
still take h2f). Author's numbers (i7-3770): a one-token Q2_0 expert 0.975 ms on ggml-cpu, 0.487 ms on the AVX1 rows,
0.297 ms with the bit-plane form; decode on 2x RX 5700 XT 14.97 to 22.38 tok/s. Not measured by us (no AVX-only CPU);
q2_bitplane_parity (AVX1 form against its 128-bit legacy form) with STRATA_Q2_BITPLANE=1 is in the gate table.
From PR #5481 (nekorobi-0; its commit 0946bbd77), author kept. On a CPU with AVX-512 VNNI and
no VBMI (Cascade Lake) the SYCL engine's start-up line said "this CPU has no AVX-512: the expert kernels run on AVX-2",
even with STRATA_VNNI_TIER=1 on. The line now says which case it is: no AVX512-VNNI at all; the VNNI tier off or not
available; or (with the tier on and no VBMI) "AVX-512 VNNI tier enabled (no VBMI)". The cpu_vnni_ok() header comment
names the DQ requirement and the switch, and docs/DETAILS.md gains the STRATA_VNNI_TIER row (off by default: those
rows round differently from the AVX-2 rows). Log text and docs only; no computation changes. The two new lines are in
the results file's text list.
From PR #5748 (botBehavior; its commit 5d3f3cda6), author kept. STRATA_TAP_FILE (the residual-stream research dump)
was dropped without a message when the model ran on a layer split: Verifier::init cleared the path unless one verifier
held every layer. On a split each stage now parses STRATA_TAP_LAYERS (same rules as one card: sorted, unique, the last
layer excluded), keeps the layers inside its own range as the drafter's taps do, and the first stage opens the file,
writes the header with the whole layer list and, after the chain has run, gathers every stage's rows to the host
(gather_taps_host) and writes the window, on both the overlapped and the sequential return path. The file has the same
"STAP" v1 layout as one card. Two messages say so when the dump cannot be done (no layer in range; the drafter owns the
split's taps). With STRATA_TAP_FILE unset nothing new runs (tap_split_ stays false) and the one-card path is unchanged.
Author's check (2x RTX 5070 Ti, 2 stages): replies byte-identical with the dump on and off, rows against one card
at cosine 0.998 or more per layer in the median, no empty slots. Not run by us (it needs two cards and a model); the
CUDA build is checked on l620.
From PR #6166 (IvanAndreychikov; its commits 417611ae0 and 955198e42), author kept. A diagnostic for the non-finite
logits reports (#879, #6145): after the direct reader (read_direct) delivers an expert blob, the same byte ranges
are read twice through an independent buffered handle (one synchronous handle per thread and shard) and compared. A
mismatch is reported only when both buffered reads agree with each other and differ from the direct bytes, with the
shard, offsets, a hexdump and a third view from a read-only file mapping that says which side is wrong. A summary
line is printed at exit. STRATA_BLOB_VERIFY=1 arms it; STRATA_BLOB_VERIFY_DELAY_SEC holds it off during the start-up
fill. It is Windows-only code (the other systems compile to nothing), and unset it costs one atomic load per
blob. Both names are in the settings register (status research). Not run by us on a pack (no machine that shows the
fault); the Windows compile is checked on the owner PC build (see the gate table).
From PR #6246 (shjszwh; its commit 6407cc70b), author kept. The gfx906 source build (-DSTRATA_HIP_GFX906=ON)
stopped in dflash2.cpp and verify.cpp ("use of undeclared identifier cudaDeviceGetStreamPriorityRange" and
cudaStreamCreateWithPriority): strata_hip.h had no alias for either name. It now maps both to their hip
functions, next to the other cuda-to-hip device and stream names. The same gap was reported in #5233, #3986 and
#4766; those three fix it in dflash2.cpp alone (a macro test or a missing guard), which would leave the other callers
(mtp.cpp, verify.cpp) unmapped, so only the compat-layer fix is taken. No effect on a build that already compiled.
From PR #4536 (schmittcn; its commit 78f48d507), author kept. Cursor::need tested pos_ + n > size_. A GGUF whose
tensor-name (or key) length is near 2^64 made the sum wrap to a small number, so the check passed and the read went
on; only std::string's length_error stopped it. The test is now n > size_ - pos_ (pos_ never passes size_, so the
subtraction cannot wrap). gguf_reader_test gains a case with a name length of UINT64_MAX - 15: it is refused as
"unexpected end of file in header" (before the fix it ended in a different error).