Skip to content

openai chat speculative execution - #248

Closed
ChuyueSun wants to merge 7 commits into
mainfrom
issue44_cleaned
Closed

ChuyueSun wants to merge 7 commits into
mainfrom
issue44_cleaned

Conversation

@ChuyueSun

Copy link
Copy Markdown
Contributor

No description provided.

@ChuyueSun
ChuyueSun requested a review from Ying1123 March 1, 2024 03:15
@ChuyueSun ChuyueSun changed the title openai chat speculative execution [WIP] openai chat speculative execution Mar 1, 2024
@ChuyueSun ChuyueSun changed the title [WIP] openai chat speculative execution openai chat speculative execution Mar 1, 2024
@ChuyueSun ChuyueSun closed this Mar 1, 2024
@merrymercy
merrymercy deleted the issue44_cleaned branch March 11, 2024 12:49
vschandramourya pushed a commit to vschandramourya/sglang that referenced this pull request Feb 3, 2026
…ject#248)

* Copy OSS code from 86b04d2 on 20251016

* upd

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
sammysun0711 pushed a commit to sammysun0711/sglang that referenced this pull request Apr 20, 2026
* CI: simplify Qwen3.5 external load test runner

Replace the fragile benchmark source rewriting with compatibility model aliases and explicit log-based failure detection so request rate load tests fail clearly instead of reporting false positives.

* CI: default Qwen3.5 workflow dispatch to benchmark

Set the manual `run_mode` input default to `benchmark` so benchmark runs are preselected in the Actions UI.
rucnyz added a commit to rucnyz/sglang that referenced this pull request Jun 18, 2026
…contained in-engine package + do-no-harm fixes

Move all aginfer logic out of the two large upstream files into a self-contained
python/sglang/srt/mem_cache/aginfer/ package, leaving only thin delegators/hooks.

- cache_policy.py / cache_hooks.py / metrics_hooks.py: the pluggable eviction
  scorer + write-through resolution, hint table, apply_aginfer_migrations, and the
  scheduler EMA/throughput hooks, as free functions over cache/sched.
- unified_radix_cache.py (-790) / scheduler.py (-296) now carry only thin (*a,**k)
  delegators + re-import hooks + callsites + session_ids tags.
- The 14 daemon-policy modules (joint_decide/program_tracker/eta_estimator/...)
  moved from dev/aginfer into the package; the old dev paths are sys.modules shims.

do-no-harm fixes surfaced by a 4-round adversarial review:
- sgl-project#253: full_component eviction now honors --radix-eviction-policy on the default
  path (was hardwired LRU via the value-scorer default); lru + value-aware paths are
  byte-identical no-ops. New gate verify/radix_eviction_policy (12/12).
- restored the orphaned _AGINFER_VALID_STATES class attribute (was swept to module
  scope by the migrate extraction); fixed the _fatal.py forensic data-dir path after
  the move; deduped the T5 webhook block; trimmed dead re-imports + a dead import os;
  added from __future__ import annotations / TYPE_CHECKING to the split-out modules.

Also folds in the value-aware SWA eviction + reuse-based p_hat WIP (sgl-project#248/sgl-project#249).

Default path (no aginfer env, no daemon) is byte-for-byte stock sglang. Green:
radix_eviction_policy t21 t26 t27 t28 t38 s2_holder_scorer kv_scheduler_value_rule
joint_decide program_tracker admission_controller; full `import scheduler` (no
circular import). Experiment logs/results (36G) intentionally excluded.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…usal -- one further sequential P leg after a refusal that followed it (attempt=2); a committed stream that ends without an answer ends NAMED, never as a bare 200

NF rc12s (dkrnfh91dprbar1dauer09271719, e39b37d), weg2-3-16 (weg2-3-18 alike): D refused it mid-stream
at 17:33:33 (W50-REROUTE n=1) and again at 17:33:36 (n=2) in the SAME D phase -- park_tick's awake
re-queue re-offers a parked request to the X gate every pass; the front dropped the second needs-p (one
path per rid) -- then, after its one P leg (RESUME-VIA-P done 17:35:06), at 17:35:47 (n=3 kept) and in the
same pass once more: over MAX_ATTEMPTS=3, in-band W50 after the first byte, the front logged "re-route
impossible" and WEG2-SERVED status=200 prompt_tokens=0 completion_tokens=0. The store had delivered only
part of the context (P arena full, sgl-project#248 NF); D prefilling over X is vetoed (law 4, no fallback).

(1) D (weg2/resume_via_p.py): an attempt is a P LEG. note_wake(sched) counts D's wakes (called on every
rank from resume_memory_occupation, the same replicated resume requests; after the leg replay check); a
refusal in the same wake as the rid's last attempt is the same hold -- eligible, no increment, the
needs-p rewritten (the front drops it as a duplicate). MAX_ATTEMPTS 3 -> 2: the first P leg and EXACTLY ONE
more sequential one; a refusal after the second leg is the named W50. The needs-p record carries attempt;
D's W50-REROUTE line prints attempt=n/2 hold=same|new; the front's W50-REROUTE line prints attempt and
attempt 2 gets "RESUME-VIA-P attempt=2 rid=...". One path per rid stays (the front's _rvp_inflight).
Switch SGLANG_WEG2_RVP_ATTEMPT_PER_WAKE (default on; 0 = every refusal an attempt, bound 3, as before).
scheduler._weg2_answer_x_refusals passes itself (eligible(req, sched=self)).

(2) Front (TN, SGLANG_WEG2_LEG2_TERMINAL_NAMED default on): before write_eof of a committed streamed leg 2
with the client still there, leg2_terminal_reason(tail, path, finished): "W50" when D's named X refusal
is in the stream; "error:<W-code>" for ANY other error event of D in the stream (NF rc12t
dkrnfh91dprbar1dauer09271756 weg2-4-16 18:08:55: PARK-RUNNING -> PARK-RESUME -> W50-REROUTE midstream
d_extent 82045 -> D "W88 Weg2StoreLoadNotProgressing arm=host_pool_shortfall span=82044 ... terminal,
answered 503" -> the front booked verdict=serve 0/0 and RESUME-VIA-P dropped its P leg); "truncated" when D's stream ended without the end-of-answer marker (OpenAI/Anthropic
wires only -- /generate's finish_reason is an object, not judged). Then WEG2 LEG2-TERMINAL-NAMED rid
reason path error_event=forwarded|synthesized; when the stream carries no error event the front writes
one in the path's wire (Anthropic "event: error" overloaded_error, OpenAI data {"error": {... code
503}}) naming W50 Weg2TpPrefillExceeded or W164 Weg2Leg2Truncated (new code) and "retry it". The
uncommitted side is EB's (LEG2-ERROR-BEFORE-CONTENT: 503 or re-route); the other "(STREAM, served)" site,
W16, ends after content and is a price verdict, not an answerless end.

Tests: test_weg2_rvp_attempt2_terminal_named_krit3_0927.py 12 (the metal sequence: same-phase re-refusal
is the same hold, attempt=2 after the wake, a third refusal after the second leg -> W50; switch off =
bound 3 per refusal; wake counter; wiring of note_wake after the replay check and eligible(sched=self);
terminal reason W50 / truncated / finished / /generate; error-event detection and the two chunks; switch;
wiring before write_eof and the attempt line; rc12t weg2-4-16: the W88 error after the commit on
the Anthropic and OpenAI wires, with and without a closing end marker, is terminal; an error event without
a W-code is terminal; a held stream closed silently after RESUME-VIA-P dropped its P leg is truncated;
a complete answer whose text contains "error" is untouched).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…ile a younger one runs pauses the youngest -- its KV leaves only as far as needed; sgl-project#248 keep_role behind a guarded import

The user's design (SA, 312abdc0b3) displaces "jüngere ... ganz oder teilweise". Feasibility note
tmp/pa/TEILPARKEN_notiz_0927.md: a decode cannot continue with part of its KV off the device on this
model form (full attention reads every position each step; HiSparse exists only for DeepSeek DSA;
GDN/Mamba state is all-or-nothing; DCP uneven and the MTP/DFlash draft need their share whole). So the
displaced one pauses, and "teilweise" is how much KV leaves: release_req(retain=True) frees no page,
the span stays evictable in the tree, and the older one's allocation evicts only the missing amount
(LRU: older cache remnants first, the displaced tail last; write_back -> L2/L3), the resume reloads
only the rest (sgl-project#988). The gap: SA-DISPLACE triggered only on seats.

KV trigger (d_park_runtime.displace_for_age; SGLANG_WEG2_SEAT_AGE_KV_DISPLACE, default on; 0 = seat
trigger only; under SGLANG_WEG2_SEAT_ROTATE): a seat is free, the adder refused an OLDER waiting
request with NO_TOKEN in the last pass (Scheduler sets _weg2_sa_no_token to the first refused rid;
displace_for_age consumes it), and a younger one runs -> the youngest pauses (retain, pressure park:
it resumes when it is the oldest live). RANK-UNIFORM: the precondition (a waiting request older than
the youngest running one; queue, running set and rids are replicated) is the same on every rank, so
every rank enters the group MIN (_weg2_group_min_flags, the #1471e verdict helper) over "I refused an
older one"; the group displaces only when EVERY rank refused. At most one per pass, never an older.
Line "SEAT-AGE DISPLACE rid_out older_waiting trigger=kv|seat running cap pages_out".
_partial_keep: the ONE call site towards NF's sgl-project#248 -- keep_role(rid, "park", page_range=(a, b)) with
a = span end - ceil(shortfall / page_size), shortfall = the older's uncached need minus the free rows
(seat trigger: 0, a pure pause, no call); guarded import (sglang.srt.weg2.handoff_pending, name
pending): missing or raising -> today's retain, the displacement stands; pages_out = keep_role's int
return, else the requested window. NF releases the role at the request's free (their decision), so
no release call.

Tests: test_weg2_seat_partial_0927.py 11 (older refused for KV displaces the youngest with a free seat
through the group MIN, signal consumed; ranks disagree -> nothing; no refusal -> nothing but the
collective is entered; a younger refused never displaces an older and no collective; sub-switch off;
seat trigger unchanged with pages_out=0; window from the shortfall; keep_role called with the window
and its return logged; raising keep_role -> retain; seat trigger is a pure pause; scheduler wiring)
+ SA's 19.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…ide page_range (tree pages)

NF sgl-project#248 contract (handoff_pending.keep_role(rid, role, page_range=None, *, page_keys=None,
page_size=0) -> int): page_range is in TREE pages and page_size names them; 0 would be
recorded as unknown. The window [a, b) was already derived with the tree's page_size; the
call now carries it. An older NF without the keyword raises TypeError -> today's retain
(guarded, the displacement stands).

Test: test_weg2_seat_partial_0927.py 11 passed (the keep_role stub takes NF's signature and
pins page_size=64 from the tree).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…ol ist nie die Schranke der Gruppe -- seine Zeilen wachsen als 0-B-Platzhalter statt abzulehnen; sgl-project#915 nennt den kürzenden Rang, W88 min_rank

rc12t: 8 W88 in 11 min. Befund Fork A, tmp/r989/befund_w88_host_pool.md.
- Die KV-Host-Pools der Expert-Worker sind byteless: 0 kv-heads, 0 B je Zeile.
- Unter R12 behalten sie jede Zeile bis zum Reset (SHADOW-OWN-EVICT-REFUSED).
- Die synchronisierten 353573 Zeilen liefen voll, während TP0s Arena die Spanne noch hatte.
- Im sgl-project#580-Vote (prefetch_participation_vote) enthalten sich die Worker seit H99 nur bei der Spanne. Ihre Länge in Slot 2 ist ihr allokiertes Stück, und das setzte das Gruppen-MIN.
- Folge: sgl-project#915 PREFETCH TRUNCATED need=54336 got=49216 auf allen Rängen, 64 Requeues, W88 arm=host_pool_shortfall.

Fix, Form-A-only:
- HostKVCache.alloc: ein byteless Pool (JG, element 0 B) wächst um ganze Seiten statt None zu liefern (_grow_byteless). Die Buchhaltung (mem_state, slot_used, free_slots, page_num) wächst mit.
- MHATokenToKVPoolHost._regrow_byteless_buffer formt den 0-Byte-kv_buffer auf die neue Id-Zahl um, damit kein Index des gewachsenen Bereichs je außerhalb liegt. Nichts wird gepinnt oder kopiert.
- clear() (Reset) stellt die synchronisierte Größe wieder her.
- Kein größerer Pool, keine Reserve: Die Zeile trägt 0 Byte, sie ist ein Platzhalter.
- Folge: Die Längenstimme eines Workers ist wieder seine Spanne. Die Gruppe hat den Platz, den TP0 hat.
- Ein Pool mit Bytes (TP0, 27B, jede klassische Form) lehnt unverändert ab. Test: nicht-byteless → None, Größe gleich.

Abweichung von der Order ("Worker enthalten sich auch in Slot 2"), mit main abgestimmt:
- Die Längenstimme des Workers bleibt, denn sie ist eine echte Schranke, wenn der Schlüssel des Workers kürzer ist. Das ist der H99-Fall: Der Schatten-Anker des Workers liegt TIEFER als der Anker des Hosts.
- Ein Rang kann nicht mehr Tokens registrieren, als sein Schlüssel hat. Mit einer Enthaltung in Slot 2 wäre group_len > local_len auf dem Worker, und der Desync-Stopp würde feuern.
- Das Wachstum entfernt genau die falsche Schranke, die Kapazität eines 0-B-Pools, und lässt die richtige stehen, die Länge des Schlüssels.

Instrument (3):
- Im gruppeneinheitlichen Trim-Zweig (group_len < span_lo, beides reduzierte Werte) läuft EIN MIN: "mein Rang, falls meine eigene Länge die Gruppenlänge ist". Es nennt den kürzenden Rang.
- sgl-project#915 PREFETCH TRUNCATED trägt cut_rank= und local=. Die Zeile der Einzel-Rang-Kürzung trägt cut_rank=local.
- prefetch_cut_terms(rid) hält den letzten Trim je rid (Deckel 4096).
- Die W88-Zeile (_weg2_store_load_terminal) trägt min_rank=R group_len=G need=N, oder min_rank=-.
- sgl-project#249 Punkt 2 (STATE-Freigabe an die Worker) steckt in sgl-project#248 (release_loaded_host).

Tests test_forma_byteless_len_vote_249 (7), durch die echte prefetch_from_storage auf drei simulierten Rängen (H99-Harness) mit echter MHATokenToKVPoolHost-Buchhaltung:
- rc12t-Form (Worker-Pools voll, available=0, TP0 hat die Spanne): alle Ränge registrieren die volle Spanne.
- Worker halb voll: keine Kürzung.
- TP0 knapp: die Kürzung bleibt, cut_rank=0 in allen drei sgl-project#915-Zeilen, min_rank=0.
- H99-Fall (Worker tiefer): die Gruppe kürzt einheitlich auf den Worker-Schlüssel, min_rank=1, kein Desync.
- Pool wächst um Seiten, clear() stellt her.
- Pool mit Bytes unverändert.
- W88 nennt min_rank.
Rot auf e39b37d: 6 von 7. Der Pool mit Bytes ist auf beiden Seiten grün, das ist der Unverändert-Beweis.

