mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1517] [CLOSED] Adaptive tier: evictions reach the device's residency table before the next window when the tier does not wait (fix) #3504
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#3504
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/1517
Author: @sergqwer
Created: 10/8/2026
Status: ❌ Closed
Base:
main← Head:pr/tier-evict-sync📝 Commits (1)
eb47960decode: the adaptive tier's evictions reach the device's residency table before the next window when the tier does not wait (STRATA_ADAPT_NOWAIT=1, STRATA_ADAPT_LAG > 1)📊 Changes
7 files changed (+292 additions, -9 deletions)
View changed files
📝
include/strata/core/expert_source.hpp(+12 -0)📝
include/strata/core/verify.hpp(+12 -2)📝
include/strata/kernels/verify_kernels.hpp(+3 -0)📝
src/core/expert_source.cpp(+7 -0)📝
src/core/verify.cpp(+4 -0)📝
src/kernels/cuda/verify_kernels.cu(+10 -0)📝
src/program/generate.cpp(+244 -7)📄 Description
When the adaptive tier does not wait for its copies (
STRATA_ADAPT_NOWAIT=1, orSTRATA_ADAPT_LAG> 1), the CPU can compute an evicted expert from a stale activation.The bug, as the code runs it:
adapt()marks an evicted expert non-resident inhost_resat once.d_resfollows inapply_pending, once the round's copies have landed. Without the wait, the next window runs before that.doorbell_publish_resreadsd_resand sees the evicted expert as still resident. When every routed expert of a layer looks resident, it does not publish the layer's activation.host_res, so it computes the evicted expert on the CPU, from the activation published for an earlier layer or window.Measured with a new check,
STRATA_ADAPT_CHECKRES=1. Before each window it reads the device tables back, compares them withhost_res, and counts the layer-windows that computed a CPU expert with no activation published. RTX 5090, IQ2_XS,--expert-cache 12000, 32K explain prompt, 600 tokens:STRATA_ADAPT_NOWAIT=1STRATA_ADAPT_NOWAIT=1, this PRSTRATA_ADAPT_LAG=2STRATA_ADAPT_LAG=2, this PRLAG=2is reproducible: two runs of each arm give the same tokens. The fix changes its answer from token 228 on.The change:
run,run_slot_rows,batch_launch,pl_launch; a layer split's stages too) runs a pre-launch hook. The hook patches the device tables from a list of the changed entries (res_patch, a small kernel on the verifier's stream that reads mapped memory). The whole table is uploaded instead when the list overflows, or when a device does not map it at the host's address.apply_pendingleaves its entries to the hook. A failed patch fails the window instead of launching with stale tables.--batch-groupswith a layer split publishes every activation instead (set_always_publish, which now also turns E-6's device plan off).--pipeline-windowskeeps its fence.STRATA_ADAPT_EVICT_SYNC=0restores the old behaviour.Default identity: with the default (the tier waits) no hook is installed. Tokens and first-token logits are identical to
d5ea7133(p2k, 200 tokens; 32K explain, 600 tokens;--expert-cache 12000 --pcie-frac 0.25).Cost under
STRATA_ADAPT_NOWAIT=1, 6,297 slots, 3 interleaved pairs: ms a round -1.1% (chat) and -1.2% (32K explain), i.e. noise.Not measured: multi-GPU layer split and peer / helper tiers (one card here; the hook runs per stage and per device, and each device's mapped alias is checked).
Found while working on an opt-in that admits the PCIe share's blobs into the VRAM tier:
STRATA_ADAPT_FETCH, branchpr-main/tier-fetch-admission. It builds on this fix and will follow as its own PR. On IQ2_XS with a 6,000-slot cache it measured chat +8% and 32K +4% decode.🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.