mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5440] [Engine] Split engine: the FNX_PF_STAGE_ROWS default (2048) makes 200-800-token prompts up to 2.5x slower when most routed experts live in RAM #3251
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#3251
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?
Originally created by @nabe2030 on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5440
Follow-up to #5187, as announced there.
Area
[Engine] (speed, kernels, models, the server and API)
What do you want to do?
Make the split engine's prompt-read path pick staging vs. reading in place by how many experts are actually non-resident, instead of by a fixed row count (
FNX_PF_STAGE_ROWS, default 2048). With most routed experts in RAM, the fixed default makes 200-800-token prompts the slowest ones.Derive the threshold from the non-resident share instead of a fixed row count.
prefill_passalready counts the non-resident experts per layer (n_ram, fromec.slot_of), andpf_stage_bytesknows the non-resident bytes, so a rough rule could be: stage when the non-resident bytes / PCIe bandwidth is below the expected in-place read time for this many rows (in place approaches "all non-resident experts" quickly as rows grow; about 780 rows already touch nearly all of them here). With every expert resident, the non-resident share is 0 and the current behaviour stays as it is. A simpler version would be a lower default whenever the non-resident share is above some level (on this box anything from 8 to 64 rows gave the same result for prompts of 200 tokens and up).Happy to test a patch on this box.
What do you do today instead?
We run with
FNX_PF_STAGE_ROWS=8. For an agent harness this matters on every turn: tool results and short follow-ups are exactly the 50-800-token prompts, so the default costs 0.7-3.7 s per request on this box.Evidence
Setup. 2x RTX 4060 Ti 16 GB (no P2P), Linux, all-cards split engine built for sm_89 from the PR #5258 branch (includes v0.2.11), Qwen3.8-Flash-Next IQ3_S,
FNX_ARENA=1 FNX_EXPERT_RAM_GIB=20 FNX_POOL_MIN_RESIDENT=384, so about 69% of the routed experts (17,047 of 24,576) stay in RAM. Context 8192,--batch 1, MTP,FNX_PF_TIMING=1, a different prompt each time, median of 3.What happens. In
Engine::prefillthe choice between reading the RAM-resident experts in place over PCIe and staging them into VRAM first istokens.size() >= stage_rows, withFNX_PF_STAGE_ROWSdefaulting to 2048. That fits a box where (almost) every expert is resident. Here, a pass read in place has to pull most of the non-resident experts over PCIe at low efficiency, so prompts below 2048 tokens are the slowest ones:FNX_PF_STAGE_ROWS=8Only the head pass (N-6 rows) changes: read in place it grows with the row count (2.2 s for 48 tokens, 5.7 s for 780), while staging costs about 1.6 s (each card copies 16.4-16.8 GiB) plus compute. The 6-row tail pass is read in place in both settings (0.26-0.36 s), which is the right choice for it. 0.2.10 gave the same numbers within 0.1-0.3 s, and the decision line is unchanged between the two versions.
@github-actions[bot] commented on GitHub (Nov 7, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
[GH-ISSUE #5440] Split engine: the FNX_PF_STAGE_ROWS default (2048) makes 200-800-token prompts up to 2.5x slower when most routed experts live in RAMto [GH-ISSUE #5440] [Engine] Split engine: the FNX_PF_STAGE_ROWS default (2048) makes 200-800-token prompts up to 2.5x slower when most routed experts live in RAM@github-actions[bot] commented on GitHub (Nov 7, 2026):
Thanks, this follows the format now.