(cherry picked from commit 79435c635d686f95046e1be90c217a699a94cd89)
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 27, 2026
…unt (pages_out=<n>); the no-module case also hides the package attribute, since 'from sglang.srt.weg2 import handoff_pending' reads it once sgl-project#248 is imported
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
… + Anker) -- nie ein Mamba-Host-Wert ohne KV-Host-Wert

rc12x (dkrnfh91dprsabar1dauer09272253, 10f5bbf), D tot 63 s nach serving (22:59:01Z), auf allen drei Rängen gleich:
- on_idle -> _check_tree_cache_bounded -> sanity_check: "node 28 mamba host present but Full.host_value=None".
- Verlauf weg2-0-4 (D-Log): PARK-DEMOTE (12154/12277) -> WAKE-READ (13015) -> INSERT-PLACED deepest=28 (15424 Token, KV- und Anker-Host).
- Danach MAMBA-HOST-RESUME, sgl-project#988 LOADBACK kv_applied=1 mamba_restored=1, dann Z. 13138 "sgl-project#248 LOADED-HOST-RELEASE nodes=1 rows=15424".
- Die Worker folgen: R12 APPLIED kv_dropped=1 anchor_dropped=0 (13251/13252). Sanity-Fail 15649.

Wurzel: weg2.park_l3.release_loaded_host (sgl-project#248, 55fd84c) entfernte nur die KV-Host-Zeilen (BASE_COMPONENT_TYPE).
- Die Annahme im Docstring war "a mamba anchor may exist on the host alone". Das ist falsch.
- Die Baum-Invariante verlangt aux-Daten nur mit Full-Daten auf derselben Schicht (UnifiedRadixCache.sanity_check).
- Der Anker-Host-Wert blieb unter einem KV-freien Knoten stehen.
- Die Worker spiegeln diesen Zustand per R12 STATE (anchor_host=1), deshalb stirbt jeder Rang gleich.

Fix (park_l3.release_loaded_host):
- Je Knoten gehen die aux-Host-Zeilen (Mamba-Anker, Indexer) VOR der KV-Host-Zeile, beide zusammen. record_state trägt dann kv_host=0 und anchor_host=0 zu den Workern.
- Liegt ein aux-Zustand NUR auf dem Host (kein Device-Wert), behält der Knoten seine ganze Host-Seite. Ein Drop des KV würde die Invariante brechen, ein Drop des Ankers den einzigen Zustand verlieren.
- Nach dem Load-back setzt MambaComponent.commit_hicache_transfer(LOAD_BACK) den Device-Wert. Der Normalfall gibt also alles frei, der sgl-project#248-Zweck bleibt (keine Arena-Referenz über den Wake hinaus).
- Neue Zeile: LOADED-HOST-RELEASE ... kept_host_only_aux=N.
- Keine Änderung an handoff_pending/d_park_runtime/front.py.

Tests test_park_l3_loaded_host_r12_248.py (7):
- Neu test_rc12x_no_anchor_host_row_outlives_its_kv_host_row: kein Rang behält einen Anker-Host ohne KV-Host, die Regel wird wie im sanity_check geprüft.
- Neu test_an_anchor_on_the_host_only_keeps_its_node_whole.
- Der Metall-Test erwartete den Fehlzustand (0, 1) und erwartet jetzt (0, 0).
- 3 rot auf 10f5bbf, 7/7 grün mit Fix.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…Ids adressiert, die der byteless KV-Anker per sgl-project#249 hat wachsen lassen -- ausserhalb des Sidecars: Worker ueberspringt benannt, jeder andere Rang stoppt benannt

rc12z15 (f49f7bd, D 10:22:39, TP1 und TP2 gleichzeitig): get_new_batch_prefill -> ready_to_load_host_cache ->
start_loading:865 -> HostPoolGroup.load_to_device_per_layer:2488 -> DeepSeekV4PagedHostPool.load_to_device_per_layer:1575
(Pool 'qsa_indexer') -> transfer_kv_direct: 'output with shape [1, 4096] doesn't match the broadcast shape [0, 4096]'.
[1, 4096] ist eine QSA-Seitenzeile (item_bytes 4096); die Form entsteht, wenn dst.slice 1 Zeile hat und src.slice 0 --
der Host-Seitenindex liegt hinter dem Host-Puffer (nachgestellt: x.copy_(leer) liefert genau diese Meldung).

Wurzel: sgl-project#249 (9996780, 27.09.) laesst den byteless KV-Host-Pool eines Form-A-Workers (0 B/Zeile, R12 behaelt jede
Zeile) seinen Id-Raum ueber die synchronisierte Groesse WACHSEN statt abzulehnen. Der QSA-Sidecar wird mit den KV-Ids
adressiert (indices_from_pool=KV), wurde aber EINMAL beim Zusammenbau aus der KV-Groesse bemessen (5525 Seiten = 353600
Ids, echte 4-KiB-Zeilen) und waechst nicht mit. D-Log rc12z15: 'sgl-project#249 BYTELESS-GROW pool=MHATokenToKVPoolHost rows
353600 -> 373504' auf TP1/TP2 um 10:22:26 -- am Wake, der sechs gehaltene Prompts las (sgl-project#248 WAKE-READ issued=6):
63360 + 17536 + 105664 + 17664 + 63488 + 105792 = 373504. weg2-0-4 (105792, zuletzt vergeben) liegt oben im Id-Raum,
sein Schwanz (extent=192) nennt Seiten >= 5525 -> leere Host-Scheibe -> Tod. Die Kernel-Zweige (transfer_kv_per_layer_mla,
backup_from_device_indices) haetten stattdessen hinter den gepinnten Puffer geschrieben.

Warum nicht in rc12z14 (c69b1a6, 36 Worker-LOADBACKs): dort steht kein einziges 'sgl-project#249 BYTELESS-GROW' -- die
Worker-Id-Belegung blieb unter 353600 (Wakes mit kuerzeren Spans, Pool-Clear 10:03:31). Es ist die Lastform
(sechs lange Agent-Prompts in einem Wake), nicht f49f7bd: die Worker fahren FormAWorkerNullStorage, dort laeuft
weder die L3-Kopplung noch der Write-Behind; die Id-Vergabe der Worker haengt nicht an L3.

Fix (qsa_pool_host.QSAPagedHostPool._has_transfer_indices, gemeinsamer Eingang von load_to_device_per_layer,
backup_from_device_all_layer und backup_from_device_indices): Host-Seiten ausserhalb des Sidecars ->
* Form-A-Worker: benannter Skip 'H106 FORM-A SIDECAR SKIP pool=qsa_indexer pages= host_page_max= host_pages=' --
  der Worker faehrt keine Dense-Kette (form_a_worker_forward: Attention, QSA-Indexer und KV nur auf dem Host; KV 0 B,
  Null-Storage), seine QSA-Zeilen werden nie gelesen;
* jeder andere Rang: benannter Stopp 'H106 SIDECAR HOST INDEX OUT OF RANGE' (dort waere es Falsch-KV).
Rangweise lokale Kopie, kein Kollektiv auf dem Pfad -- die Gruppenfolge bleibt gleich. Im Bereich unveraendert.
Trifft 27B nicht (kein QSA-Pool, keine Form-A-Worker).

Tests test_qsa_sidecar_byteless_grow_h106 (4, echter QSAPagedHostPool, transfer_kv_direct als dieselbe Slice-Kopie
auf CPU): auf f49f7bd 3 rot -- Worker-Load 'output with shape [1, 4096] doesn't match the broadcast shape [0, 4096]'
(die Metallmeldung), Worker-Backup schreibt still nichts, Nicht-Worker ohne benannten Stopp --, mit Fix 4/4 gruen.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…rm_a_host_shadow_cut_s4b4_239 (6) auf dem R12-Harness mit geteiltem Arena-Header: TP0 (Anteil 0) quittiert zuerst waehrend TP1 noch schreibt -> auf ebeccfd TP0 (0,0) vs TP1 (1,1) bei Tiefe 256 (die rc9m-Klasse), mit da1abb9 gleiche Baeume und REBIND erst bei vollstaendiger Seite; Worker rebindet nie am eigenen Ack; nie vollstaendige Seite -> nach REBIND_WAIT_PASSES TRANSIT auf allen Raengen; REBIND auf belegtem Knoten bleibt pending; Reset leert das Warten; ohne Schnitt unveraendert. 5 rot auf ebeccfd, 6/6 gruen; R12 (14) + sgl-project#248 (7) gruen
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
…dit -- Bruecke f833fcb: D schrieb den Anker 37376 in 16-46s eigenem Extend ('sgl-project#1469 RETAIN rid=weg2-16-46 ... cache_len=37376', 19:50:38), 16-48 setzte darauf auf (19:50:51, '#cached-token: 37376'). Der D-Schlaf 19:51:15-16 verweigerte die Host-Sicherung ('sgl-project#1421 BACKUP-REFUSED why=mamba_pin ... pins=8/8', danach 'why=mamba_claim' hinter 'sgl-project#1427 ARENA-CLAIM REFUSED ... no free slot' der 32-Slot-Arena) und setzte den Baum zurueck ('sgl-project#1470 FLUSH-PUBLISH issued=13 unbacked_left=1', 'Cache flushed'). Nach dem Wake gab der Store den KV zurueck (store_hit=37376), aber keinen Anker ('[sgl-project#904 match-census] ... MambaComponent:absent=37376'); die Front preiste weg2-16-54 trotzdem SHORT (presence 35942 src=d_leg2_cached) -> 17 s D-Sitz, dann W31 am X-Gate (38291 Tok) und W50-Umweg ueber P (12 solche in rc12z26, 8 auf der Bruecke). Das X-Gate auf D preist schon die anker-nutzbare Tiefe (W31), die Front nicht.

Fix: (a) Instrument: sgl-project#1421 BACKUP-REFUSED nennt depth= und rid= (weg2_node_depth, weg2_anchor_rid). (b) Der Flush zaehlt vor tree_cache.reset() jeden nur-Device-Mamba-Anker mit Tiefe (UnifiedRadixCache.weg2_unbacked_anchors, 'WEG2-ANCHOR-LOST at=flush n= depths= rids='); der Scheduler haelt die Tiefen bis zur Schlafantwort (weg2_take_anchors_lost, einmal lesen). (c) Die Gruppenzaun-Stimme des release-Legs traegt anchors_lost (Modulfunktion _weg2_anchors_lost_for_leg, [] auf jedem anderen Leg und ohne Scheduler-Ledger), die Reduktion vereinigt, ReleaseMemoryOccupationReqOutput.anchors_lost, der Tokenizer-Merge vereinigt (Feld fehlt, wenn nichts verloren -> alte Antwortform). (d) Front.flip liest nach completed_tags die Schlafantwort von D und nimmt jeden SpanLRU-Eintrag zurueck, dessen Kredit auf einer verlorenen Tiefe stand (depth_cap, sonst gemessene ct), 'WEG2 PRESENCE-ANCHOR-LOST'; ein Eintrag auf einem ueberlebenden Anker behaelt ihn. Zu viel Zuruecknehmen ist sicher (voller Preis = Preis des X-Gates). Die Rettung des Ankers ueber den Schlaf bleibt bei sgl-project#259 4c. Luecke: Arena-Verdraengung ohne L3 ausserhalb des Flushs erfasst der Ledger nicht (nur die Host-Kopie-Pruefung).

Tests test_weg2_anchor_lost_presence_0928 (10): alle rot auf 1ea8133, gruen mit Fix. Nachbarn 18 Dateien (1424g, H113, H74, R12, sgl-project#59, X-exact, Spans, sgl-project#1470, sgl-project#49/P49, flip_cost_1235, 1273 x2, sched_fix3, W35, Profil, H91e, sgl-project#248): 298 gruen auf Fix und Basis, dieselben 5 Altlasten (VramCredit x3, sched_fix3 b4a/b4c).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…dit -- Bruecke f833fcb: D schrieb den Anker 37376 in 16-46s eigenem Extend ('sgl-project#1469 RETAIN rid=weg2-16-46 ... cache_len=37376', 19:50:38), 16-48 setzte darauf auf (19:50:51, '#cached-token: 37376'). Der D-Schlaf 19:51:15-16 verweigerte die Host-Sicherung ('sgl-project#1421 BACKUP-REFUSED why=mamba_pin ... pins=8/8', danach 'why=mamba_claim' hinter 'sgl-project#1427 ARENA-CLAIM REFUSED ... no free slot' der 32-Slot-Arena) und setzte den Baum zurueck ('sgl-project#1470 FLUSH-PUBLISH issued=13 unbacked_left=1', 'Cache flushed'). Nach dem Wake gab der Store den KV zurueck (store_hit=37376), aber keinen Anker ('[sgl-project#904 match-census] ... MambaComponent:absent=37376'); die Front preiste weg2-16-54 trotzdem SHORT (presence 35942 src=d_leg2_cached) -> 17 s D-Sitz, dann W31 am X-Gate (38291 Tok) und W50-Umweg ueber P (12 solche in rc12z26, 8 auf der Bruecke). Das X-Gate auf D preist schon die anker-nutzbare Tiefe (W31), die Front nicht.

Fix: (a) Instrument: sgl-project#1421 BACKUP-REFUSED nennt depth= und rid= (weg2_node_depth, weg2_anchor_rid). (b) Der Flush zaehlt vor tree_cache.reset() jeden nur-Device-Mamba-Anker mit Tiefe (UnifiedRadixCache.weg2_unbacked_anchors, 'WEG2-ANCHOR-LOST at=flush n= depths= rids='); der Scheduler haelt die Tiefen bis zur Schlafantwort (weg2_take_anchors_lost, einmal lesen). (c) Die Gruppenzaun-Stimme des release-Legs traegt anchors_lost (Modulfunktion _weg2_anchors_lost_for_leg, [] auf jedem anderen Leg und ohne Scheduler-Ledger), die Reduktion vereinigt, ReleaseMemoryOccupationReqOutput.anchors_lost, der Tokenizer-Merge vereinigt (Feld fehlt, wenn nichts verloren -> alte Antwortform). (d) Front.flip liest nach completed_tags die Schlafantwort von D und nimmt jeden SpanLRU-Eintrag zurueck, dessen Kredit auf einer verlorenen Tiefe stand (depth_cap, sonst gemessene ct), 'WEG2 PRESENCE-ANCHOR-LOST'; ein Eintrag auf einem ueberlebenden Anker behaelt ihn. Zu viel Zuruecknehmen ist sicher (voller Preis = Preis des X-Gates). Die Rettung des Ankers ueber den Schlaf bleibt bei sgl-project#259 4c. Luecke: Arena-Verdraengung ohne L3 ausserhalb des Flushs erfasst der Ledger nicht (nur die Host-Kopie-Pruefung).

Tests test_weg2_anchor_lost_presence_0928 (10): alle rot auf 1ea8133, gruen mit Fix. Nachbarn 18 Dateien (1424g, H113, H74, R12, sgl-project#59, X-exact, Spans, sgl-project#1470, sgl-project#49/P49, flip_cost_1235, 1273 x2, sched_fix3, W35, Profil, H91e, sgl-project#248): 298 gruen auf Fix und Basis, dieselben 5 Altlasten (VramCredit x3, sched_fix3 b4a/b4c).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 29, 2026
…ist mit seiner einen Seite komplett

rc12z30j 27B (bb82fbc) D.log: jede Anker-Demote-Zeile lautet
'pool=anchor pages=2 written=1 l3_pages=1 absent=1' (242/242, auch Handoffs
beim Boot), NF z30g 286/643. Das ist kein fehlender Anker: der Anker-Pool
haelt ANCHOR_TAIL_KEYS=2 Kandidatenseiten (der End-Anker liegt auf der letzten
Kettenseite oder eine davor), genau eine davon existiert; die andere hat
keinen Slot. Die Zeile zaehlte sie als 'absent' wie eine belegte Seite, und
der Span wurde nie 'komplett' -> jeder Demote-Tick fragte den Store erneut.

- _arena_copy_pages_to_disk trennt absent in missing (kein Slot) und busy
  (nicht bereit, fremde Referenz, zwischen find und pin verschoben).
- demote_once: ein Anker-Span ist komplett, wenn seine vorhandene Seite auf
  der Platte liegt und nichts busy ist; KV-Spans unveraendert (jede Seite).
- Zeile nennt missing/busy/complete.

Tests: test_weg2_park_demote_anchor_0929 (3), rot auf bb82fbc (1), gruen
mit Fix; Nachbarn test_weg2_park_l3_248 + test_l3_reuse_after_restart_0928:
29 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 29, 2026
…a-Claim + Mamba-Evict ohne Endlosrunde -- M1s rc12z30j tot

M1s D-only auf rc12z30j (bb82fbc, Schnitt [0,32,32]/64, D-Log
boot_weg2_dkrnfdh91dprsavisnoadoptstcutvsyncdonlybar109290056_bb82fbcb68_0929_005633.D.log):
alle drei Raenge treten 01:04:50 in denselben Extend ('sgl-project#969 EXTENT n=62'),
TP0 raeumt per Write-Back frei und geht ins Forward, TP1/TP2 schreiben ab
dort nur noch '#969H BACKUP' / 'sgl-project#1421 BACKUP-REFUSED why=mamba_pool_unbound'
/ 'R12 SHADOW-SHORT' (16189 Zeilen, bis 5700/min, immer dieselben node-ids
22/25/32/35/37/46/84) -- 01:06:34 TP0 'Bar1CollectiveAborted ... exceeded
its cycle deadline' im MoE-All-Reduce des Extends (Z. 51493).

Wurzel 1: unter dem Schnitt ist der KV-Hostpool eines Form-A-Workers ein
ArenaMHAHostPool (seine Zeilen sind die Seitenbytes), sein Mamba-Hostpool
bleibt der schlichte byteless R12-Schattenpool ('mambahost=MambaPoolHost',
'R12 SHADOW-CAPACITY mamba anchor rows +64 ... 0 B/row'). Der Direct-Pfad
(#1427b) verlangte fuer den Anker einen Mamba-ARENA-Slot, fand keinen und
verweigerte den ganzen Knoten -- jede Worker-Sicherung, auch die der
Eviction. Fix: auf einem KV-only-Rang (rank_role.kv_only_rank) mit schlichtem
Mamba-Hostpool nimmt der Anker eine Schattenzeile aus diesem Pool
(controller.write, Staging-Weg); ist der Schattenpool voll, geht die
Eviction KV-only (P-FUND-Form), R12 gleicht den Anker ab. Gewichtsrang und
klassische Raenge unveraendert (dort bleibt die Verweigerung benannt).

Wurzel 2: MambaComponent.drive_eviction startet am LRU-Ende neu, sobald der
Nachfolger nicht in der Liste ist -- auch am Listenkopf (get_prev -> None).
Ohne Fortschritt ist das eine Endlosrunde im Scheduler-Schritt. Fix: eine
neue Runde nur, wenn die vorige etwas frei gemacht hat; sonst endet die
Eviction kurz, benannt ('MAMBA-EVICT NO-PROGRESS').

Kein Schalter, keine Reserve; Decode/Flip unberuehrt.
Tests test_cut_worker_shadow_anchor_m1s (7): 6 rot auf bb82fbc (Livelock
mit der Metall-Signatur, Worker-Backup 0, Evict frei 0), gruen mit Fix;
1 Waechter (Gewichtsrang verweigert weiter) gruen auf beiden. Nachbarn
(P-FUND, R12, R12-Schnitt, sgl-project#248, sgl-project#910, sgl-project#1481, kv_only_rank, EB, rc12o):
94 gruen; 639b 16 Altlasten identisch auf Basis und Fix, 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
… store_rescan in benannte Teile

Marker-Audit (29.09.), TP0 WEG2-WAKE-TAIL Median z30w-park gegen x178: reload
111/44, dest_hook_compare 123/13, store_rescan 146/1 ms (A 2,22 gegen 2,01 s).
Jede Phase umfasst mehrere Aufrufe; keine Zeile sagte, welcher wuchs:
- reload = legs_barrier (tp_cpu_group, wartet auf die Legs des langsamsten
  Rangs) + reload_weights
- dest_hook_compare = static_import + dest_leg + shadow_compare (STEP 6c,
  Beobachter; meist abgelehnt, darum NICHT verschoben, erst messen)
- store_rescan = rescan (async seit 28.09.) + hold_release (sgl-project#1443/sgl-project#248 Reads,
  Settle-Urteil mit Gruppen-Collective)
Neue Zeile "WEG2-WAKE-TAIL-SUB ms ..." neben der unveraenderten WAKE-TAIL-Zeile
(Phasennamen bleiben, jedes Audit liest weiter). Nur perf_counter, kein Sync.

Tests test_weg2_wake_tail_sub_f22 (2, Quellform: die RPC braucht einen echten
Memory-Saver): auf 895559f rot, gruen mit Fix. 51 betroffene Suiten: 792
gruen, Altlasten wie Basis; test_weg2_scheduling_slice_a_0907::test_t1_* einmal
rot im Block, einzeln 3/3 gruen (zeitabhaengig, Front, unberuehrt).
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 1, 2026
…asses over the sgl-project#243/sgl-project#248 keep (z30y12 epoch 50: six park resumes W31, 381k tokens to P)

Metal z30y12 (df1f815, 30.09.): P PP0 "ARENA-EVICT n=11 want=256" at
23:35:32 (the L3 fill / arena write callers floor want at 256 slots); 3 s
later the MAMBA arena read "ARENA-REF-CENSUS arena-78446592.bin slots=112
complete=0" on every P rank, D's MAMBA census went park_kept=6/12 -> 0/12.
At the 23:35:44 wake all six D-parked requests read their KV back
("HiCache prefetch success ... loaded=53503") but no anchor ("[sgl-project#904
match-census] verdict=refused ... refusers=MambaComponent:53503
why=MambaComponent:absent"), the X gate priced each whole (X-GATE-TERMS
head=0 store=0 floor=0 -> W31) and W50-REROUTE sent 381501 tokens to P --
the flip of epoch 50. weg2-35-112 came through 4 s later with uncached=150
after one anchor page was filled back from L3 (sgl-project#1433, TP1 23:35:47). The
second collapse (D TP0-2 "ARENA-EVICT want=256" 23:42:10, MAMBA complete
110 -> 8) has the same shape.

Root: HiCacheFile._arena_evict_to_disk evicts min(want, every unreferenced
complete slot) with only the pins kept. want >= 256 is larger than the
112-slot MAMBA arena, and the sgl-project#248 park / sgl-project#243 hand-off pages are kept by
ORDER, not by reference -- so one round took them all. The claim path
(_evict_for_claim) has passed over that keep since sgl-project#243/sgl-project#248; the clock evict
never did.

Fix: (1) want is capped at an eighth of the arena's slots (FULL/draft arenas:
90112, i.e. unchanged for every caller; MAMBA: 14); (2) the host pools register
themselves on the backend at bind (register_keep_pool), and the clock evict
passes the pool's handoff_pending.keep_for keys as keep_lo (stage i only:
kept pages are never its candidates).

Tests (CUDA_VISIBLE_DEVICES="" nice -n 19 ionice -c3):
test_evict_keep_mamba_arena_0930.py (real ShmArena): base 2 failed (the
unregistered case is behavioural: 8 of 8 slots evicted), fix 2 passed. Mutant A
(keep_lo dropped): 1 failed (the parked anchor leaves L2). Mutant B (cap
dropped): 2 failed. Affected files (park_l3_248, arena_reset_release_h81,
prefix_trace_in, probe_hold_257, w3_arena_spill, arena_host_pool_1424,
arena_l3_fill_group_rc12z, arena_l3_fill_1433, l3_reuse_after_restart,
hicache_shm_arena_1404, mamba_arena_displace_h19, new file): 94 passed,
4 failed -- the same 4 fail on the base df1f815/92c9c18020 sources
(arena_host_pool_1424 x3, arena_l3_fill_group_rc12z x1), not touched here.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 1, 2026
…NG line per park per rank (z30y13 park RPC 0.36-1.41 s ahead of every D->P flip, one-second log stamps only)

The D park RPC (sgl-project#1476 DISPATCH kind=Weg2ParkRunningReqInput) costs 0.57-1.84 s
on z30y11/y12/y13 before the flip begins, equal on all ranks (the y12 fit:
416 ms + 188 ms per 100k parked pages). Its log carries one-second stamps, so
which step pays was a guess. Second-boundary crossings over the 14 z30y13 parks
(11.9 s dispatch total, TP0) put ~7 crossings inside retract_all, ~4 inside the
sgl-project#248 PARK-MARK chain (TP0 only), ~2 between the retraction and the note loop,
0 in #59b -- an estimate, not a measurement; hence this line.

park_running now laps a monotonic clock, contiguously, and prints once per park
on every rank (same fields, same order):
  land_ms draft_ms retract_ms (forced host write-through) note_ms
  mark_ms mark_chain_ms mark_write_ms mark_keys (sgl-project#248, park_l3.LAST_MARK_STATS)
  probe_ms coll_ms (#59b admission probes / the tp-min reduce, timed by a
  reduce_min wrapper around the default _tp_min -- on TP1/TP2 coll_ms is the
  wait for TP0's mark chain) rest_ms total_ms
  running retracted seq_tokens resumable_tokens pages page_size
  wt_host_slots wt_bytes (host pool slots the retraction's write-through took)
Instrument only: nothing branches on it, every read is guarded.

Tests (CUDA_VISIBLE_DEVICES="", nice/ionice, htsglang-gpu venv):
- new test/registered/unit/weg2/test_27b_park_timing_1001.py: 3 passed --
  the real park_running -> real park_l3.mark_parked -> real park_depths/
  group_depths (tp-min), leaves advance a fake monotonic clock.
- mutants all killed: retract lap folded into draft (1 red), collective not
  timed (2 red), no line (3 red, = base), mark write counted into chain (1 red).
- neighbours (43 files: *park* + importers of d_park_runtime/park_l3/
  weg2_resumable_depth): 483 passed / 4 failed, base 0c4238f the same
  483/4, identical failing set (resumable_depth_59 anthropic carrier,
  form_a_dcp_s3d_239 f13 anchors, parked_abort_w1b_1401 x2).
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
…rids the whole D group keeps on the card -- only when every rank predicts the same hold

With L15 and SGLANG_WEG2_ENABLE_WAKE_READ_EARLY both on (the release
plan), the early read pulled the held requests' prefixes from the store
although the L1.5 hold brings them back on the card: duplicate store I/O
and arena refs on the wake path. issue_reads_at_wake_begin (same point of
the same RPC on every D rank) now asks l15_agreed_held_rids: each rank reads
its manifest WITHOUT consuming it and votes (fingerprint, held rids) when it
will vote for the hold (capped rank, or cap-0 rank with REFILL on and every
anchor named), else None; ONE host all_gather over the decide's group; the
rids are skipped only when every vote is identical and not None. Any
disagreement -> no filter (duplicate I/O, never a split read set). A
skipped request stays deferred, so if the later verdict falls back its read
is issued at the release as before. Master off: no collective, unchanged.

Tests: identical votes -> filter, cap-0 without refill / mixed votes -> no
filter, master off -> no gather, the wake-begin read skips exactly the
agreed rids. Related tests (park_l3/248/dormant/wake_read): 203 passed, 4
failed pre-existing (dormant_vram_1y, launcher_teardown_1248 also fail on
1156486).
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
…troyed the early hold read (N4f ping-pong)

N4f 1002_110321 (L15 on, WAKE_READ_EARLY on by default since d1e5da0):
11:11:19 sgl-project#248 WAKE-READ-EARLY issued=3 for D's parked rids (weg2-10-16,
weg2-11-17, weg2-18-20); 11:11:21 HiCache prefetch success weg2-10-16
loaded=203826; then the kv wake's L15 path (L15-REFILL anchors-missing:
votes no hold, L15-RESTORE no hold kept) reset the tree (sgl-project#1427 ARENA-REF
RESET-RELEASE released=203827, HOST-POOL CLEAR) and the read was gone:
X-GATE weg2-10-16 uncached=206952 W31, weg2-18-20 uncached=14384 W31,
W50-REROUTE x_refusal_midstream of both to P, FLIP-ECONOMICS p_only=2 ->
D->P 4.0 s after the P->D (11:11:21.9 -> 11:11:25.97, MIN-DWELL held 3.9 s):
the ping-pong of N4f. The release-time read is issued after that reset and
survives it.

park_l3.early_enabled() now also requires SGLANG_WEG2_L15 off (read via
l15_plan.master_on, the group's env -> the same on every rank). No L15 code
touched. Until the L15 wake keeps a completed hold read or skips the
L15-held rids rank-uniformly (l15-lead), L15 boots read at the release.

Test (flock pytest.lock, systemd-run MemoryMax=4G, nice 19, ionice c3, -n 1;
the 31 dormant-hold / hold-read / wake-tail files):
  this commit: 312 passed (+ test_red_pdflip_early_read_is_off_under_l15,
               RED on e34d3ee)
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
…de the collects, not all before the first resume

WEG2-WAKE-TAIL read_early (the early sgl-project#248 hold-read registrations on D's
scheduler thread, before the first resume/collect of the legs, while P's
depositors wait for D's collect): N4p p50 89 / max 319 ms, N4f p50 301 / max
789 ms; one registration up to 161 ms (post_ms 118). All of it in the P->D
total.

Now (SGLANG_WEG2_WAKE_READ_EARLY_SPREAD, default on): nothing at the legs'
start; after each weight tag's collect went to the worker the loop issues ONE
deferred hold read (park_l3.issue_reads_at_wake_begin(max_n=1), hold order),
the rest after the last tag, before the collect join. The registrations run
beside the collects; the reads still start during the legs (the nachlauf gain
of WAKE_READ_EARLY stays). Rank-uniform: the same tag list and hold order on
every rank, and the read's vote is the only collective on this thread inside
the loop (the collect workers use lanes/IPC/sockets, no torch.distributed).
Marker: sgl-project#248 WAKE-READ-EARLY-SPREAD issued=N tags=K read_early_async_ms=X;
WAKE-TAIL read_early ~0. =0 restores the legs'-start issue. Under L15 the
early read stays off (a065d69).

Test (flock pytest.lock, systemd-run MemoryMax=4G, nice 19, ionice c3, -n 1;
the 31 dormant-hold / hold-read / wake-tail files):
  a065d69: 312 passed
  this commit: 314 passed (+2, both RED on a065d69)
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
N4f (257e090, L15 on, release mix) was a regression: every wake
verdict none, keep-arm FAILED on TP1/TP2, TP0 'bad=64', bind 0.5-0.9 s per
sleep with nothing held, 6 W50 client aborts. Causes and fixes:

1. L15-FIX-REFILL-POOL: TP0's refill handed the hybrid wrapper
   (HybridLinearKVPool, no k_buffer) to the arena loader -> 'refill: page
   load failed: AttributeError' on EVERY wake, the sample then read zeros
   (L15-CHECK-DIAG live_absmax=0 foreign=64 -> bad=64). Refill, the wake
   sample, P's L2Loader and D's deposit adopt now unwrap to the
   full-attention pool (l15_shadow.kv_pool_of).
2. L15-FIX-WHOLE-HOLD: a base whose merged hold regions cover the WHOLE
   allocation (the mamba conv base: 34 bases, split=33) got a one-range
   plan = the saver's stock mapping -> no span extent -> the arm refused
   via L15-EXTENTS (N3y's 'export of extent @0 rc=-2' is the same base).
   ensure_split cuts such a region into two span extents at a granule.
3. L15-SLEEP-AGREE: the ranks decide the hold together. PRE gather before
   any bind/retain: a capped rank needs its split on the saver, a cap-0 rank
   needs REFILL -- any no -> nobody binds or retains (first sleep of a boot,
   REFILL off: ~0 cost). POST gather after the arm: every rank armed and a
   cap-0 rank has every END anchor's L2 identity (N4f 'anchors-missing:
   votes no hold') -- else the armed ranks undo (manifest, keep spans,
   sleep refs, share) and every rank flushes plain. No rank keeps chains the
   others dropped, so the wake needs no divergence drop: the parked
   requests' sgl-project#248 hold reads survive (W50 class; P->D seat turned
   WAKE_READ_EARLY off under L15 meanwhile).
4. L15-FLIPCOST-4: bind's per-slot owner_of (prefix re-validated every
   call, ~250k calls) -> one numpy owner count.
5. L15-FIX-CHECK-NOVOTE: a rank voting no hold skips the 64-row sample.
6. The trim line names keep_rows/caps/l_h (diagnosis of N4f's first-flip
   trim).

Tests: whole-base hold split + kept (red without), sleep-agree pre/post
votes, undo, wiring order pre<bind<arm<post, post vote needs cap-0 anchor
identities, owner counts vs scalar rule, refill/sample use the full pool,
integration: agreed no-hold wake resets no tree (parked reads kept). Gate
(l15/slots_guard/refill/dormant, capped -n 1): 802 passed; 3 failed are
pre-existing (dormant_vram_1y, xchg_seam_wiring_1273).
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
…D->P quiesce (WEG2-QUIESCE-PARKED-PREFETCH)

N5d 1002_124821 epoch 6 (D->P begin 12:51:58.621, 14.3 s, layer 12.6 s):
weg2-6-10 (SHORT on D, 171166 tokens, 169224 in L3) was admitted 12:51:48; its
store read (READ-STAGES l3fill_pages=104379 total_ms=15886) still ran when the
front parked D (park_running ... queued-behind=['weg2-6-10']). Every
/flush_cache quiesce poll answered 400 'hicache_prefetch(1: weg2-6-1)' (547x),
FLIP STALL stage=quiesce at 9.8 s -- and the request went into the sgl-project#1443 hold
anyway once the read ended, re-read at the wake.

Helper weg2_sleep_drain.parked_owned_prefetch(parked, ongoing_prefetch): the
open reads of requests in sched.weg2_d_parked. They are a storage->HOST
operation whose device half is the wake's load; the release flush's reset
terminates and joins them (sgl-project#1068 RESET JOIN) and the sgl-project#248 hold intake defers
the read to the wake. Exempt (like H91e's hold-owned reads) in:
* Scheduler.group_idle_verdict -- the quiesce poll's and the release flush's
  idle (module helper _weg2_parked_owned_prefetch_of), marker
  WEG2-QUIESCE-PARKED-PREFETCH rids=.. n=..;
* WeightUpdater._weg2_hold_owned_prefetch -- the sleep drain and the release
  leg's idle assert.
Rank-uniform: the park list is replicated (park_running is a broadcast control
request, every rank parks the same list) and prefetch registration is
participation-voted. Switch SGLANG_WEG2_PARKED_PREFETCH_NOT_A_SLEEP_TERM
(default on; 0 = the old blocker).

Test (flock pytest.lock, systemd-run MemoryMax=4G, nice 19, ionice c3, -n 1;
17 files touching group_idle_verdict / idle_blockers / sleep drain):
  e03d95c: 13 failed (pre-existing: idle_round_fresh_1268, quiesce_fast_h111,
              tail_fold_store_h63d, ...), 175 passed
  this commit: the same 13 failed, 179 passed (+4 in
               test_pdflip_parked_prefetch_1002.py)
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
…d -- the sgl-project#248 release records its rows and arena generation

N5n (dac8b62) 14:44:07 TP1: 'sgl-project#248 LOADED-HOST-RELEASE nodes=1 rows=131028'
-- the load-back of weg2-8-8 (P's prefill pages, read from the shared arena)
was released right after the load to free its references; the pages stayed
COMPLETE in L2, but the node forgot where. At the 14:44:17 sleep the chain was
unbacked (L15-HOSTLOCK slots=2304 of 133410 tokens), the cap-0 refill had 1006
of ~47k rows, the hold was paid and dropped (4ec348b now refuses that case).

Now, under the L1.5 master (SGLANG_WEG2_L15_L2_SHADOW, default on), the
release records per released node its host rows and each row's arena slot
generation at THAT moment (one census per release, park_l3.record_l2_shadow,
marker 'L15-L2-SHADOW recorded nodes= rows= slots='). l15_bind adopts a node's
shadow when it has no live host_value (chain_host_rows_ex; length must match
the node's tokens, a radix split falls back to -1) and keeps a shadow row only
where the slot STILL carries the recorded generation in the bind's census
(a re-claim bumps it -> (-1, -1), never a foreign source); per rid
'L15-L2-SHADOW-ADOPT rid= tokens= live= shadow= valid= stale='. The adopted
slots feed the manifest, the hostlock pin (L15-HOSTLOCK-COVER backed=) and the
cap-0 refill like live rows. Rank-uniform: every D rank runs its own release on
its own shard's arena (no Form A verdict on this form).

Residual window: between the bind census and the hostlock pin a re-claim could
slip in (ms); the wake's refill gen check (cap-0) and the capped ranks' sample
catch it as a clean fallback.

Gate (CUDA_VISIBLE_DEVICES empty, MemoryMax=4G, -n 1): new
test_weg2_l15_l2_shadow_1002.py (record takes the release-time gen; shadow
rows adopted where the gen matches, live tail kept; a re-claimed slot is -1;
no shadow / split shadow -> old placeholders; master-gated) + test_weg2_l15_*.py
+ park_l3/248 neighbours: 598 passed; 3 failed are
test_weg2_launcher_teardown_1248 and red on 4ec348b too. The new file is red
on 4ec348b (no chain_host_rows_ex / record_l2_shadow).
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 14, 2026
… read from L3 into a host staging row

NF h13 84e787e (boot 1014_135753), D TP0 14:16:17, weg2-10-82: the
32-slot mamba arena was full of the lane-held requests' PARK anchors
(sgl-project#248 PARK-DEMOTE pool=anchor, MAMBA-ARENA DISPLACE why=park_first);
every lane resume read its 921 KV pages in 2-6 ms and then waited the
5 s ROOM-WAIT for the anchor (rounds=196 claimed=0 still_full=1), D's
store vote was 0 (X-GATE store=0 W31), W50 to P, full prefill -- three
times (LANE-REPREFILL 14:16:17 / 14:17:15 / 14:17:45), although the
anchor blob was on disk.

ArenaMambaPoolHost.arena_resolve_reads: when the blob is not COMPLETE in
the arena, a host STAGING row (the pre-arena row path) is taken first and
the fill runs without the room wait (arena_fill_from_disk room_wait=False).
A slot from the fill wins and the row goes back; otherwise the staging row
replaces the placeholder and None sends the key down the per-key read
(HiCacheFile.get -> _get_canonical_slice, this rank's extents of the
canonical blob). A failed read releases the row with the transfer's host
indices like any miss. No staging row free = the old path (room wait,
then miss). SGLANG_WEG2_MAMBA_ANCHOR_BYPASS=0 = arena-only.

Tests: py_compile OK; test_mamba_anchor_bypass_1014.py (4) +
test_arena_mamba_direct_1427, test_l3fill_join_wait_0930,
test_l3_fast_read_0928, test_weg2_mamba_arena_displace_h19: 42 passed,
1 timing microbench flaky under load (passes alone, 1 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
…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 15, 2026
…- PP0 liest nach D's Flip-Flush neu, gehaltene Spannen halten ihre L3-Kopien jung

Typ A (Boot 133855 Epoche 127): weg2-126-628 endete auf D bei cache_len=45824, Store 38656. D faehrt
write_back; die 50 un-backed Knoten kamen erst in der Flip-Flush in den Store (PUBLISH-SWEEP
unbacked=50 issued=37, WRITE-BACK DRAIN n=38, 15:17:09.1), P's ruhende Lesung von weg2-126-651 endete
in derselben Sekunde bei 38656 (PLE-HINT start_hint=45568). Fix: der Front-Hint wird im Scheduler
gemerkt (short_read.note_hint); P-HELD-REREAD loest auch aus, wenn die Lesung >= 1 Seite unter dem
Hint endet -- ruhend haelt PP0 den Told (P-HINT-REREAD WAIT), wach liest PP0 einmal neu, ohne
Fortschritt geht der Told wie bisher. PP0 entscheidet, Folger folgen dem Told. Schalter
SGLANG_WEG2_P_HINT_REREAD, Vorgabe AN.

D-Park-Resume (weg2-40-179): PARK-DEMOTE pool=kv pages=1832 written=8 -- 1824 Seiten verliessen sich
auf alte L3-Kopien, sgl-project#248 Stufe ii gab die gehaltenen Slots dagegen frei, die L3-LRU (EVICTION-BG,
Deckel 150 GB, 14:12/14:20) nahm die aeltesten Dateien: beim Resume #1028B kv=865 (Fork 55360 jung,
privater Schwanz in keiner Stufe mehr). Fix: HiCacheFile._l3_refresh_kept macht jede Kopie, auf die
sich eine gehaltene Seite verlaesst, samt QSA-Zwilling MRU -- im Park-Demote (mit mtime) und in
arena_secure_to_disk (nur In-Memory-LRU, keine Platten-I/O auf dem Scheduler-Thread). Kein neues
Backup, keine Arbeit im Schlaf-Drain (k12b). Schalter SGLANG_WEG2_L3_REFRESH_KEPT, Vorgabe AN.

Tests: test_weg2_zero_anchor_store_complete_1015.py 13 (Epochen 103/127/149, weg2-40-179-Form auf
echtem HiCacheFile + L3-LRU) gruen, auf 525c734 13 rot; mit test_weg2_p_held_reread_1014 22 gruen.
Mutanten: kein Dormant-Halt ROT 1, Hint Vorgabe AUS ROT 5, ohne QSA-Zwilling ROT 2, ohne Claim-Raum-
Refresh ROT 1, ohne Demote-Refresh ROT 1. Regression 76 Dateien / 924 Tests: Kopf 27 rot = Basis 27
rot, nur-Kopf 0. Kaltstart-Rig s7s8 @ 2820a88 28/28 GRUEN rc=0. Gegen desk/nf-h16p-k12b-1015:
unified_radix_cache-Hunk wendet sauber an, sonst keine gemeinsamen Dateien.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 15, 2026
…for a P read -- TP0 decides for the group, the workers follow its R12 verdicts, anchors stay

The KV arena is ONE file shared by group P and group D; a slot is free only when no rank of either group holds it.
READ-ROOM (73b1a36) armed the local-PP floor only, and _w3_arena_spill returns 0 under R12, so group D never
answered a room request. Boot ..._226aad7105_1015_124245, weg2-70-293 (13:35:34-39): READ-DEPTH landed=47 of=1832
cause=arena_full on all three P stages; arena-786432.bin pinned=6485 of 6485 refs=21495; P own_held=2258 per stage
(running requests), D TP0/TP1/TP2 ARENA-REF-HOLDERS (13:35:42) tree=3215 tree_in_use=1692 own_held=4907: the host
copies of D's live tree and of the five requests D had just parked (WEG2-D-PARK park_running ... span retained;
sgl-project#248 PARK-DEMOTE ... l3_pages=996 absent=0 -- already on the L3 disk). D gives them back only at its sleep's
sgl-project#1427 RESET-RELEASE. (That boot then died of W120 -- root K12, a dead backup thread on D TP0, nf-k12-sleepdrain-1015;
not claimed here.)

READ-ROOM-D (weg2/read_room.py only):
- armed: local-PP floor OR a rank of a Form A TP group (R12 role host/worker): every rank of D posts its fills'
  need and waits the same bound; serves: local-PP floor or Form A TP0 only -- a worker never releases on its own;
- serve on Form A TP0 -> form_a_spill: device-resident nodes with a KV host copy; secure_rows_to_l3 first
  (arena_secure_to_disk: lost != 0 or nothing COMPLETE keeps the node); aux host rows, then the KV rows (sgl-project#248
  LOADED-HOST-RELEASE rule); l3_present; R12 record_state(why="read-room") -- every worker drops the same rows at
  the next tp<-reqs broadcast (form_a_host_shadow._reconcile). Kept: a node with a Mamba anchor on the host (a
  parked request keeps its anchors as they are), host lock / pending write-through, aux state on the host only,
  host-only nodes (the sleep reset gives those back). Order: the group-equal _w3_spill_keys. Named line
  READ-ROOM D-SPILL;
- the hybrid HostPoolGroup resolves to its anchor host pool under READ-ROOM's own switch: the NF profiles set
  SGLANG_WEG2_ENABLE_W3_SPILL_ANCHOR_POOL in NF_ENV_P only, D would have stopped there.
A parked span given back is read again by stem at the resume (L2 while the slot holds it, else the L3 copy written
before the release): the whole span to its last anchor, never short, never recomputed.

Tests (test_weg2_read_room_d_1015.py, real C arena + real HiCacheFile.arena_fill_from_disk, real UnifiedRadixCache
trees for D TP0 and its worker, real R12 attach/consume/_reconcile), under pytest_gedeckelt.sh: head 8 passed; the
same file on f5278f4: 8 FAILED (the two integration cases by behaviour: D's serve released 0, the read landed
0 of 16). Mutants scripts/mutants_arenaread_d_1015.py (one lock turn): 13 of 13 KILLED.
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.

1 participant