Skip to content

[Performance] Add triton kernels for LoRA - #1471

Closed
Ying1123 wants to merge 2 commits into
mainfrom
lora_opt
Closed

Ying1123 wants to merge 2 commits into
mainfrom
lora_opt

Conversation

@Ying1123

@Ying1123 Ying1123 commented Sep 19, 2024 •

Copy link
Copy Markdown
Contributor

Move to #1728

@Ying1123
Ying1123 marked this pull request as draft September 19, 2024 09:20
@merrymercy merrymercy mentioned this pull request Sep 22, 2024
21 of 37 tasks
@merrymercy merrymercy closed this Oct 23, 2024
@merrymercy
merrymercy deleted the lora_opt branch October 23, 2024 06:27
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 17, 2026
…stays parked after the wake until its re-read completes

weg2xsn229 (P --max-running-requests 2, sgl-project#1470 flush join): the read
issued at the hold ended short (4095 of 98210; D reads DURING the flip
since sgl-project#1455, before P's write-through and storage backup land), the
sgl-project#1456 refetch was issued, and the wake queued the request anyway -- the
X gate refused it (W31 uncached 94117 > X 4096), P prefilled the same
prompt again, and the second read was complete (served 98210).  The
short prompt weg2-6-2 looped the same way (W53), and D wedged behind it.
_weg2_release_dormant_hold now queues only requests whose read is
complete; the others are parked in weg2_post_wake_settle with their sgl-project#1461
claim kept, re-read every 2 s by _weg2_refetch_one (the sgl-project#1456 body,
factored out) from _weg2_post_wake_settle_tick at every scheduling pass,
and queued when complete or after WEG2_POST_WAKE_SETTLE_S=20 s.
Tests: 1471 (3) + 1456 + 1445 + 1466 + 1470 -> 22 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 17, 2026
…record says otherwise

weg2xsn230: hold at 11:27:41, read short (4095 of 97870) at :46, refetch
issued at :46, wake at 11:28:07 released BOTH held requests (no sgl-project#1471
SETTLE line) and the X gate refused them (W31).  _weg2_note_store_shortfall
reads tree_cache.prefetch_loaded_tokens_by_reqid, and at the wake that
record is gone (pools restored), so the short read came back 'complete'.
_weg2_refetch_one now keeps req._1471_short from the last verdict and
answers 'reading' while no record exists for the rid.
Tests: 1471 + 1456 + 1445 -> 18 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 17, 2026
…sgl-project#1471 wake verdict exceptions logged

weg2xsn229-231 (P --max-running-requests 2): group D's read at the hold
delivers 4095 of ~98k tokens for 20+ s after P served the prompt, with the
L3 index on (xsn230) and off (xsn231), while P's flush reports every node
published.  No line named the first unreadable page or the path that
refused it, and no line gave a write-through's issue->ack latency.
sgl-project#1472 READ-TRACE (hicache_storage._readable_stems): first missing stem,
no-file vs partial, arena hits (rate-capped).  sgl-project#1472 WT-ACK
(_finish_write_through_ack): issue->ack latency per write-through and the
count still in flight.  The wake verdict's silent except in
_weg2_release_dormant_hold now logs the exception (sgl-project#1471 SETTLE n/a).
Tests: 1471/1470/1459/1386/1068 -> 75 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 17, 2026
…d covers the registered span

weg2xsn238 (running-req 2): hold 13:28:43, read short 4095 at :48, refetch
issued at :48, wake 13:29:44 released the request (no SETTLE line), X gate
W31 at :44, and PREFETCH-COMPLETE 97870 landed at :46 -- two seconds too
late.  sgl-project#1455 reads the host half in the sleep and loads the device half at
the wake, so at the wake the shortfall verdict is None while the record
still says 4095.  _weg2_refetch_one now answers 'reading' for a request
once seen short until prefetch_loaded_tokens_by_reqid[rid] covers
req._prefetch_span_tokens; the settle tick (sgl-project#1471) releases it then, or
after 20 s.  Tests: 1471/1456/1445 -> 18 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 17, 2026
…parked re-read can finish

weg2xsn239 (running-req 2, #1471c): 'sgl-project#1471 SETTLE 1 held request(s) parked'
at the wake, then 'SETTLE-RELEASE state=reading lapsed=True' after 20 s
and the X gate refused it.  The load-back acks that complete the re-read
are drained by tree_cache.check_hicache_events, called only from the
prefill scheduling path, which a parked request never reaches (xsn238
completed 2 s after the wake only because it was queued).  The settle
tick now drives the events itself while anything is parked.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 23, 2026
…ndet den Request ueberall, ein schlafendes D gibt nichts frei und bildet keinen Batch, der Stillstandszaehler startet am Wake (fnFL2x36: erster durchgelaufener P->D-Flip, D antwortete 503 mit 0 Token und starb im naechsten Zyklus)

x36 (587a0de + 10 % Reserve): D->P 11,2 s, P->D 11,1 s -- der erste
P->D-Flip seit x22, der bis zum Ende lief (Round-Robin-Ordnung, alle 18 Tags
auf D resumed, kein Segfault, keine Kreditwand). Danach die Kette:

  08:27:26 weg2-0-1 (8815 Token) auf dormant D GEHALTEN (sgl-project#1443)
  08:27:37 Wake-Fence; Store-Read 8704 von 8768 deliverable (P publiziert
           die letzte Seite zuletzt); Nachladung 'PREFETCH REFUSED
           reason=too_short need=64 threshold=256' -- auf jeder 2-s-Wieder-
           holung, fuer immer
  08:27:37 W88 Weg2StoreLoadNotProgressing no_progress_passes=64 -> 503,
           0 Token (die Paesse liefen im SCHLAF weiter: xsn344 startete nur
           die Wanduhr am Wake neu, nicht den Zaehler)
  08:27:41.. der Request blieb in der Post-Wake-Settle-Liste (sgl-project#1471), der
           W88-Exit raeumte nur die waiting_queue
  08:27:52 D->P (Epoche 3), D wieder dormant
  08:27:57 Settle-Grenze 20 s lapst -> Request 'so wie er ist' in die
           waiting_queue eines SCHLAFENDEN D -> Extend 111 Token auf
           pausierten Pools: Triton 'Pointer argument cannot be accessed
           (cpu tensor?)' TP1/TP2, illegal memory access TP0, D tot.

Vier Riegel, einer je Glied:
- unified_radix_cache._weg2_extent_topup: ein Read fuer eine rid unter
  #1461s gelockertem Claim-Gesetz (weg2_hold_rids: gehalten oder nach dem
  Wake geparkt) ist die Nachladung eines registrierten Extents; die
  Schwelle 256 bepreist frische Reads, nicht den Schwanz einer Uebergabe.
- scheduler._weg2_forget_held: der W88-Exit entfernt den Request aus Hold,
  Settle und weg2_hold_rids und markiert ihn terminal.
- _weg2_post_wake_settle_tick: bei weg2_dormant keine Freigabe (die
  Geparkten warten auf den naechsten Wake); get_new_batch_prefill: ein
  dormantes D bildet keinen Prefill-Batch, was auch immer in der Queue steht.
- _weg2_note_prefetch_progress: im Schlaf wird auch der Pass-Zaehler auf 0
  gesetzt; nach dem Wake gilt eine Gnadenfrist von einem Stall-Fenster
  (_weg2_last_wake_t, gestempelt beim DORMANT-cleared), in der nur die
  Wanduhr einen Read fuer tot erklaeren darf.

Nebenbefund x36: W22 (memory.current 92,78 / Marke 95,90) feuerte bei
Flipstart -- der groessere Store der Reserve (384 statt 348 Plaetze je
Layer) kostet Host-RAM; der Boot lief weiter. D->P: Kredit-Warten P
15,4 s (x35) -> 0,3 s (x36); zweiter D->P 3,4 s.

test_weg2_post_wake_settle_1471: der Harness-Fake nahm kein allow_reissue=
(xsn296) -- TypeError im Release las sich als 'queued as it is', beide
Requests freigegeben, der Park nie geprueft; behoben.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 25, 2026
…settles at the wake (sgl-project#1324 x sgl-project#1471)

RC2 metal (weg2rc2 D log): the in-flip GEN weg2-6-2 (4316 tokens; the store
delivered 4095, 221 short -- the xsn437 form) was held across the P phase.
At the wake sgl-project#1471 parked it ("read still short"), the settle tick re-read it
every pass, and every pass the sgl-project#1324 tail recompute (3453cc7) fired --
569 lines per rank of "STORE-SHORT TAIL RECOMPUTE ... admitted, D prefills
it" while the request stayed PARKED -- until the 20 s bound lapsed
("sgl-project#1471 SETTLE-RELEASE ... lapsed=True held_after_wake_s=20.1", 23:21:25).
Only then did the X gate admit it (uncached 221) and D prefill the tail;
it finished 24 s after the wake and held a D seat the sixth 100k park
request waited for. The recompute was wired into the deferral path but not
into the sgl-project#1471 settle verdict, and its line claimed an admission that the
settle hold overrode.

Fix: _weg2_store_tail_settles() (a module function, like the other tail
helpers, so no stand-in can miss it): a parked request whose short-read
stamp leaves a remainder <= X is settled -- in the wake verdict of
_weg2_release_dormant_hold and in _weg2_post_wake_settle_tick, both through
the existing group-min vote. Over X (weg2xsn229: 4095 of 98210) it keeps
waiting for its re-read, as sgl-project#1471 was built for; without the stamp, with
SGLANG_WEG2_STORE_SHORT_TAIL=0 or without server_args nothing changes. The
recompute line is rate-limited per request (1st, 2nd, 4th, ... occurrence;
k= in the line) and says "released to admission".

Tests (test27b.sh, no GPU): new test_weg2_store_short_tail_settle_rc2_0924.py
6 -- red on a9aedcd for the three behaviour tests (released at the wake,
tick releases before the bound, rate limit), the three guards (over X, no
stamp / switch off, stand-in without server_args) green before and after;
green here: 6 passed. Unchanged green: store_short_tail_xsn437 11,
hold_refetch_1456 5, hold_refetch_uniform_xsn296 3, handoff_keys_xsn329 5,
prefetch_gate_census_915 28. Red identically on a9aedcd (not new):
post_wake_settle_1471 2 (its harness lambda lacks allow_reissue),
wake_kv_first_xsn314 1.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 25, 2026
…in /weg2/state

Raising group D's W50 riegel to --x-ceiling-tokens also raised the bound of
D's two store-short tail paths (sgl-project#1324 TAIL RECOMPUTE, sgl-project#1471 settle), which
read the same --tp-prefill-max-tokens: a stalled store read's remainder up to
the ceiling would be recomputed on D, halting every running decode -- the
cost the front bounds by X_busy for SHORT grants. The launcher now hands D
SGLANG_WEG2_STORE_SHORT_TAIL_X = the launch X whenever the ceiling is above
it (store_short_tail_env; empty = D's env unchanged when the ceiling is
unset), and the scheduler prices both tail paths at min(riegel, that X)
(_weg2_store_short_tail_x). Law 4 is unaffected: D still never prefills
above its riegel.

/weg2/state carries x_busy_tokens and x_ceiling_tokens beside x_tokens for
the metal probe.

Tests (test27b.sh; a boot weg2rc6gg was live from 07:26Z, so the wrapper ran
them under incg): test_weg2_x_split_rc7_0925.py 50/50 (+ writer/reader of the
tail env, both directions, and the state fields); store-short tail suites
xsn437 + settle_rc2 17/17; affected set + those + state-dict users: 22 failed /
783 passed, the 22 = the unchanged RC6 baseline reds. /dev/shm: the new
weg2-xchg-1790321178 / weg2-arena-weg2rc6gg entries are the live boot's
(bisected: these test files create none) and were left alone.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…nter Profil-Schaltern

Picks (27B-Linie, Konflikte je Hunk gelesen und vereinigt):
- 9504997 e24f906 8c05eab 7684225: Idle-Politik (--d-short-drain-tokens,
  --d-hold-s; W153 N > X; --d-hold-s 0 = aus). Flags Default aus, Front-argv nur
  gesetzt -> NF-argv byte-gleich. Der 27B-Front-Parameter record_line bleibt draussen
  (kommt mit seinem Feature, s. S3).
- 3453cc7 e34b90f: Store-Short-Tail (sgl-project#1324 x sgl-project#1471); URC-Konflikt: NF-_topup
  und 27B-min_tokens komponiert (`prefetch_length < _min_len and not _topup`).
- e28c450: nur der Scheduler-Teil (_weg2_store_short_tail_x) wörtlich; Launcher
  store_short_tail_env und /weg2/state-Felder von Hand in der S4-Form.

RC7-X-Zusätze (vertagt aus S4) in der S4-Form (NF X-SOLO-Band, 27B X_busy = Bandboden):
- Pending.x_deferred: ein Bandrequest, den die Einzelgänger-Regel nach P schickt;
  Front._x_idle_regrant (moved/wait/none) serviert den Rückstau auf D, sobald D leer
  und ruhig ist; "wait" hält den D->P-Flip (Controller).
- X_busy-Deckel im Short-Drain (D belegt -> Bandboden, sonst X in Kraft) + Ruhefenster.
- _x_grants / X-BUSY-OVERRUN-Zähler (Review V (3)).
- store_short_tail_env: D-Env SGLANG_WEG2_STORE_SHORT_TAIL_X = Start-X, wenn D's Riegel
  darüber steht.

Schalter, Default je Profil (weg2/form.py, abgeleitet über switch_defaults):
- SGLANG_WEG2_X_IDLE_REGRANT (ModelProfile.x_split): qwen27b an, nextflash aus
  (9e36e21), ohne Form aus. Front und Launcher lesen ihn; aus = NF-Form exakt,
  kein Env-Zusatz in D.
- SGLANG_WEG2_STORE_SHORT_TAIL (ModelProfile.store_short_tail): qwen27b an,
  nextflash aus, ohne Form an (27B-Code-Default); explizite Werte wie 27B geparst.

Tests (test27b.sh): neu test_unify_s7_x_split.py 12/12; Idle-Suiten (4 Dateien) +
store_short_tail_settle + unify s2/s3/s4: 142 passed. test_weg2_store_short_tail_xsn437
braucht mamba_ckpt_utils.ANCHOR_INTERVAL_ENV (27B-Anker-Raster, Schritt 8).
dup_defs_gate: 0 neu.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…roject#1419 cap in raw tokens, PP0-authoritative hand-off keys, dormant-held rids keep their told

From the first agent boot with SGLANG_WEG2_TOLD_PROBE_TREE_KEY=1 (#1416d)
told > 0 is the normal case on P; the paths below had not run with told > 0
since 16.09. Base: desk/27b-twindedup-0926 8083d67 (TW, on unified f4639e8).

Path 1 (sgl-project#1419) -- DEFECT, two of them:
 a) the cap is RadixKey's RAW-token limit, told counts KEYS: on P's bigram tree
    a cap of told stopped one key short of the anchor told names; the match fell
    back to an earlier anchor. prefix_cap_tokens(tree, told) = told + bigram
    (same +1 as follower_limit_tokens), in admission and in H91's kept verdict.
    told 0 and unigram trees unchanged.
 b) the sgl-project#1400 record is span-relative (host insert rooted at last_host_node,
    TW's finding): a device head is lost to the cap, and a follower whose head
    is below a relative told registers [head, told), completes told-head and
    raises Weg2StoreToldMismatch -> rank exit (test: head 4096, store 98304,
    told=94208 own_prefix=90112). Fix = TW's absolute form for every request:
    told = PP0's registered head + span, anchor-clamped, record set (the twin
    code path), Weg2StoreTold(absolute=True), followers compare head + span.
    Switch SGLANG_WEG2_TOLD_ABSOLUTE, default = the tree-key switch (so
    TREE_KEY=1 brings it along; =0 keeps the relative form).
Path 2 (#1416b) with told > 0: protocol sound (record follows the clamp, both
    ranks admit at the clamped told); only the cap unit of path 1 was wrong.
Path 3 (sgl-project#1442): every rank read the hand-off file at its own registration time
    -> a file appearing/disappearing between PP0's intake and the follower's
    absorb splits the key source. Now PP0-authoritative: the told carries
    keys_digest (handoff_keys.chain_digest of the chain PP0 read with, "" =
    own hashes); the follower adopts it (adopt_pp0_decision) before any
    registration of that rid (absorb, paced Admit, intake); a follower that
    cannot reproduce PP0's chain reads own hashes and says
    "sgl-project#1442 HANDOFF-KEYS PP0-DISAGREE". The scheduler resolves through
    resolve_chain and the tree's own reader skips rids in WEG2_HANDOFF_OFF.
    Also: the #1416d probe placed the registry keys (sliced at the MATCHED head)
    at page 0; it now takes the request's chain from token 0.
Path 4 (sgl-project#1443/sgl-project#1455): release_memory_occupation sets weg2_dormant on either
    group; a rid PP0 took into the dormant hold (or the sgl-project#1471 settle) was
    dropped from held by pp0_publish and never got a told after the wake
    (weg2_store_told_pending on every rank for ever). Parked rids stay held and
    are published once the release queued them (both publish forms).

Tests (test27b.sh, PYTHONPATH=wt/python, CUDA_VISIBLE_DEVICES=""):
 red before the fix: test_weg2_store_told_positive_tk.py 15 failed / 3 passed
 green: 18 passed; with store_told_1400 (probe hand-off test now sets the
 request chain), paced_1416e, p_twin_defer, p_intake_h91a, handoff_1442,
 handoff_keys_xsn329, intake_stall_xsn272, unify_s5, burst_clock_h42c,
 multi_anchor_tails_h42: 127 passed.
 Mutants (each killed): no follower adopt (3), cap=told (6), parked ignored (3),
 absolute default off (4), probe from the registry (1), follower without the
 absolute mark (3), resolve ignores the off flag (3).
 test_prefetch_deferral_1068.py: 31 failed identically on the untouched base
 8083d67 (test double lacks _ple_admit_on_intake) -- not this change.

UNIFY (UN6, Operator 26.09. Vorrang): pick of desk/27b-toldpos-0926 (e5a52d8, TK, base 8083d67)
onto f4b6f21, clean (the 1416d test already carried TK's form). dup_defs_gate: 0 new. test27b.sh:
store_told_positive_tk + store_told_1400 + paced_1416e + p_twin_defer + p_intake_h91a + handoff_1442 +
handoff_keys_xsn329 + intake_stall_xsn272 + unify_s5 + burst_clock_h42c + multi_anchor_tails_h42 +
prefetch_deferral_1068: 169 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…an, never before it; PP0 never after publishing (sgl-project#1456/sgl-project#1471 on tp_size 1)

Follow-up to e5a52d8 path 4. Simulated with the SHIPPED scheduler methods
(_weg2_hold_refetch, _weg2_refetch_one, _weg2_release_dormant_hold,
_weg2_post_wake_settle_tick) on a PP0 and a follower double, told form armed
with SGLANG_WEG2_TOLD_PROBE_TREE_KEY=1 (absolute), tp_size 1 = no group MIN.

Sound (tests only): PP0's hold read answers zero, the sgl-project#1456 re-read tops it up
(and a hand-off file appears in between) -- nothing leaves the hold; after the
wake the follower registers exactly ONCE, with PP0's final told (98304) and
final keys_digest. Same when PP0 parks at the wake (sgl-project#1471) and publishes after
the settle, and for the paced read-ahead (#1416e): it leaves only after the
release. An unregistered follower is "complete" for the hold/settle and never
re-reads on its own.

Defect (red before the fix): _weg2_refetch_one re-issued _prefetch_kvcache(req)
WITHOUT limit_tokens. A follower that absorbs the told while its request is
still in the dormant hold (the Resume normally rides ahead of the told; a
lagging or W114-refused follower wake -- a LOCAL vote on tp_size 1 -- breaks
that) and whose told read answers short re-read to the prompt end, past told:
Weg2StoreToldMismatch at admission. Likewise a stale short record let a
follower start a told-less read, and a PP0 rid back in a hold after its told
was published could be re-read (PP0's record moves under the followers).
Fix: weg2_store_told.refetch_plan(scheduler, req) -- None off the told form
(byte-identical for group D / non-PP), REFETCH_SKIP for a follower without
told and for PP0 once published ("complete", no read), else the follower's
told limit (follower_limit_tokens) for the re-read. No log line changed.

Tests (test27b.sh, PYTHONPATH=wt/python, CUDA_VISIBLE_DEVICES=""):
 test_weg2_store_told_hold_tk.py: before the fix 3 failed / 3 passed, after 6 passed.
 With store_told_1400/positive_tk/paced_1416e, p_twin_defer, p_intake_h91a,
 handoff_1442, handoff_keys_xsn329, intake_stall_xsn272, unify_s5,
 burst_clock_h42c, multi_anchor_tails_h42, dormant_hold_1445, hold_refetch_1456,
 hold_refetch_uniform_xsn296, post_wake_settle_1471, store_short_tail_settle_rc2:
 181 passed. revoke_reissue_1479 (4), wake_kv_first_xsn314 (1),
 x36_settle_dormant (1) fail identically on e5a52d8 -- not this change.
 Mutants killed: follower re-read without limit (1), told-less follower
 re-read (1), PP0 re-read after publish (1).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…on the PP form, one final re-read of a zero hold read, told right after the wake

Agent-turn boots: prompt = the store's prefix + the new turn. Once PP0's hold
read had answered ZERO (write-through not landed / revoked), _1471_short stayed
set, the prompt's tail beyond the store (> 256 tokens, P's own prefill) kept the
read "short", and the wake parked PP0 in the sgl-project#1471 settle, re-reading every 2 s
until the 20-s bound -- 20 s per turn, PP0's told waiting with it.
_weg2_note_store_shortfall already answers None on PP for this reason ("a PP
group is the PRODUCER"); the settle path did not.

Fix (scheduler.py, module functions so no curated stand-in misses them):
_weg2_refetch_one on an AWAKE pp_size > 1 group (the wake's release and the
post-wake settle; the sleep's sgl-project#1456 top-up is unchanged) goes to
_weg2_producer_wake_verdict: always "complete" (never parked); a read still in
flight joins the queue as it is (told publish / prefetch gate wait for its
termination); a terminated ZERO answer gets ONE final re-read of what the store
holds now (no 2-s clock, only on tp_size 1 = no collective, with
weg2_store_told.refetch_plan: follower only the told span, PP0 only before
publishing). Group D (pp_size 1, the consumer) never enters it: byte-identical,
its settle still waits for P's write-through. New log tag "#TK WAKE-REREAD"
only; no existing log line changed.

Tests (test27b.sh, PYTHONPATH=wt/python, CUDA_VISIBLE_DEVICES=""):
 test_weg2_store_told_hold_tk.py: agent-turn form (store 95000 + 3000 new):
 PP0 released at the wake, no park, no re-read after the wake, told 95000 in
 the same pass, both ranks admit; zero read at the wake (flip < 2 s): one final
 re-read, released, told 98304; D consumer: same read parks and re-reads on the
 2-s clock as shipped. Before the fix the two P tests failed (wake() == 0,
 parked), the D test passed; after: 8 passed. Replaces last commit's
 "parked at the wake publishes after the settle" test (its premise was the
 park this commit removes).
 With the told / hand-off / hold / settle / intake set (1445, 1456, xsn296,
 1471, rc2 tail, ...): 183 passed; revoke_reissue_1479 (4),
 wake_kv_first_xsn314 (1), x36_settle_dormant (1) fail identically on
 e5a52d8 -- not this change.
 Mutants killed: re-read also a non-zero read (5), D takes the producer path
 (1), no final re-read of a zero answer (1).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…an, never before it; PP0 never after publishing (sgl-project#1456/sgl-project#1471 on tp_size 1)

Follow-up to e5a52d8 path 4. Simulated with the SHIPPED scheduler methods
(_weg2_hold_refetch, _weg2_refetch_one, _weg2_release_dormant_hold,
_weg2_post_wake_settle_tick) on a PP0 and a follower double, told form armed
with SGLANG_WEG2_TOLD_PROBE_TREE_KEY=1 (absolute), tp_size 1 = no group MIN.

Sound (tests only): PP0's hold read answers zero, the sgl-project#1456 re-read tops it up
(and a hand-off file appears in between) -- nothing leaves the hold; after the
wake the follower registers exactly ONCE, with PP0's final told (98304) and
final keys_digest. Same when PP0 parks at the wake (sgl-project#1471) and publishes after
the settle, and for the paced read-ahead (#1416e): it leaves only after the
release. An unregistered follower is "complete" for the hold/settle and never
re-reads on its own.

Defect (red before the fix): _weg2_refetch_one re-issued _prefetch_kvcache(req)
WITHOUT limit_tokens. A follower that absorbs the told while its request is
still in the dormant hold (the Resume normally rides ahead of the told; a
lagging or W114-refused follower wake -- a LOCAL vote on tp_size 1 -- breaks
that) and whose told read answers short re-read to the prompt end, past told:
Weg2StoreToldMismatch at admission. Likewise a stale short record let a
follower start a told-less read, and a PP0 rid back in a hold after its told
was published could be re-read (PP0's record moves under the followers).
Fix: weg2_store_told.refetch_plan(scheduler, req) -- None off the told form
(byte-identical for group D / non-PP), REFETCH_SKIP for a follower without
told and for PP0 once published ("complete", no read), else the follower's
told limit (follower_limit_tokens) for the re-read. No log line changed.

Tests (test27b.sh, PYTHONPATH=wt/python, CUDA_VISIBLE_DEVICES=""):
 test_weg2_store_told_hold_tk.py: before the fix 3 failed / 3 passed, after 6 passed.
 With store_told_1400/positive_tk/paced_1416e, p_twin_defer, p_intake_h91a,
 handoff_1442, handoff_keys_xsn329, intake_stall_xsn272, unify_s5,
 burst_clock_h42c, multi_anchor_tails_h42, dormant_hold_1445, hold_refetch_1456,
 hold_refetch_uniform_xsn296, post_wake_settle_1471, store_short_tail_settle_rc2:
 181 passed. revoke_reissue_1479 (4), wake_kv_first_xsn314 (1),
 x36_settle_dormant (1) fail identically on e5a52d8 -- not this change.
 Mutants killed: follower re-read without limit (1), told-less follower
 re-read (1), PP0 re-read after publish (1).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…on the PP form, one final re-read of a zero hold read, told right after the wake

Agent-turn boots: prompt = the store's prefix + the new turn. Once PP0's hold
read had answered ZERO (write-through not landed / revoked), _1471_short stayed
set, the prompt's tail beyond the store (> 256 tokens, P's own prefill) kept the
read "short", and the wake parked PP0 in the sgl-project#1471 settle, re-reading every 2 s
until the 20-s bound -- 20 s per turn, PP0's told waiting with it.
_weg2_note_store_shortfall already answers None on PP for this reason ("a PP
group is the PRODUCER"); the settle path did not.

Fix (scheduler.py, module functions so no curated stand-in misses them):
_weg2_refetch_one on an AWAKE pp_size > 1 group (the wake's release and the
post-wake settle; the sleep's sgl-project#1456 top-up is unchanged) goes to
_weg2_producer_wake_verdict: always "complete" (never parked); a read still in
flight joins the queue as it is (told publish / prefetch gate wait for its
termination); a terminated ZERO answer gets ONE final re-read of what the store
holds now (no 2-s clock, only on tp_size 1 = no collective, with
weg2_store_told.refetch_plan: follower only the told span, PP0 only before
publishing). Group D (pp_size 1, the consumer) never enters it: byte-identical,
its settle still waits for P's write-through. New log tag "#TK WAKE-REREAD"
only; no existing log line changed.

Tests (test27b.sh, PYTHONPATH=wt/python, CUDA_VISIBLE_DEVICES=""):
 test_weg2_store_told_hold_tk.py: agent-turn form (store 95000 + 3000 new):
 PP0 released at the wake, no park, no re-read after the wake, told 95000 in
 the same pass, both ranks admit; zero read at the wake (flip < 2 s): one final
 re-read, released, told 98304; D consumer: same read parks and re-reads on the
 2-s clock as shipped. Before the fix the two P tests failed (wake() == 0,
 parked), the D test passed; after: 8 passed. Replaces last commit's
 "parked at the wake publishes after the settle" test (its premise was the
 park this commit removes).
 With the told / hand-off / hold / settle / intake set (1445, 1456, xsn296,
 1471, rc2 tail, ...): 183 passed; revoke_reissue_1479 (4),
 wake_kv_first_xsn314 (1), x36_settle_dormant (1) fail identically on
 e5a52d8 -- not this change.
 Mutants killed: re-read also a non-zero read (5), D takes the producer path
 (1), no final re-read of a zero answer (1).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…t enter the sgl-project#1443 hold (intake-only) or the sgl-project#1471 settle (hold-release-only) -- comment corrected

Checked at b3180fb (weg2_store_told unchanged since 2bddf04): TK path 4
keeps a parked rid in held and (b) never publishes it; no waiting_queue path
re-inserts a rid without intake except the hold/settle releases.
Tests: test_weg2_told_group_fallback_pf + paced_1416e + hold_tk: 35 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…D gehalten und zaehlt fuer die Front als geparkt -- der Drain wartet nicht mehr seinen ganzen Decode ab

Rest aus dem H91c2-Bericht. Ein Hand-off steht schon in D.outstanding (leg 2
gesendet), hat den D-Scheduler zum Park-Zeitpunkt aber noch nicht erreicht
(Tokenizer / HTTP-Pipe; die Kontroll-RPC ueberholt ihn). Er steht in keiner
der beiden Listen der Park-Antwort (parked / held).

Geprueft, ob D's Park-Barriere ihn schon faengt: nein. admit_d=False (Front)
haelt nur NEUE Hand-offs zurueck, und die Park-Barriere auf D
(d_seats.admission_gate) liest die Warteschlange und die pending-outside-
Listen (Post-Wake-Settle, Dormant-Hold), nie weg2_d_parked -- nach dem Park
ist dort nichts geparkt, das Gate liefert keine Barriere, der Nachzuegler
wird im naechsten Pass zugelassen und bis zum Ende dekodiert. Die Front
fuehrte ihn in still_running, der D->P-Drain wartete darauf (schlimmstenfalls
das ganze Fenster, dann W1b-Abbruch per rid).

Fix, beide Seiten, ein Protokollfeld:
- D (d_park_runtime): park_running oeffnet einen Late-Hold (Stempel = der
  Park), wenn der sgl-project#1443-Dormant-Hold scharf ist; hold_late_arrival nimmt
  jede NEUE Ankunft (nie eine Wiedereinreihung) bis zum Schlaf in
  weg2_d_parked auf (held, ohne Park-Site, hinter den Geparkten) statt in
  die Warteschlange. hold_parked (Schlaf) und park_tick (Wiedereinreihung
  wach) schliessen ihn. Requeue-Uhr des Nachzueglers = die des Parks.
  Zeile 'WEG2-D-PARK late-hold rid=..'. Antwort traegt late_hold=true.
- Scheduler: _add_request_to_queue delegiert nach dem Dormant-Hold und vor
  der Warteschlange an _weg2_d_park_hold_late (nur is_retracted=False);
  handle_weg2_park_running uebergibt _weg2_dormant_admit_armed().
- io_struct.Weg2ParkRunningReqOutput.late_hold, /weg2/park_running gibt es
  aus.
- Front: phase_policy.park_late_hold liest das Feld streng (nur true bei
  200); dann zaehlen die rids, die nach der Antwort noch im Flip-Ledger
  stehen, als geparkt (gleicher Stempel), Zaehler d_parked_in_flight,
  PARK-RUNNING ... in_flight_held=[..]. Ohne das Feld (alter D, sgl-project#1443 aus)
  wie bisher: der Drain wartet.
Warum nur mit sgl-project#1443: ohne Dormant-Hold wuerde ein erst NACH dem Schlaf
ankommender Nachzuegler mit W25 abgewiesen; D verspricht dann nichts.
Ebenso nicht bei offenem sgl-project#1471-Post-Wake-Settle: der entlaesst direkt in die
Warteschlange (nicht ueber die Intake), D wuerde ihn fahren, waehrend die
Front ihn als geparkt zaehlte (Settle-Grenze 20 s << Wartegrenze: selten).

Rang-neutral: der Park ist ein Broadcast-Kontrollrequest, die Ankunfts-
reihenfolge ist die der Gruppe -- jeder Rang haelt dieselben Nachzuegler,
kein Kollektiv. Modell-neutral. Nur der geschaltete H91-Pfad
(SGLANG_WEG2_D_PARK, --d-wait-bound-s > 0), kein Schalter.

Tests test_weg2_park_wait_h91c3 (H91c3-2, 9; dazu test_weg2_d_park_scheduler_h91b.test_wiring_park_running_route_and_rpc auf die neue Handler-Zeile nachgezogen): das Rennen am Front-Harness
(Hand-off in der Pipe, dann Park: Flip < 2 s statt Drain-Fenster + W1b,
parked_n=2 beim naechsten Wake), alter D ohne late_hold unveraendert, D-Seite
(Halt, Requeue-Uhr, Schlaf, sgl-project#1443 aus, Settle offen, drei Raenge), Feldleser, Verdrahtung.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…ithheld-Posten des Idle-Ledgers, kein Leck -- fnFL2h91bb2 starb am ersten Idle nach dem ersten n=1-Wake

Befund (Boot fnFL2h91bb2, Baum e17bd54 = erster Metallboot mit H95c, D-Log
/spinning/evidence-665-f1/boot_weg2_fnFL2h91bb2_e17bd548b5_0926_142251.D.log):
der erste 97k-Flip P->D weckt D um 14:31:00 mit 'WEG2 D-PHASE-SEATS (H95)
... handoff_n=1 -> n=1 of cap 6' (Z. 14022) und 'WEG2 D-SEAT-VRAM (H95c) n=1
... mamba_slots=1..7' (Z. 14057); das erste on_idle danach wirft auf ALLEN
DREI Raengen (Z. 14100-14163):
  [mamba] total=38, available=7, evictable=0, withheld=0, ...
          leaked_mamba_pages={8, ..., 38} (alle slot_used=False, releaser none)
D tot, Boot tot.

Wurzel: MambaSlotAllocator.set_phase_limit (H95c, allocator/mamba.py) haelt
die Slots ueber L(n) in _phase_withheld -- frei, ohne Besitzer, ohne Seiten --
und SchedulerInvariantChecker._check_mamba_pool gab dem Ledger withheld=0.
31 freie Slots standen weder in available noch in withheld und zaehlten als
verloren. Der KV-Pool hat fuer genau diese Klasse seit sgl-project#656/sgl-project#790 den Posten
withheld (residency_withheld_slots); der Mamba-Zwilling fehlte.

Fix (kein Schalter, keine Kollektive):
- allocator/mamba.py: phase_withheld_slots (Anzahl) und phase_withheld_ids()
  veroeffentlichen den zurueckgehaltenen Satz.
- invariant_checker.py: _mamba_phase_withheld liefert den Posten mit Namen
  (', withheld_by=d-seat-phase(H95c) limit=1..L'); _check_mamba_pool und die
  aktive Haelfte des int8-Ledgers fuehren ihn als withheld-Term; die sgl-project#924-
  Belegung rechnet ihn auf der Kreditseite (ein zurueckgehaltener Slot, den
  der Baum noch nennt, ist Aliasing); die Doppel-Frei-Zensur
  (_mamba_double_claimed) nimmt die zurueckgehaltenen Ids zur Freiliste (ein
  Duplikat dort bleibt benannt toedlich); die Leck-Diagnose zaehlt sie als
  frei, nennt also nur echte Verluste.
- Echtes Leck innerhalb der Sitze bleibt Alarm: zurueckgehalten wird nur ueber
  dem Limit, und set_phase_limit verweigert, solange darueber ein Slot lebt --
  ein in 1..L verlorener Slot fehlt weiter in available + evictable + withheld.
- Rang-einheitlich: Limit und Satz sind Funktionen der Wake-Anfrage und des
  eigenen Ledgers, jeder Rang liest denselben Term.

Tests: neu test/registered/unit/weg2/test_weg2_d_seat_withheld_h95d.py (8,
echter Allocator + UnifiedRadixCache + Checker auf CPU): bb2-Form (38 Slots,
n=1, 7 frei) ohne Alarm mit benanntem withheld=31; echtes Leck in 1..7
bleibt Alarm und die Diagnose nennt genau diesen Slot; Duplikat im
zurueckgehaltenen Satz benannt toedlich; zurueckgehaltener Slot im Baum =
sgl-project#924-Aliasing; n=6 ohne Posten; n=6 -> n=1 -> n=3 ueber zwei Wakes mit
bedienten Requests und gecachten Ankern; drei Raenge gleicher Befund. Auf
e17bd54 7 rot / 1 gruen (n=6), mit Fix 8 gruen. Betroffene Suiten (18
Dateien: 924/912/927/929/827/841/gdn_slot_executor, idle_census_1262,
kv_page_invariants, kv_backing_relief_631, tree_drop_856, q0, pingpong,
H95c, slot_trail_1467, train2_fix2_1264): Basis 12 rot (7 davon der neue
Test), Fix 5 rot -- die 5 Altlasten test_mamba_double_free_924
(erwarten den per sgl-project#969 CUT C geloeschten double_owned=-Term) identisch.

Nebenbefund, nicht Teil des Fixes: '#1028B FETCH CAP ... mamba (0,-1)' und
'#1035c ... cause=CAPPED by=mamba' (Z. 14055/14056, schon 14:30:58 vor dem
Wake und damit vor dem Slot-Limit) sind keine H95-Folge: die Arena hielt beim
Wake erst 192 von 1528 Seiten (sgl-project#1439 ARENA-PRESENT leading_complete=192,
complete=264), die Mamba-Anker liegen am Ende (h91v1: deepest_idx 1527 bei
1528/1528), also kein Anker im Bereich; sgl-project#1471 SETTLE parkt den Request wie in
h91v1 (dort SETTLE-RELEASE 0,3 s spaeter). bb2 starb am Ledger, bevor der
Settle loslassen konnte.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…t enter the sgl-project#1443 hold (intake-only) or the sgl-project#1471 settle (hold-release-only) -- comment corrected

Checked at b3180fb (weg2_store_told unchanged since 2bddf04): TK path 4
keeps a parked rid in held and (b) never publishes it; no waiting_queue path
re-inserts a rid without intake except the hold/settle releases.
Tests: test_weg2_told_group_fallback_pf + paced_1416e + hold_tk: 35 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 26, 2026
…aumaufbau -- fnFL2h91bb2 schrieb vom 97k-Flip nur 192 von 1528 Seiten

Befund (Auftrag AW): im ersten 97k-Flip P->D von fnFL2h91bb2 (e17bd54) war die
Arena beim D-Wake nicht "noch nicht", sondern NIE fertig geschrieben. P-Log Z. 2577
(14:25:54): 'MAMBA-FLOOR pool=32 floor=32 retention_budget=0 (8 running requests x
(1 active + 1 ping-pong + 1 donation + 1 pinned checkpoint) = 8 x 4 = 32 slots) --
every mamba host backup will be declined' -- nur gesagt, nicht verweigert. Ab Chunk 2
(Z. 15270-15275, 14:30:41) 'mamba write-through pin budget reached (0 in flight,
budget=0, pool=32)', 'sgl-project#1421 BACKUP-REFUSED why=mamba_pin node=9' (Chunk-1-Endknoten,
der erste mit Mamba-Wert) und danach 'parent_unbacked' fuer die ganze Kette;
RETAIN-PUBLISH issued=0 refused=217, keine MAMBA-ARENA-Zeile. In der Arena landeten
nur die drei ankerlosen Stuecke von Chunk 1 = 192 Seiten -> D 'sgl-project#1439 ARENA-PRESENT
leading_complete=192', '#1028B FETCH CAP mamba (0,-1)', '#1035c CAPPED by=mamba',
'sgl-project#1471 SETTLE read still short'. h91v1 (39fd662): pool=24 floor=16 budget=8, kein
Refuse, 1528/1528, SETTLE-RELEASE nach 0,3 s. Das Arm-Extra '--max-mamba-cache-size
32' rechnete 2 Slots je Sitz ('haelt das Pin-Budget bei 16'), die Laufzeit rechnet 4:
write_back verhindert den sgl-project#755-Reorder-Rabatt (braucht write_through) und damit auch
nach 20 s kurz aus, der zweite Prefill wird genauso verweigert (xsn127-134: dieselbe
Klasse bei Budget 1).

Fix: UnifiedRadixCache._refuse_weg2_p_mamba_retention_zero nach der MAMBA-FLOOR-Zeile
(ausserhalb deren breitem except): auf SGLANG_WEG2_GROUP=P mit hierarchischem Cache
und _mamba_pin_budget == 0 -- genau die Zahl, gegen die die Pin-Zulassung spaeter
vergleicht, keine zweite Herleitung -- benannter Stopp Weg2PMambaRetentionZero mit
Rechnung, Mindestwert (Sitze x Slots + 1), Referenzwert (Budget 8 wie h91v1) und
maximal tragbarer Sitzzahl. Gruppe D und Nicht-weg2 behalten die sgl-project#773-Haltung (Budget
0 wird nur gesagt). mamba_pool_floor.weg2_p_mamba_retention_refusal dokumentiert die
4 Slots je Sitz und die write_back-Frage. Kein Schalter.

Tests test_weg2_p_mamba_retention_h113 (5, echter UnifiedRadixCache auf CPU):
bb2-Form (P, 8 Sitze, Pool 32) verweigert benannt; h91v1-Form (4/24) und bb2 mit
Pool 40 bauen mit Budget 8; D und Nicht-weg2 bauen mit Budget 0; 4/3/2 Slots je Sitz
fuer write_back / write_through+Reorder / +Ack-Release.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…e does not bar newcomers

Findings of the first metal runs of profile 27b-park-draft (rc12g-flat, 27.09.):

(b) dkr27bparkdraftbar1w209270712 epoch 28, flip D->P 67.43 s (drain 65.7 s): two BAND requests
    (weg2-28-62 uncached 4172, weg2-28-65 4370; X_busy 4096 < u <= live X 7290) were queued by the
    RC7-X busy/idle split (Pending.x_deferred) while D decoded. The immediate trigger compared them
    with the live X (tp_prefill_max_tokens) and never fired; 45 s later WEG2-FAIRNESS closed admission
    and flip() drained two agent decodes (6198 / 11133 tokens) instead of parking.
    1. phase_policy.needs_p(x_deferred=True) fires: the X in force while D decodes is X_busy.
    2. front: under the immediate park a D->P flip with running decodes parks first
       (cause=before-flip; counter park_immediate_before-flip), whatever decided the flip
       (fairness, economics, closed admission). FIRED line now names cause, X_busy, x_deferred.
(a) dkr27bparkdraftbar1w209270645 park probe, B-TTFT 26.8-27.1 s = 6.3 s front (park 0.1 +
    flip 1.8 + P leg 1 2.5 + flip 1.8) + 20.1 s on D: A's hold read answered ZERO (sgl-project#1478 shape,
    deliverable=0 -> no sgl-project#1324 stamp, RETAIN cache_len=256 of 417, READ-TRACE asked=161 readable=0)
    -> sgl-project#1471 SETTLE held A the whole bound (SETTLE-RELEASE lapsed=True 20.1 s) and the park's
    admission barrier held B (20477 tokens loaded at the wake) behind A; A was then prefilled
    from 0 (418 tokens). A finish=length = the probe's max_tokens 3000, not a defect.
    3. d_park_runtime.admission: immediate park alone -> a settle-held parked request does not
       bar newcomers (NF standard form unchanged).
    4. scheduler._weg2_store_tail_settles: a zero answer (_1471_short, no stamp) settles when the
       WHOLE span fits in X (law 4 holds); over X it still waits (weg2xsn229 unchanged).
       store_short_tail is the qwen27b profile's switch (NF off).

Tests (test27b.sh, CPU): NEW test_27b_park2_metal_0927.py 10 passed; on base 3e97ef0
(git archive) 4 failed (one per defect) / 6 passed (unchanged-path pins: switch off drains,
queued parked first, NF barrier, zero answer over X, unmarked, stamped remainder).
Affected set (152 files): head 2463 passed / 21 failed, base 2456 / 28; 0 new red; green now =
the 4 above + corridor_instrument_0908 BootArmTest x3 (subprocess, flaky on base).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
… park retained

Metal dkr27bparkdraftbar1w209270645 (27B, rid weg2-2-5) and dkrnfh91bar1dauer09270859 (NF,
weg2-1-13 / weg2-6-29): the same root on both models, so the repair is model-neutral.

WHY 256 OF 417. park_running retracts with retain=True; cache_finished_req inserts min() of the
components' retention lengths. With --mamba-scheduler-strategy extra_buffer the mamba component
answers req.mamba_last_track_seqlen, the last DECODE TRACK point (multiple of
--mamba-track-interval 256): sgl-project#1469 RETAIN token_ids_len=417 cache_len=256 (NF 47262 -> 47104,
45697 -> 45568). The KV above it is freed and never written (sgl-project#1439 census of the 416 keys:
255 COMPLETE, 161 state 0). 256 IS the last valid mamba anchor; KV beyond it cannot be resumed
without a state and is recomputed anyway -- correct, not the defect.

WHY THE REST WAS NOT READABLE -- never written, and asked for anyway. The dormant-hold read and
the sgl-project#1471 settle registered the request's WHOLE context (417 / 47262 tokens), a span the store
can never complete:
  * NF: prefetch INCOMPLETE delivered=47104 deliverable=47232, every re-read of the 128 declined
    below the threshold (vote_negative), SETTLE-RELEASE lapsed held_after_wake_s=20.0;
  * 27B: the store held 255 bigram pages -- one under prefetch_threshold 256 -- and the prefetch
    thread revoked every read (storage_hit_count < prefetch_threshold), record materialized 0,
    four sgl-project#1456 zero-answers, held_after_wake_s=20.1; after the lapse the fresh read (hand-off keys
    dropped at the wake) answered sgl-project#1035 R13 EMPTY keys=417 and D prefilled all 418 tokens.

THE REPAIR (SGLANG_WEG2_PARK_READ_CAP, default on; 0 = the old read byte for byte):
  * cache_finished_req stamps the raw token span of the key it inserted (weg2/d_park_read.py
    RETAINED_ATTR; bigram = units + 1); park_running clears a stale stamp before the retraction and
    stamps (retained, request length) on every parked request, one line WEG2-D-PARK RETAINED;
  * _prefetch_kvcache ends the store read of a request whose length has not changed since the park
    at that span (after the fork cap): the read lands COMPLETE, nothing to settle, the resume's
    extend computes the tail (< one track interval);
  * that read may be smaller than the threshold (min_tokens=1), and the controller now honours a
    caller's floor on the store hit too (managers/weg2_min_hit.py, registered before the operation
    is queued, consumed once, never raises the threshold) -- the same second-threshold gate had also
    defeated xsn437's sub-threshold tail re-read.
All terms are functions of the request ids and the retained key (identical RETAIN on TP0/1/2 on
both models, Form A workers included) -- no collective, no file.

Not changed: the retain itself (a live-state anchor at the park would need sgl-project#747's grid rule
lifted); PK2's zero-read settle stays as the net.

Tests: test_27b_park_retain_read_0927.py 13 (retained span arithmetic bigram/plain, read span ==
stored units, cap inert once the request grows, switch off/no stamp = old read, controller floor
lowers once never raises + metal numbers 255<256, bounded table, park stamps/clears/logs, REAL
UnifiedRadixCache+MambaComponent: stamp == what the tree holds with a 16-of-21 track cap and the
KV above freed, wiring order). Mutant (stamp the whole span) caught. Affected suites per file
(weg2 park/hold/settle/refetch/store-short, mamba anchor, prefetch gate/participation/generation,
controller reset): branch 380 passed / 8 failed, base 9417507 367 / 8 -- the same 8
(mamba_anchor_seams_747 x1, prefetch_completion_generation_905 x1, participation_desync_580 x6)
fail identically on the base; test_unified_radix_cache_unittest exceeds the 3G test cgroup on both.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…ject#1324 delivered stamp

Metal rc12k27 b23 (dkr27bparkodirectdraftbar1w2309270957), rid weg2-24-100: cycle 10:22:21 resumed
from host_hit=79103; at the park 10:23:05 the new hold read answered zero (sgl-project#1456 HOLD-REFETCH
reason=zero-answer n=3,4), yet the wake settle released it -- "sgl-project#1471 SETTLE-TAIL delivered=79103
remainder=1405" read the stamp the PREVIOUS cycle's read had left on the request
(req._weg2_store_delivered is set by _weg2_note_store_shortfall and never cleared). Its admission
found nothing (PHASE-PURITY state=cold host_hit=0), X-GATE uncached=80508 X=12288 -> W31 -> W50
mid-stream, the client's stream died (745 s into it).

park_running now clears the stamp for every request it parks: the flip park opens a new read cycle,
and the settle decides from this cycle's own read (set again by _weg2_note_store_shortfall). A
request without a stamp is unchanged.

Tests: test_27b_park_stale_delivered_0927.py (the park clears 79103, leaves an unstamped request
untouched; remainder/tail-min read None afterwards). With d_park_scheduler_h91b, park_retain_read,
park_immediate: 68 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…cht läuft, hält über den Flip keine Arena-Referenz -- Ordnung statt Pin, L3-Kopie im Hintergrund, Referenz erst beim Wake, Host-Zeilen nach dem Load-back zurück (Worker-Spiegel per R12 STATE)

rc12s dkrnfh91dprbar1dauer09271719, D-TP0 17:32:40 (tmp/r989/befund_248_park_l2_pinnt.md): ARENA-REF-HOLDERS n=7 tree=1231 tree_in_use=3982 sum=5213 own_held=5213 -- ein SCHLAFENDES D hielt 5213 von 5461 KV-Arena-Slots per Referenz: die Schlaf-Vorabholung (sgl-project#1443/sgl-project#1455) von 2 Geparkten (1292 Seiten) und 3 im Schlaf eingetroffenen Wartenden (3921). P fand "no free slot" (17:32:21-58, 17:35:18-25), BACKUP-REFUSED arena_claim, parent_unbacked-Kaskade, 4 leere 200 (W50 re-route impossible). Einen Weg "gehalten -> L3 -> frei" gab es nicht (Arena-Eviction nimmt nur Unreferenzierte, der Claim gibt ohne I/O frei, L3 hielt 96 MiB). Nach dem Wake hielt D die geladenen Spannen weiter als tree=5213 bis zum nächsten Reset; auf den Form-A-Workern wuchs derselbe Bestand als byteless Spiegelzeilen im festen 353573-Zeilen-Pool bis zum Reset (sgl-project#249: R12 SHADOW-OWN-EVICT-REFUSED n=1->592, Vote-MIN -> sgl-project#915 TRUNCATED -> W88).

Fix (Form, keine Reserve, keine größere Arena; Schalter SGLANG_WEG2_ENABLE_PARK_L3, Default an, nur Gruppe D; aus = alter Pfad):
1. Referenz erst beim Wake (weg2.park_l3): der Dormant-Hold-Intake schlägt nur nach (P-Kette auf den Request), keine Store-Lesung, keine Referenz, kein Pin im Schlaf. Die Lesung läuft bei sgl-project#1443 DORMANT-RELEASE in Hold-Reihenfolge auf jedem Rang (issue_deferred_reads), das sgl-project#1471-Settle gibt frei, wenn komplett.
2. Park als Ordnung: park_running markiert jeden Geparkten (handoff_pending Rolle "park", Kette in der Marke, mark_park); keep_for liest pending + park, Parks zuerst.
3. L3-Kopie im Hintergrund: Thread weg2-park-demote (D, attn-Rang 0, nie Scheduler-Thread) kopiert gehaltene Seiten per HiCacheFile.arena_copy_to_disk nach L3 OHNE Freigabe -- über den bestehenden Evictor (reserve/commit/abort, 150-GB-Kappe), kein eigener Größen-, Sweep- oder Verzeichnispfad.
4. Claim in drei Stufen, weiter ohne I/O (arena_pool._evict_for_claim): (i) unreferenziert+ungehalten, (ii) gehalten MIT L3-Kopie (frei, arena_fill_from_disk liest zurück), (iii) gehalten ohne Kopie -> benannt HANDOFF-LOST / PARK-LOST. sgl-project#1427 ARENA-DROP nennt stages=i:,ii:,iii:.
5. Nach dem Load-back gibt TP0 die KV-Host-Zeilen des geladenen Pfads zurück (park_l3.release_loaded_host aus loading_check; Seite bleibt COMPLETE in der Arena, Mamba-Anker bleibt), mit R12 STATE je Knoten -> die Worker-Spiegelzeilen gehen beim nächsten Broadcast mit. form_a_host_shadow._reconcile lässt dabei den Anker stehen, wenn TP0 ihn hält (vorher riss ein KV-Verdikt den Anker mit -> SHADOW-SHORT im nächsten Zyklus).
6. PA-Naht (TEILPARKEN_notiz_0927.md §5): handoff_pending.keep_role(rid, "park", page_range=(a,b), page_keys=, page_size=) -> Zahl der Seiten aus [a,b), die zuerst in die Demotion gehen (rang-gleich); keep_role(rid, None) idempotent; keep_state(rid, tree=None) -> {device, l2, l3, pages}; register_pool. Wirft nie.
Instrument: sgl-project#248 HOLD-LOOKUP, WAKE-READ, PARK-MARK, PARK-DEMOTE, KEEP-ROLE, LOADED-HOST-RELEASE; HOLDERS park_kept/handoff_kept.

Tests: test_weg2_park_l3_248 (17: Hold ohne Referenz, Wake-Lesung + Settle, Park-Marke, Claim-Stufen, L3 bytegleich zurück, Demotion ohne Freigabe, 3 Ränge gleiche Keep-Liste, keep_role/keep_state/Teilpark), test_park_l3_loaded_host_r12_248 (5: Metall-Form Load-back -> TP0 und Worker (0,1), Worker-Pool ohne Ratsche über 5 Park/Resume-Zyklen, Worker gibt nie selbst frei, Host-Lock/Host-Blatt bleiben, Schalter aus/Gruppe P = alt). Rot auf 27e1d90738, grün mit Fix. Nachbarsuiten: siehe Bericht, 0 neue Rote.

Metall-Abnahme: own_held(D) im Schlaf ~0; 0x no free slot / BACKUP-REFUSED arena_claim über >=3 Park-Zyklen bei Stau >=5; PARK-DEMOTE vorhanden, Rückkehr per sgl-project#1433 L3->L2 fill digest=match; W50 re-route impossible = 0; LOADED-HOST-RELEASE nach Load-back; R12 SHADOW-OWN-EVICT-REFUSED ohne Ratsche; Flipzeit gegen rc12t prüfen (Wake-Lesung statt Schlaf-Lesung).
(cherry picked from commit 3a339b714dc8b3ba6079ce149cf0442995fd4977)
(cherry picked from commit b606ec3b7283ea679b5f06aa01bec1789b9aed59)
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…with a writer the settle hold waits for its ack instead of re-reading every 2 s

NF rc12z17-s0 (103bfdf, D log boot ...09281111): weg2-2-17 (41021 tokens, route=short straight to D) read 40512 of 40960 at the wake 11:18:00, then 'sgl-project#1456 HOLD-REFETCH zero-answer' n=2..4 every 2 s beside 'sgl-project#1442 HANDOFF-KEYS NONE registry=[]' and 'sgl-project#1472 READ-TRACE why=no-file', until 'sgl-project#1471 SETTLE-RELEASE lapsed=True held_after_wake_s=20.0' and 'X-GATE uncached=509 verdict=admit' -- the admission it would have had at 11:18:00. weg2-4-36 (1757, 20.0 s) and weg2-5-37 (191, 20.7 s) the same; 7 such holds per rank in that boot. Nobody was writing: the missing pages were D's own decode tail of the previous turn (never secured when D slept), and P never saw the requests.

After D's wake the only process that can still fill a parked read is P (D awake = P asleep; D's own write-through writes pages D holds on its device, and a page on D's device is a device match, never a store read). What D can SEE of P per rid lives in the shared hand-off directory: the hand-off chain (weg2.handoff record / handoff_keys.CHAIN_ATTR on the request) and the E-tail parts (weg2.tail_handoff: a *.tmp part or a manifest short of its PP ranks = still writing; a complete manifest = the publish ack).

weg2/settle_writer.py classifies (pure: classify, step) and observes (listing at most every 100 ms per request):
* none        (no chain, no hand-off record, no tail part, nothing under write) -> decided now: the request goes to admission without another re-read (within X D prefills it; over X the X gate refuses by name and the front re-routes via P). Line '#1471w SETTLE-NO-WRITER rid remainder X route=D|P held_s re_reads', then 'SETTLE-RELEASE state=no-writer lapsed=False'.
* p-writing   -> no re-read until the ack (the re-read cannot see pages that are not there).
* p-published -> the ack: re-read now, past the 2 s timer, once; still short after it = no writer left -> decided.
* p-handoff   (P prefilled it, no tail parts) -> P's page write-through has no D-visible ack: the 2 s re-read stays, unchanged.
* unknown     (no shared hand-off directory) -> no writer provable: unchanged.
'#1471w SETTLE-WRITER rid writer prev action' on every change of state. Only requests already seen short (_1471_short) are classified; a read in flight ('reading') is never decided. Every verdict goes through the existing group MIN of the settle tick (due-vote and release-vote), so a rank that still sees a writer holds the group. No switch: the lapse released the same request 'as it is' 20 s later.

Tests test_weg2_settle_writer_p4b_0928 (9): on 1bab093 (module present, tick unwired) 4 red -- metal form not released (and re-read), over-X not released, tail part under write re-read on the 2 s clock, publish ack not re-read before the timer -- with the fix 9 green. Neighbours touching the settle tick / refetch / _1471_short (store_told_hold_tk, p_mamba_retention_h113, 27b_park2_metal, hold_refetch_uniform_xsn296, park_l3_248, post_wake_settle_1471, revoke_reissue_1479, store_short_tail_settle_rc2, x36_settle_dormant): 79 passed on the base, 79 with the fix.

Metal marker: '#1471w SETTLE-NO-WRITER ... route=D' within ~1 s of the 'sgl-project#1324 STORE READ INCOMPLETE' of a route=short request, 'SETTLE-RELEASE state=no-writer lapsed=False held_after_wake_s' < 1; no 'lapsed=True' for such rids; the X-GATE admit follows at once.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
… threads

NF rc12z22 D (dkrnfh91dprsavisnoadoptstbar1dauer09281447, 7d50735) TP0
14:56:23: sgl-project#248 WAKE-READ issued=5, the five reads ran one after the other on
the single prefetch aux thread (read_ms 681/854/557/350/378, queue_ms
364/1028/1859/2402/2750) -- 2.82 s of reads in a row, the last release 4.1 s
after the wake.
- cache_controller: SGLANG_HICACHE_PREFETCH_IO_WORKERS (default 4, 1 = the
  single aux thread as before) threads take the operations off
  prefetch_buffer (_start_prefetch_io_workers). Every held operation is in
  _prefetch_io_inflight: the stop terminates all of them, the join covers all
  threads (one None per thread), storage_loads_pending counts them;
  _prefetch_io_current stays the most recent one. No collective runs on the
  aux threads; the arena fill (L3-FAST pool, one claim per batch) is shared.
- hicache_storage: the sgl-project#720 read ring is created under a lock (several aux
  threads may ask first at once).
- Group agreement unchanged: the sgl-project#1471 settle releases by the group MIN over
  the settle list in hold order, so ranks whose reads finish in different
  orders release the same set in the same order.

Tests (test27b.sh, hermetic): test_weg2_wake_parallel_load_0928 5 passed
(constellation 14:56:24, read times x0.25: serial ends at the sum = metal
shape; 4 workers end at ~the longest read, metal units < 1.3 s vs 2.82 s;
three TP ranks with different completion orders release identical sets in
identical order every tick through the real _weg2_post_wake_settle_tick and a
3-rank group MIN; stop terminates every held op), red (5 failed) on
c8634ad. Neighbours green: hicache_never_slow_0928, post_wake_settle_1471,
reset_terminates_inflight_1068, reset_joins_io_aux_1068 (24 passed together).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
… threads

NF rc12z22 D (dkrnfh91dprsavisnoadoptstbar1dauer09281447, 7d50735) TP0
14:56:23: sgl-project#248 WAKE-READ issued=5, the five reads ran one after the other on
the single prefetch aux thread (read_ms 681/854/557/350/378, queue_ms
364/1028/1859/2402/2750) -- 2.82 s of reads in a row, the last release 4.1 s
after the wake.
- cache_controller: SGLANG_HICACHE_PREFETCH_IO_WORKERS (default 4, 1 = the
  single aux thread as before) threads take the operations off
  prefetch_buffer (_start_prefetch_io_workers). Every held operation is in
  _prefetch_io_inflight: the stop terminates all of them, the join covers all
  threads (one None per thread), storage_loads_pending counts them;
  _prefetch_io_current stays the most recent one. No collective runs on the
  aux threads; the arena fill (L3-FAST pool, one claim per batch) is shared.
- hicache_storage: the sgl-project#720 read ring is created under a lock (several aux
  threads may ask first at once).
- Group agreement unchanged: the sgl-project#1471 settle releases by the group MIN over
  the settle list in hold order, so ranks whose reads finish in different
  orders release the same set in the same order.

Tests (test27b.sh, hermetic): test_weg2_wake_parallel_load_0928 5 passed
(constellation 14:56:24, read times x0.25: serial ends at the sum = metal
shape; 4 workers end at ~the longest read, metal units < 1.3 s vs 2.82 s;
three TP ranks with different completion orders release identical sets in
identical order every tick through the real _weg2_post_wake_settle_tick and a
3-rank group MIN; stop terminates every held op), red (5 failed) on
c8634ad. Neighbours green: hicache_never_slow_0928, post_wake_settle_1471,
reset_terminates_inflight_1068, reset_joins_io_aux_1068 (24 passed together).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…de the decode

NF rc12z22 D TP0 14:56:26-31: weg2-10-16 and weg2-11-18 were released from the
sgl-project#1471 settle at 14:56:26 and waited 5 s while every pass ran DECODE bs=1 with
admission_ms=-1; the log cannot say why -- WEG2 X-DEFER speaks only while its
GLOBAL pass count is <= 5 (weg2-4-11 used those up) and the admission's skip
census (sgl-project#971 _admission_decline_note) is not printed on this path.
- WEG2-POST-WAKE-PASS gains waiting=<queue> admit=<the pass's admission
  gate / skip census> (loop_skips(kind=n(first=rid)), gate=...).
- the two branches that skip the admission entirely name themselves there
  (gate=phase_prefill_blocked, gate=congruent_lane_cadence) instead of
  leaving the previous pass's note.
- WEG2 X-DEFER speaks the first defer of every rid as well (the repeats stay
  under the global cap).
Instrument only: no admission verdict, order or X rule changes (over X stays
P's, under X D may take it beside the decode as before).

Tests: test_weg2_wake_tail_nowriter_0928 +2 (the line names the census and
the skip branches; X-DEFER speaks each rid's first defer past the global cap)
-> 9 passed. Tests pinning these lines/paths: the same 15 failures on
e7715b0 (leg2_store_probe_1290, sched_fix7_0908, store_grid_claim_1298
-- red on the base too, byte-identical list), the rest green.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…de the decode

NF rc12z22 D TP0 14:56:26-31: weg2-10-16 and weg2-11-18 were released from the
sgl-project#1471 settle at 14:56:26 and waited 5 s while every pass ran DECODE bs=1 with
admission_ms=-1; the log cannot say why -- WEG2 X-DEFER speaks only while its
GLOBAL pass count is <= 5 (weg2-4-11 used those up) and the admission's skip
census (sgl-project#971 _admission_decline_note) is not printed on this path.
- WEG2-POST-WAKE-PASS gains waiting=<queue> admit=<the pass's admission
  gate / skip census> (loop_skips(kind=n(first=rid)), gate=...).
- the two branches that skip the admission entirely name themselves there
  (gate=phase_prefill_blocked, gate=congruent_lane_cadence) instead of
  leaving the previous pass's note.
- WEG2 X-DEFER speaks the first defer of every rid as well (the repeats stay
  under the global cap).
Instrument only: no admission verdict, order or X rule changes (over X stays
P's, under X D may take it beside the decode as before).

Tests: test_weg2_wake_tail_nowriter_0928 +2 (the line names the census and
the skip branches; X-DEFER speaks each rid's first defer past the global cap)
-> 9 passed. Tests pinning these lines/paths: the same 15 failures on
e7715b0 (leg2_store_probe_1290, sched_fix7_0908, store_grid_claim_1298
-- red on the base too, byte-identical list), the rest green.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 29, 2026
…e mit Schwanz > 8 Token wartet im Park-Gate, behaelt seinen Sitz (Schalter, Default aus)

Flipzeit = P-Ende -> erstes Decode-Token. Unter Agentenlast gibt der Wake die
flip-geparkten Requests zuerst frei (d_seats.order_waiting), und die
Park-Schranke (admission_gate, "parked first, newcomers wait") haelt jeden
Hand-off desselben Wakes dahinter. Der Resume rechnet seinen Schwanz ueber dem
letzten Mamba-Anker: auf NF-D ein eager Experten-Pass von ~2 s fuer 33-128
Token, 5,4 s fuer 1-4k (FLIPZEIT-VERLAUF-0929.md). rc12z4 ep9: Resume
weg2-1-19 64 Token 2500 ms, SETTLE-RELEASE held_after_wake_s=3.0, erstes
Decode 8,3 s nach Flip-Beginn.

Dieselbe Mechanik, keine zweite: das D-Park-Gate (AdmissionGate) bekommt die
Menge "deferred" und die Wake-Kohorte.
- d_seats.DecodeFirst: je Pass die replizierten Fakten (Wake-Nummer,
  Decode-Runden seit dem Wake, laufende Requests, sgl-project#1471-Settle, Schwanz je
  Park = Tokens minus Park-Lesegrenze #59b). Ein flip-geparkter Resume mit
  Schwanz > SGLANG_WEG2_D_DECODE_FIRST_TAIL (8) wartet, solange Mitglieder
  dieses Wakes auf Extend oder erste Decode-Runde warten, hoechstens
  SGLANG_WEG2_D_DECODE_FIRST_ROUNDS (32) Decode-Runden; nie, wenn sonst
  nichts laeuft. Skip-Schluessel weg2_d_park_decode_first.
- AdmissionGate.skip: Mitglieder dieses Wakes (_weg2_settled_wake) passieren
  die Schranke, solange ein Resume zurueckgestellt ist; ihr Sitz ist im
  handoff_n des Wakes gezaehlt. Fremde Neuankoemmlinge warten wie bisher.
- d_park_runtime: decode_first_facts / note_decode_round / resume_tail;
  Zeile 'F3 DECODE-FIRST wake= deferred= rounds=' je Wake und Menge.
- scheduler: Zaehler je Decode-Batch nach run_batch (beide Event-Loops).
- environ: SGLANG_WEG2_ENABLE_D_DECODE_FIRST (aus), _TAIL (8), _ROUNDS (32).

Kein Decode und kein Flip wird gebremst: das Gate haelt nur einen Extend
zurueck, der sonst vor dem ersten Decode laeuft; ein Schwanz <= 8 Token (die
sgl-project#259-4c-Form) faehrt im ersten Pass mit.

Test test_weg2_d_decode_first_f3_0929 (6, Metallpfad admission -> skip):
3 rot auf ad95392 (Resume zuerst, Hand-offs weg2_d_park_first), 3 Waechter
gruen auf beiden; mit Fix 6/6. Nachbarn 34 Dateien: 17 Rote = Basis-Altlasten
identisch, 0 neu.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 29, 2026
…park_abort) + Reap je D-Park

F4 schreibt je Rang und geparktem Request einen END-Teil nach
$SGLANG_HICACHE_ARENA_DIR/handoff (tmpfs, ~64 MB je Request auf NF-D). Bisher nahm
ihn nur das Adopt-Verdikt (tail_adopt.agree -> remove_park); P's Census/Prune
(H63b) laesst Park-Teile bewusst aus. Ein geparkter rid, der nie auf D resumiert
(Abbruch; Ende oder Umleitung nach P ohne Verdikt), behielt seine Teile bis
Boot-Ende.

- park_abort (der vorhandene Abbruchhaken des D-Parks, sgl-project#1445-Form): remove_parks_aborted
  mit derselben Praefix-Regel wie die Scheduler-Queues, abort_all eingeschlossen,
  auch ohne Park-Liste.
- _park_end: vor den neuen Teilen reap_orphan_parks -- nur die EIGENEN Teile
  (dpark<tp>) von rids, die D nicht mehr haelt (running, parked, waiting,
  sgl-project#1471 settle, sgl-project#1443 hold, chunked); H81-In-Flight und .tmp bleiben. Die
  D-seitige Schwester von census/_prune; Marker 'F4 PARK-REAP files= rids='.
- Schalter aus (SGLANG_WEG2_ENABLE_D_PARK_END=0): nichts beruehrt.

Tests: 6 neu, 5 rot auf 2c5fd4a (z30v-REV), gruen mit Fix; 36 Nachbardateien
(tail_handoff/d_park_runtime): 5 Altlasten identisch zur Basis, 0 neue Rote.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 29, 2026
…-Legs statt nach dem kv-Resume (Schalter, aus bis zur ersten Serie)

Marker-Audit (29.09.): sgl-project#1471 SETTLE held_after_wake_s Median 0,60 s (z30w-park,
n=56) / 0,35 s (z30x2-kvdemand), x178 0 (Read lief im Flip, sgl-project#1443/sgl-project#1455). Der
sgl-project#248-Read (55fd84c) haengt am kv-Block (_weg2_release_dormant_hold); unter
WEG2-WAKE-KV-FIRST LATE (VRAM der Legs, d3a7586) laeuft der erst NACH den
~1,5 s Legs. Der Read selbst ist reiner Host-Weg (Aux-Threads, WAKE-PARALLEL
bb84760; READ-STAGES "no H2D here"), braucht also keinen kv-VRAM.

SGLANG_WEG2_ENABLE_WAKE_READ_EARLY=1: park_l3.issue_reads_at_wake_begin gibt am
pre_leg der Gewichts-Resume dieselben issue_deferred_reads aus (Hold-Reihenfolge,
auf jedem Rang an derselben Stelle derselben RPC). DORMANT bleibt gesetzt, nichts
wird zugelassen (d5e2f4f-Lehre); der Release findet nichts Aufgeschobenes,
sein sgl-project#1471-Urteil sieht fertige Reads. Der Release ueberspringt die
Hand-off-Schluessel auch fuer schon ausgegebene Reads (vorher nur fuer
aufgeschobene) -- sonst entzoege er einem kurzen Read P's Schluessel. Neuer
WAKE-TAIL-Unterzaehler read_early=. Modellneutral, nur Gruppe D; aus =
Release-Weg wie auf 895559f.

Tests test_weg2_park_l3_248: 4 neue (frueher Read + Release ohne Settle,
Schluessel bleiben bei kurzem Read, Schalter aus = Basis, nur Gruppe D) auf
895559f rot, gruen mit Fix; Datei 21/21. 51 betroffene Suiten (park_l3,
pre_leg/WAKE-TAIL, release, resume): 793 gruen, 40 Altlasten identisch zur Basis.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 29, 2026
…r Read sofort neu gelesen -- y3m ep24/ep46

y3m 09292136: D-Nachlauf waechst ueber den Boot (ep2 0 s -> ep46 12 s), weil
die Agent-Kontexte wachsen (Wake-Lesemenge 36k -> 411k Tokens). Zwei Posten:

1. Release-Drain im Scheduler-Thread: D TP0 max release round 220 ms (21:42)
   -> 1191 ms (21:49, 214848 rows); der Pass, der die Reads erntet, steht ~1 s
   (POST-WAKE-PASS schedule_ms 953), jede fertige Lesung wartet (LOAD-DEVICE
   harvest_ms 0,7-2,2 s). Der 27B faehrt SGLANG_HICACHE_DRAIN_BUDGET=16384 seit
   24.09. (max release round 34 ms, dkr27browauthority 09292016), NF nie.
   -> hicache_drain_budget: Default 16384 (Leistungsschalter nach
   Metallnachweis), "0" = aus.
2. Kurzer Read trotz vollem Store-Treffer (sgl-project#1157 requested_pages=3841
   hit_pages=3841 completed=0): die Arena voller Geschwister-Referenzen verwarf
   die Fuellung, der sgl-project#1471-Settle las auf dem 2-s-Takt nach (ep24 22-38 3,6 s,
   ep46 36-49 fuenf Nachlesungen 10,2 s). -> weg2/short_read: der Reap merkt
   'Spanne gehalten' (Gruppen-MIN der Probe), der Settle liest beim naechsten
   Tick nach, solange jede Lesung vorankommt; sonst der 2-s-Takt.

Marker: WEG2-SHORT-READ HELD; HICACHE-ROUND-TIMING 'budget rows=16384'.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 14, 2026
…s instead of taking the arena

NF h17 38c6d40 (boot ..._1014_153824), D TP0: 15:48:07 D took lane floor 1 for the lane-1
image turn weg2-2-55 (192797 tokens). 15:48:09, at the P->D wake, 'sgl-project#248 WAKE-READ issued=5
[weg2-2-30, weg2-2-31, weg2-2-44, weg2-2-45, weg2-2-47]' with 'in_flight_pages=6309
arena_slots=6485' -- five lane-0 hold reads the floor would not seat pinned the KV arena
(15:48:31 ARENA-REF-HOLDERS tree_in_use=5848 arena_pinned=6323 of 6323). weg2-2-55's own read
(not a hold read) found it full: L3-FILL ROOM-WAIT / JOIN-WAIT on every window, delivered
0 / 128 / 24640 of the 192512 the store held in 43 s, 15:48:54 W31 -> W50 -> flip D->P; P read
all 192512 in 8.9 s (pages=3008 in one read). D's read path was not short of the store -- it was
short of arena room, held by reads that could not run.

park_l3.issue_deferred_reads / issue_capacity_waiters: a hold read whose lane (the request's
priority) is below D's lane floor (d_lane.floor_of, set by the floor RPC on every rank) is not
issued; it waits as a #248f capacity waiter, parked in the sgl-project#1471 settle (voted 0, not released),
and reads when the floor falls to its lane. Replicated inputs only.
SGLANG_WEG2_WAKE_READ_LANE_FLOOR, default on; 0 = the old issue.

Tests (pytest_gedeckelt.sh, no GPU): test_weg2_wake_read_floor_1014 (new, 6: default on, the
h17 five lane-0 reads under floor 1 -> none issued, a floor-lane read still reads, the waiters
read when the floor falls, floor 0 = old issue, switch off) + every test file referencing
park_l3 / the wake reads (16 files): 169 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 14, 2026
…s instead of taking the arena

NF h17 38c6d40 (boot ..._1014_153824), D TP0: 15:48:07 D took lane floor 1 for the lane-1
image turn weg2-2-55 (192797 tokens). 15:48:09, at the P->D wake, 'sgl-project#248 WAKE-READ issued=5
[weg2-2-30, weg2-2-31, weg2-2-44, weg2-2-45, weg2-2-47]' with 'in_flight_pages=6309
arena_slots=6485' -- five lane-0 hold reads the floor would not seat pinned the KV arena
(15:48:31 ARENA-REF-HOLDERS tree_in_use=5848 arena_pinned=6323 of 6323). weg2-2-55's own read
(not a hold read) found it full: L3-FILL ROOM-WAIT / JOIN-WAIT on every window, delivered
0 / 128 / 24640 of the 192512 the store held in 43 s, 15:48:54 W31 -> W50 -> flip D->P; P read
all 192512 in 8.9 s (pages=3008 in one read). D's read path was not short of the store -- it was
short of arena room, held by reads that could not run.

park_l3.issue_deferred_reads / issue_capacity_waiters: a hold read whose lane (the request's
priority) is below D's lane floor (d_lane.floor_of, set by the floor RPC on every rank) is not
issued; it waits as a #248f capacity waiter, parked in the sgl-project#1471 settle (voted 0, not released),
and reads when the floor falls to its lane. Replicated inputs only.
SGLANG_WEG2_WAKE_READ_LANE_FLOOR, default on; 0 = the old issue.

Tests (pytest_gedeckelt.sh, no GPU): test_weg2_wake_read_floor_1014 (new, 6: default on, the
h17 five lane-0 reads under floor 1 -> none issued, a floor-lane read still reads, the waiters
read when the floor falls, floor 0 = old issue, switch off) + every test file referencing
park_l3 / the wake reads (16 files): 169 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 14, 2026
…checks every settle member; the termination collective carries the rid

NF h18 fe799c4 died twice on D with a gloo collective mismatch (16:23:24Z "8 vs 4",
boot ..._1014_161406; 16:38:56Z "16 vs 4", boot ..._1014_162636). Same chain both times:
- a read record differs by rank under the Form A END vote (TP0's span base 0, the workers'
  19008/67584: TP0 'matched=0 completed_synced=0' vs '19072'), so _1471_short (from the rank's
  own record) is set on TP0 only;
- the sgl-project#1471 settle tick: '#1471w SETTLE-WRITER rid=weg2-10-28 (6-68) ... action=reread' on TP0
  ONLY, the next tick TP0's action is 'decide' -- and loop 1 skipped _refetch (the progress
  check's collectives: can_terminate_prefetch MAX, the reap MIN) for a decide/wait member;
- TP0's next collective was the next member's while the workers checked the skipped one: TP0
  'sgl-project#905 ... req=weg2-12-29 completed=96256 min_synced=62848' (the workers' 10-28 number),
  TP1/TP2 'req=weg2-10-28 completed=62848'; in death 2 TP1/TP2 6-68 (94336/67584) vs TP0 10-71
  (67584/67584) -- two rids in one collective. TP0 deferred and re-issued alone, its prefetch
  thread ran an operation the workers did not, the claim reduces met with different sizes.
STORE-HELD-DECIDE ruled out: it decides on the reduced END and the absolute deliverable, the
W88-REROUTE lines of death 1 (store_held=62848 / 95680, cycles=2 bound=1) are identical on all
three ranks, death 2 has no fallback in its window; pinned below on the Form A END harness.

(2) SETTLE-UNIFORM-1014 (SGLANG_WEG2_SETTLE_UNIFORM_CHECK, default on): loop 1 of the settle tick
runs _refetch(req, now, allow_reissue=False) for every non-capwait member on every rank; the
rank-local writer action shapes only the vote (_pre/_dec), never whether a collective is entered.
A wait member is checked, never re-read. Off: the old skip.

(3) PREFETCH-RID-NET-1014 (SGLANG_WEG2_PREFETCH_RID_NET, default on): can_terminate_prefetch
carries the rid's fingerprint (crc32, 30 bit) as h and -h in the same MAX (5 slots on every
rank). max != min = the ranks stand at different rids; every rank sees it alike, answers 'not
done' and logs PREFETCH-RID-MISMATCH -- nothing reaped, no rid's numbers mixed into another,
no one-sided DEFERRED/re-issue, no gloo abort. Off: the 3-slot form.

Tests (pytest_gedeckelt.sh, no GPU): test_weg2_h18_settle_uniform_rid_net_1014 (new, 11):
the h18 tick on three ranks with TP0 'decide' / workers 'poll' runs the same progress checks;
RANK-EQUALITY MUTANT: the switch off (the h18 code) splits the ranks (TP0 first at 12-29); a
wait member is checked but not re-read; defaults on; the net: same rid terminates, the h18
pairing (12-29 vs 10-28) is 'not done' and named on both sides, net off cannot see it, the
fingerprint is stable; STORE-HELD-DECIDE on the real drain chain with the metal's Form A bases
answers alike on every rank on every pass, its mutant on completed_local splits them.
Regression (42 files touching the settle, the progress check, the store-short drain):
409 passed + the 2 adapted pins (xsn296 window 6000 -> 9000, h45 termination tensor len 3 -> 5):
28 passed. 9 failures (test_prefetch_progress_symmetry_580 x8, test_allreduce_admission_pin_1537
p5) are red at the base 82263ce as well, not touched.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 19, 2026
… is in flight for the twin rules

pdflip_post_wake_settle holds LIVE requests the wake released from the dormant hold with a
short read, parked until their re-read lands (up to the settle bound ~20 s, kept over a
re-sleep into the next wake). inflight() did not list them, so A1 (5f80092) counted such a
source GONE and released its twin at once as an ordinary request (TW-WAKE class sgl-project#294: the twin
recomputes the shared prefix). inflight() now adds the settle list like _dormant_hold;
_note_s0 treats it as not admitted (no start depth from a half read). PP0 only, no wire change.

Tests (serial, systemd-run --scope -p MemoryMax=2G, CPU):
- test_s79_twin_chain_1019.py: 35 passed (+ reviewer test /tmp/rv79c-tests/
  test_rv79c_post_wake_settle_1019.py taken over with the turned expectation: release_due == [],
  n_gone == 0; dormant-hold control)
- mutant 'settle list not in inflight' killed (2 failed); review mutants M1-M7, M10, A1x, A1z
  killed; M8, M9, A1y survive (equivalent per review)
- neighbour gate, 74 files, one process each: 1299 passed / 10 failed, same 10 names as rc17
  7d93470 -> new red = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants