Repository navigation
Add Support for XVERSE Models (Dense and MoE) to sglang - #1397
Merged
Merged
Conversation
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
…1397) Co-authored-by: will he <[email protected]> Co-authored-by: root <[email protected]> Co-authored-by: Lianmin Zheng <[email protected]>
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…nce lane The sgl-project#1374 W68 refusal has named its own alternative since the day it was written ("reduce the pause granularity below the tag") and it was never built. User order 2026-09-14 on that finding: "ja dann - bauen!". CrossSlotRendezvous gets a new per-BAND drain credit (post_band_drained / wait_band_drained / prime_band_drain), reusing the dead second row of the `full` semaphore family -- no new substrate, same doctrine as sgl-project#1374's own counting `full`/`empty` rows. run_bounce_leg wires it in only for a CROSS pair (rendezvous.pair is not None): a diagonal (co-located) lane's own collector's `resume` is gated on THIS rank's not-yet-published VRAM credit (weight_updater.py's pause/credit loop, read-only here), so a wait for that collector's drain inside this rank's own deposit loop, before that credit is published, would recreate the exact circular wait sgl-project#1374 deleted after boot weg2xsn30 (test_the_per_band_claim_cannot_return). A cross lane has no such cycle: its collector's credit gate names a DIFFERENT rank whose own deposit does not wait on anything from this lane, so the wait bottoms out instead of cycling back -- see DESIGN_option3_band_credit_0914.md for the full derivation. xchg_bounce.BounceTerms gets band_credit/n_cross_lanes (default False/0, byte-identical) and cross_lane_slots/cross_lane_buffer_bytes, priced WITHOUT the max(buffer_bytes, lane_buffer_bytes) guard the diagonal share still uses -- that guard would otherwise re-substitute the bigger, unallocated pre-sgl-project#1374 geometry and swallow the whole saving (the sgl-project#1386 trap, measured on this rig's own figures: buffer_bytes 2.11 GiB > cross_lane_buffer_bytes 384 MiB at slot=128 MiB/depth=2). Tests (test_weg2_band_credit_1397.py): sizing pins (today's measured 15.75 GiB unchanged by default; Option 3's naive all-cross ceiling and the realistic bound this rig's N_CARDS=3 imposes), the mechanism on real POSIX semaphores, a real cross-process leg proving in-order wrapped reuse, byte-identity of what moves, and both mandatory danger mutants: M1 (credit check bypassed) and M2 (credit posted before the collect's own device copy landed -- the worse, silent direction). All 17 new tests verified RED without this change (git checkout + reapply patch) and GREEN with it; the existing weg2 bounce/lockstep/lane suite (764 tests across every file touching either module) stays green. Not wired: launcher.py never passes band_credit=True and weight_updater.py never counts a flip's real cross/diagonal split -- both out of this ticket's file boundary (DESK9/DESK10), named as open work in the design doc.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…gl-project#1385 interaction Coordinator order (Paket D): investigate --xchg-lanes-concurrent (sgl-project#1385) x band_credit (sgl-project#1397) combined, unbuilt/untested before this commit. Read weight_updater.py's lane loop (DESK9/sgl-project#1385, not my file, read-only): it passes `terms` straight through to run_bounce_leg and never independently re-derives a slot size, so the "ledger prices both knobs, lane loop honours neither" mutant the coordinator asked about has no second producer to go wrong in this codebase today. What COULD go wrong is a caller over-stating n_cross_lanes, or stating band_credit without its Option 1 precondition (max_tag_bytes > 0) -- the latter would price the small oncard cross geometry while run_bounce_leg's _band_credit_leg (which requires _option1_leg) falls back to the pre-Option-1, widest-layer-sized floor: the identical slot-size/slot-count mismatch sgl-project#1385 round 3 measured at 5.6x on boot weg2xsn31/4, with band_credit as the new second reader. bounce_terms() now refuses that combination by name instead of letting it coincide. n_cross_lanes_priced/n_diag_lanes_priced were already derived from lanes_priced (the sgl-project#1385 cap-aware property), not raw n_lanes, so a lanes_concurrent cap already narrows the cross share correctly by construction -- confirmed with a new pricing test rather than assumed. unlink_lane_buffer (sgl-project#1385 round 4) sits at rv.post_drained(tag=...), the per-tag drain row (sgl-project#1374, row 0 of `empty`) -- untouched by band_credit's own row (row 1 of `full`). Proven end to end: a real multi-wrap band-credit tag runs to completion, then the exact weight_updater.py sequence (post_drained -> unlink_lane_buffer) is exercised and the file is present before, gone after, bytes correct throughout. Also read fix/1391-card0-collector round 4 (5d69392, DESK10, not merged into train-0911, not my file) on the coordinator's explicit question of whether it changes the diagonal-lane safety argument. Verdict, not a decision: no. Round 4 fixes an inter-tag bug (shadow mode's diagnostic collect ran once for the whole wake instead of per tag); weight_updater.py:4671's _weg2_await_vram_credit still precedes :4675's resume(tag) unconditionally, and every collect call (exchange or now shadow) still runs only after that credit -- the per-tag, whole-deposit-before-pause-before-credit sequence on the source side is untouched. The diagonal fence this ticket's design doc describes stands. 23/23 tests green (17 pre-existing + 6 new), verified red-first for the new refusal via git checkout + patch reapply. Design doc addendum: /spinning/gpu-arb/weg2/DESIGN_option3_band_credit_0914.md section 8.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…gl-project#1385 interaction Coordinator order (Paket D): investigate --xchg-lanes-concurrent (sgl-project#1385) x band_credit (sgl-project#1397) combined, unbuilt/untested before this commit. Read weight_updater.py's lane loop (DESK9/sgl-project#1385, not my file, read-only): it passes `terms` straight through to run_bounce_leg and never independently re-derives a slot size, so the "ledger prices both knobs, lane loop honours neither" mutant the coordinator asked about has no second producer to go wrong in this codebase today. What COULD go wrong is a caller over-stating n_cross_lanes, or stating band_credit without its Option 1 precondition (max_tag_bytes > 0) -- the latter would price the small oncard cross geometry while run_bounce_leg's _band_credit_leg (which requires _option1_leg) falls back to the pre-Option-1, widest-layer-sized floor: the identical slot-size/slot-count mismatch sgl-project#1385 round 3 measured at 5.6x on boot weg2xsn31/4, with band_credit as the new second reader. bounce_terms() now refuses that combination by name instead of letting it coincide. n_cross_lanes_priced/n_diag_lanes_priced were already derived from lanes_priced (the sgl-project#1385 cap-aware property), not raw n_lanes, so a lanes_concurrent cap already narrows the cross share correctly by construction -- confirmed with a new pricing test rather than assumed. unlink_lane_buffer (sgl-project#1385 round 4) sits at rv.post_drained(tag=...), the per-tag drain row (sgl-project#1374, row 0 of `empty`) -- untouched by band_credit's own row (row 1 of `full`). Proven end to end: a real multi-wrap band-credit tag runs to completion, then the exact weight_updater.py sequence (post_drained -> unlink_lane_buffer) is exercised and the file is present before, gone after, bytes correct throughout. Also read fix/1391-card0-collector round 4 (5d69392, DESK10, not merged into train-0911, not my file) on the coordinator's explicit question of whether it changes the diagonal-lane safety argument. Verdict, not a decision: no. Round 4 fixes an inter-tag bug (shadow mode's diagnostic collect ran once for the whole wake instead of per tag); weight_updater.py:4671's _weg2_await_vram_credit still precedes :4675's resume(tag) unconditionally, and every collect call (exchange or now shadow) still runs only after that credit -- the per-tag, whole-deposit-before-pause-before-credit sequence on the source side is untouched. The diagonal fence this ticket's design doc describes stands. 23/23 tests green (17 pre-existing + 6 new), verified red-first for the new refusal via git checkout + patch reapply. Design doc addendum: /spinning/gpu-arb/weg2/DESIGN_option3_band_credit_0914.md section 8.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…'s arming BOOT7's pyright gate on the train tip measured 401 errors against a 5a1c3f0 baseline of 395 -- 6 new, all from sgl-project#1397 Paket D (7331bbf), none from sgl-project#1391 or A/B/C. Fixed first, per order, before any further wiring: - 5x reportOptionalMemberAccess in run_bounce_leg: `terms`/`rendezvous` read as Optional at sites `_band_credit_leg`/`_option1_leg` already prove non-None by their own definitions, just not visibly to the type checker. Replaced the `slots = (... if _band_credit_leg else ... if _option1_leg else ...)` ternary with an if/elif/else carrying an `assert terms is not None` in each branch (as a side effect this also fixes the one such site that predates sgl-project#1397 and was never narrowed); added `assert rendezvous is not None` at the two remaining sites (`prime_band_drain`, the wrap-check's `wait_band_drained`/`budget_s`/ `pair` reads). Net 5 errors on these two files against a 6-error baseline -- an improvement, not parity. - 1 real type error: `read_published_terms` built its `kw` dict uniformly with `int(value)`, so `band_credit` (the one bool field among otherwise-int fields in _TERM_FIELDS) reached `bounce_terms(**kw)` as an `int`. Harmless today (nobody publishes a nonzero value yet) but exactly the seam this session's wiring makes live: any nonzero int is truthy, so band_credit could arm itself wherever a corrupted or hand-edited env value landed a 2 instead of a 1. Fixed with an explicit bool cast for that one key, PLUS a validation that refuses anything other than 0/1 by name instead of coercing it -- publish_terms itself only ever writes those two. Then the actual wiring the coordinator asked for. Prior-art-gate against both existing bounce flags (--xchg-bounce-depth 48adc00, --xchg-lanes-concurrent 45477c1): both needed launcher.py's argparse (47 and 94 lines respectively) plus checkpoint_census.py's widest_layer_terms() passthrough -- neither in this ticket's file boundary, and every existing flag in this subsystem took that exact path with zero exceptions. Verdict: band_credit's own boolean genuinely cannot be armed from nothing without launcher.py (named with file:line, not invented around). What CAN be built here: bounce_terms() now auto-derives n_cross_lanes (when band_credit=True and the caller left it at None, its new default) via resolve_cross_lanes(n_lanes) -- a pure pigeonhole argument, not a per-boot measurement: a diagonal lane needs pair_of(r,r) is None, so there are structurally never more than weight_exchange_region.N_CARDS of them, and n_lanes - N_CARDS is therefore a hard lower bound on the genuinely-cross count for ANY assignment of which specific lanes are diagonal. This also answers DESK10's cross-session question about a rank with a different real cross set than assumed: it cannot exceed this bound because the bound never depended on which lanes are cross, only on how many diagonal lanes could exist at all. An explicit n_cross_lanes=0 is still respected literally and never promoted (only None, "never given", triggers the derivation) -- the same raw-is-None convention resolve_lanes_concurrent already uses one screen up. Net effect: arming reduces to ONE boolean. n_lanes=5, N_CARDS=3 (this rig) -> n_cross_lanes auto-derives to 2 (the conservative case, assuming every possible diagonal lane is active) -> total_bytes drops from the measured 15.75 GiB to 10.5 GiB (33%) at slot=128 MiB/depth=2, or 9.75 GiB (35%) at slot=64 MiB. The max_tag_bytes refusal built in Paket D is now reachable through this single boolean too (band_credit=True alone, no second misconfiguration needed) -- pinned red-without-the-fix via git checkout + patch reapply. 27/27 tests (17 new this commit), full weg2 bounce/lockstep/lane regression (214 tests across 12 files) green. Design doc addendum: /spinning/gpu-arb/weg2/DESIGN_option3_band_credit_0914.md section 9.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…r schon erreichbar Nutzer-Order 2026-09-14, relayed, auf DESK11s eigenen Befund "der Mechanismus ist gebaut, getestet, aber UNGEWIRT -- weight_updater.py ruft run_bounce_leg nie mit band_credit=True": "ja dann - bauen!". Direkt mit DESK11 abgestimmt (cross-session), bevor die Aufrufstelle festgenagelt wurde: weight_updater.py hat GENAU zwei BounceTerms- Konstruktionsstellen, beide xb.read_published_terms() (:1069, :1204) -- keine lokale bounce_terms(...)-Rekonstruktion, die band_credit/ n_cross_lanes verwerfen koennte. _TERM_FIELDS traegt beide Felder bereits durch publish_terms/read_published_terms. Der phasierte Cross-Pfad (_weg2_xchg_bounce_leg) baut fuer einen echten Cross-Descriptor bereits CrossSlotRendezvous(sems, slots, pair=pair) -- exakt _band_credit_legs zweite Vorbedingung. Ergebnis, unabhaengig verifiziert per Ausfuehrung (nicht nur per Lesen): KEINE Codeluecke in der Durchreichung selbst. Sobald ein Launcher band_credit=1 + konsistentes n_cross_lanes/max_tag_bytes>0 published, reicht der bestehende Code es transparent bis run_bounce_leg durch. Die tatsaechliche Luecke war zweigeteilt und liegt beide Male ausserhalb dieser Datei: der Launcher published es nie (DESK9, sgl-project#1395), und nichts bewies, dass die Durchreichung durch weight_updater.py's EIGENEN Aufrufpfad wirklich funktioniert -- DESK11s eigene Suite treibt ausschliesslich weight_exchange_bounce.run_bounce_leg direkt. test_weg2_1397_band_credit_wiring.py (5 Tests, neu): 1. Positiver Execution-Smoke (sgl-project#1391-Form: zwei echte Threads auf der echten _weg2_xchg_bounce_leg, echtes FakeDeviceOps, echte POSIX- Semaphore, 5 Baender durch einen Cross-Puffer mit cross_lane_slots=1, erzwingt einen echten Wrap): Bytes landen korrekt UND die allozierte Datei ist messbar kleiner als der tag-grosse Lauf derselben Deskriptoren mit band_credit=False, mit den exakten Zahlen ueber die Produkt-eigenen leg_slot_bytes/lane_slots-Funktionen. 2. sgl-project#1397-Refusal-Erreichbarkeit vom echten Wake-Callsite (_weg2_xchg_inject_weights -> read_published_terms -> bounce_terms -> ValueError, ungefangen). 3. Gefahrrichtungs-Mutant (Koordinator-Order): die sgl-project#1397-Refusal wegmutiert -- Ledger preist klein (kein max_tag_bytes-Vorbehalt in diesem Zweig), realer Allokator faellt auf den grossen Widest-Layer- Boden zurueck (_option1_leg fehlt) -- die sgl-project#1385-Runde-3-Fehlerklasse, OOM-Richtung, durch den echten Callsite gezeigt. Rot-vor-gruen selbst verifiziert ohne Produktionscode zu aendern (kein Fix moeglich, wo kein Defekt ist): probeweise die Rendezvous-Konstruktion auf card= statt pair= fuer eine Cross-Gruppe umgestellt (Pair-Identitaet verloren) -- der Groessen-Vergleichstest geht dann rot (24576==24576, kein Unterschied mehr), waehrend der schwaechere Bytes-Test allein gruen geblieben waere. Zurueckgesetzt, Datei identisch zum Ausgangsstand. Erwogen und verworfen (Design-Dokument, Abschnitt 9.3): eine dritte Guard-Ebene, die terms.n_cross_lanes gegen die eigene Pair-Zaehlung spiegelt, analog sgl-project#1358. Verworfen mit Begruendung: _band_credit_leg entscheidet pro Lane ausschliesslich ueber rendezvous.pair is not None (strukturell, aus src_rank/dst_rank), nie ueber n_cross_lanes' Zahlenwert -- ein falscher n_cross_lanes ist ein Ledger-Preisungsfehler (host_ledger.py, DESK9), kein Laufzeit-Korrektheitsfehler dieser Datei. Volle Regression: 119/119 (diese Suite + DESK11s eigene sgl-project#1397-Suite + Gate-Achse sgl-project#1273 + sgl-project#1391 + sgl-project#1369/sgl-project#1394 Paket B + Inject-Wiring sgl-project#1342 + Wcode-Zensus sgl-project#1263). Design-Dokument (/spinning/gpu-arb/weg2/DESIGN_option3_band_credit_0914.md, Abschnitt 9) mit vollem Befund, Beleg-Stufen und dem UNPROVEN-Rest (echter Boot mit band_credit=1 haengt an sgl-project#1395) ergaenzt.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…region per runner), disk-reload becomes the fallback not the default User order 2026-09-14, relayed and reprioritised: "draft ist auch nur ein layer, genau wie die anderen? keinerlei (ABSOLUT KEIN!) unterschied. warum muss er ueber den ring gehen?" -- correct, and the code agrees once the STALE premise underneath the earlier sgl-project#1394 decision (this branch's own prior commit, "the exchange structurally never covers weights_draft") is checked against the current tree rather than assumed. THE STALE HALF, FOUND AND CORRECTED (weight_exchange.py weights_region_tag_for): its own docstring claimed is_weights_family_tag never matches weights_draft, "so they are never in a leg, never in a census and never in a wave" -- untrue since AMENDMENT 6 (user ruling 2026-09-11) added weg2_memory_saver.draft_tag_in_family(), which already returns exchange_armed(). The draft tag has been a family member (paused, censused, waved) all along; the two texts were never reconciled. THE REAL, NARROWER GAP: weight_updater._weg2_shadow_plan resolved every leg's region from self.tp_worker.model_runner alone (the MAIN runner), so family membership bought weights_draft a pause with no mover behind it (verified by execution, sgl-project#1391 round 2). Fixed here: _weg2_shadow_plan now additionally asks the new _weg2_xchg_draft_plan_or_none for the draft runner's OWN region, through the SAME xchg_manifest.leg_plan_from_join every other tag already uses, and unions the descriptors into the returned plan. The existing per-tag filter both production callers already apply downstream needs no change: it scopes to weights_draft correctly the moment real descriptors exist for it. launcher.py's DRAFT_KV_ON_P_DEFAULT = "on" (read only, DESK9's file): group P's shipped default DOES carry the four speculative flags (P_DRAFT_KV_FLAGS), so the older "Group P carries no --speculative-* in this form" premise is stale on the default serving form -- P's own draft/producer runner is a real candidate SOURCE, not a structural impossibility. THE (a)/(b) POPULATION FINDING, verified rather than assumed away (coordinator's own explicit invitation: report a finding with file:line instead of inventing a clean split where none exists). Group D's weights_draft tag measures 1382/1311/1311 MiB, of which the checkpoint's mtp.* term is only 0.396 GiB -- the rest is embed/head shards the draft runner re-materialises. xchg_manifest.join_manifests (DESK9's file, read not edited) is ALL-OR-NOTHING per region: any one-sided name refuses the WHOLE region's join (:930-934), discarding matches that would have joined along with the ones that would not -- confirmed against DESK9's own pre-existing test (test_the_join_still_works_when_every_rank_has_two_ runner_files, test_weg2_xchg_manifest_join_1330.py), which already proves the positive case end to end. There is therefore no clean way to move ONLY the mtp.* layer through the exchange while leaving the re-materialised shards to disk within one region/tag -- so this fix does not attempt one. It tries the real join for the WHOLE tag; if group P's producer holds a matching counterpart for every one of group D's draft-region tensors, the whole tag moves through the real exchange (byte-identical population (a) bytes included, which is correct, not merely harmless, since both sides already compute them identically from the same checkpoint). If even one name is genuinely one-sided, the whole region's join refuses and the method reports that reason upward WITHOUT sinking the unrelated main region's leg -- the caller then keeps the disk-reload fallback (sgl-project#1394, _weg2_xchg_draft_reload_from_disk), never the ring, never a mini-ring. THE WAKE SIDE'S OWN PRIORITY IS REVERSED to match: resume_memory_ occupation's per-tag loop used to try the disk-reload FIRST for weights_draft, before even asking the carrier -- correct only while the exchange structurally never covered the tag at all. That would now silently prevent the real exchange from ever being tried. The exchange is asked first, exactly like any other tag; disk is the fallback, taken only when this leg's own collect found zero descriptors for the tag (_weg2_xchg_inject_weights/_weg2_xchg_inject_from_peer now return whether real descriptors were found, computed once at the frame that already holds the filtered set, not re-derived). Tests (test_weg2_1394_draft_in_exchange.py, 9 cases, hermetic, CUDA_ VISIBLE_DEVICES=""): - Execution smoke on the REAL production callsite (_weg2_shadow_plan itself, not the new helper in isolation), driven through written manifest files and DESK9's own real join/manifest functions: the merge succeeds when a matching producer exists (RED-FIRST verified: reverting the merge call reproduces exactly "the draft region's descriptor never joined the plan", restored after), and fails soft (main plan unaffected) when it does not. - Danger-direction mutant (coordinator order): the wrong region_tag resolves a name both runners share to the WRONG (main) runner's real address -- proven via the actual address-book function, not asserted -- exactly "a draft leg that reads the main region's bands writes foreign bytes into the draft head, silently". The real code never does this because it always resolves the draft region from the draft runner's own shape, never a caller-supplied tag. - Regression guard (mutant 2's own scenario): roll_forward_weights_tag still refuses the combined disk reload under an armed exchange with a draft shard, unaffected by this change -- that refusal is a different, older wake path and stays exactly as strict. - Wake-dispatch-order tests: exchange tried before disk, disk only as the fallback when the exchange collects nothing. Regression: 168/168 across this new suite, W106/sgl-project#1394's own prior suite, the gate-axis tests, sgl-project#1391's suite, inject-wiring, the wcode census, the sgl-project#1397 band-credit wiring suite, and DESK9's own manifest-join suite (sgl-project#1330) -- all unaffected. A separate full test/registered/unit/weg2/ run was started for a final broad sweep; 11 pre-existing failures (confirmed identical on the clean train tip, unrelated to this commit: stale main_carried-era tests in test_weg2_xchg_seam_wiring_1273.py, a launcher.py argv_p signature drift in test_weg2_scheduling_slice_a_0907.py, flip-order retry flakiness, and one xchg_chain_smoke_1342 failure) are noted but out of this ticket's scope. NOT RESOLVED, NAMED RATHER THAN CLAIMED: no available boot log (weg2ring1, weg2xsn31, weg2xsn17) shows a single GENUINE occurrence of "WEG2-XCHG DEPOSIT" -- the emitter inside the function this whole fix's callsite lives in -- checked via logindex's trap-safe grep, bare=0/genuine=0 on every one tried. BOOT7 (xsn32) has not produced a readable log yet. This is exactly the class the coordinator's own 14.09. 03:4xZ finding named (W100 tied to a function with zero real-metal occurrences): the hermetic proof above is DESK-BEWIESEN; that this exact callsite fires on real metal remains UNPROVEN pending BOOT7's own log.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…int_census.py DESK11's own gap (design doc section 9.1, verified by reading rather than trusted): checkpoint_census.widest_layer_terms took pairs/depth/slot_bytes/ n_lanes/max_tag_bytes/lanes_concurrent but never band_credit/n_cross_lanes -- the ONE call site between the launcher and xchg_bounce.bounce_terms for every OTHER field. DESK10's own commit (26bd280) independently confirmed weight_updater.py's own two BounceTerms readers (xb.read_published_terms(), never a local reconstruction) already carry both fields through _TERM_FIELDS untouched. ONE SOURCE, the --xchg-bounce-depth (48adc00) / --xchg-lanes-concurrent (45477c1) shape reused, both precedents in this same file: --xchg-band-credit (plain store_true, default off, byte-identical) -> main() resolves it exactly once (_band_credit) -> both the ranks' publication call (checkpoint_census.widest_layer_terms -> xchg_bounce.bounce_terms -> _TERM_FIELDS -> publish_terms) and choose_host_ledger's own pricing call read the identical resolved bool. n_cross_lanes is deliberately NOT exposed as a second CLI flag anywhere in this file -- design doc section 9.2's own finding: arming reduces to the single boolean, xchg_bounce.resolve_cross_lanes derives a safe, structural lower bound from n_lanes (measured, sgl-project#1358) and weight_exchange_region.N_CARDS (a pigeonhole argument), so there is nothing else to coordinate. ORDER ITEM 1 -- reader enumeration BEFORE changing the producer, verified by file:line reading (not assumed from DESK10's commit message): weight_updater.py has EXACTLY two lane-buffer-size readers, :1078 and :1213, both `xb.read_published_terms()`. No third reader, no local BounceTerms reconstruction that could silently drop the two new fields. Pinned as a regression tripwire (TheReadersAreEnumeratedAndStayThatWay::test_weight_updater_has_exactly_ two_read_published_terms_call_sites). ORDER ITEM 2 -- the sgl-project#1385 unlink interaction, checked: band_credit does NOT touch the unlink side and needs none of its own. weight_exchange_bounce.unlink_lane_buffer removes a file by PATH (the lane's own name), independent of what size was ever written there -- band_credit only changes the byte count a cross lane's file holds, never its path, existence, or when it is freed. The call site (weight_updater.py:4170) gates on `_lane_permit_active` (--xchg-lanes-concurrent), an axis independent of band_credit: with no cap, sgl-project#1385's own pricing already charges for every lane accumulating "by design", and band_credit's smaller per-lane cross price is still the correct charge for that assumption. Pinned (TheUnlinkSideIsUntouchedByBandCredit, 2 cases). THE "WRONG REGION" DANGER DIRECTION (coordinator-named: "ein Band-Credit, der die Baender der falschen Region liest, schreibt fremde Bytes = still falsch, teurer als jede Refusal") is a runtime correctness question about CrossSlotRendezvous/_band_credit_leg -- weight_exchange_bounce.py and weight_updater.py, DESK11's and DESK10's own file boundaries, never reachable from launcher.py/checkpoint_census.py (this file's boundary is pricing and publication: no descriptors, no ranks, no pairs at this layer). DESK10's own commit (26bd280) already ran exactly this mutant by hand against the real execution path (rendezvous construction switched to a card-only identity for a cross group, pair identity lost -- the size-comparison test went red). Not duplicated here; cited instead. DESIGN DOC MATH, VERIFIED THROUGH THE REAL xb.bounce_terms CALL rather than adopted: slot=128 MiB matches exactly (15.75 -> 10.5 GiB, 5.25 GiB saved); slot=64 MiB diverges slightly from the design doc's own "gerechnet, nicht gemessen" 9.75 GiB estimate -- the real function returns 9.562 GiB (savings 5.5 GiB), which this commit treats as authoritative per the order's own instruction ("nimm nicht meine Zahl"). Tests (test_weg2_1397_launcher_census_wiring.py, 17 cases): byte-identical default (CLI flag off, no second n_cross_lanes flag anywhere), one-source (all three layers accept band_credit, none exposes n_cross_lanes, main() resolves exactly once, both call sites forward the same local), the ledger sees the smaller charge (host_ledger.charge_terms), the design-doc math verified at both slot sizes, the reader/unlink findings pinned as tripwires, and the danger-direction mutant for THIS layer (a caller that resolves band_credit but drops it from one of the two functions prices/ allocates the bigger, safe-direction total). MUTANT APPLIED LIVE TO launcher.py AND REVERTED (diff empty after): choose_host_ledger's own call to xchg_bounce_terms_for_arm with the band_credit argument removed -- TheDangerDirectionMutantAppliedLiveAndReverted's source pin went red immediately. Restored, diff empty, 17/17 green again. Regression: this file (17), test_weg2_1397_band_credit_wiring.py (DESK10, 5), test_weg2_band_credit_1397.py (DESK11, 27), test_weg2_xchg_lanes_ concurrent_1385.py (23), test_weg2_widest_layer_census_1332b.py, test_weg2_weights_cpu_backup_1369.py -- 129 total, all green. pyright (desk-venv): launcher.py+checkpoint_census.py 120 errors after vs 156 before -- fewer, not more (this branch is based on an EARLIER train commit than the pristine comparison point picked up additional unrelated pyright debt meanwhile; no new errors attributable to this change, cross- checked by symbol). File boundary: launcher.py + checkpoint_census.py + own test file, as ordered. xchg_bounce.py/weight_exchange_bounce.py (DESK11) and weight_updater.py/weg2_memory_saver.py (DESK10) read but not modified.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…ght axis --
bounce_lane_armed(), not shadow_armed() -- fixed two stale comments,
execution-smoke pins the arm matrix
Coordinator relay, register hypothesis (/spinning/gpu-arb/weg2/
PLAN_ZIEL_0914.md's A1 failure-mode table, a watchlist entry for
"pieces=0", not a confirmed defect): "ZWEI Produktions-Gates lesen
shadow_armed(), waehrend die Order exchange armt." Checked as instructed
("pruefe das, statt es zu uebernehmen") rather than adopted, since BOOT7's
A1 runs --weg2-weight-source exchange right now and a wrong-axis gate
there would mean pieces=0 by construction.
VERIFIED, NOT ADOPTED: every gate in weight_updater.py / weg2_memory_saver.py
(this desk's file boundary) that decides whether ANY bounce-lane machinery
runs already reads the correct axis, and neither calls
weight_exchange.shadow_armed() literally:
- _weg2_shadow_hook (called from _weg2_shadow_source_leg /
_weg2_shadow_destination_leg) gates on
weight_exchange_shadow.bounce_lane_armed() -- weight_source() != "ring",
True under BOTH exchange and shadow. Its own docstring already documents
the sgl-project#1273 B4q fix this hypothesis describes ("It read shadow_armed()
until sgl-project#1273 B4q ... the hook was dead on the exchange arm by
construction -- boot weg2xsn16"). Already fixed, not a live defect.
- _weg2_xchg_deposit_before_sleep / _weg2_xchg_inject_weights /
_weg2_xchg_bounce_leg (the authoritative movers BOOT7's A1 actually
needs for pieces>0) gate on exchange_armed(), independent of
shadow_armed() entirely -- already execution-proven under this EXACT
arm by test_weg2_1394_draft_in_exchange.py and
test_weg2_1397_band_credit_wiring.py (same desk, same day), both
driving real cross-pair legs through _weg2_xchg_bounce_leg under
WEIGHT_SOURCE_EXCHANGE + INJECT_AUTHORITATIVE.
- _weg2_xchg_shadow_armed_for (this desk's own sgl-project#1391 round 4 predicate)
checks inject_mode() == INJECT_SHADOW deliberately -- a DIFFERENT
question ("is the shadow-grading branch due") than "does the lane run
at all", and gating it on bounce_lane_armed() instead would be wrong:
it would run the shadow comparison under authoritative too.
CONCLUSION per task step 1's own instruction ("wenn beide Gates RICHTIG
liegen, sag das mit file:line und baue nichts"): no shared-predicate
refactor is built. There is nothing to unify -- the three questions
(does the lane run / whose bytes are they / is injection the authority)
already have three separate, correctly-scoped predicates, which is
sgl-project#1273 B4q's own stated design intent, not an accident to fix.
TWO STALE COMMENTS FOUND AND FIXED (documentation drift, not a functional
gate defect -- the instrument-text-luegt class): both described the
ALREADY-CORRECT bounce_lane_armed()-gated behaviour as if only
--weg2-weight-source shadow armed it, unreconciled since sgl-project#1273 B4q widened
the actual gate:
- _weg2_shadow_source_leg's call-site comment ("on every arm but
--weg2-weight-source shadow it returns having touched nothing").
- _weg2_shadow_destination_leg's docstring and call-site comment ("the
ring's bytes are final here" / "ground truth" framed as ring-only,
stale under CARRIER_EXCHANGE where the peer group's live VRAM is the
ground truth instead).
EXECUTION SMOKE (task step 4, "nicht per Unit-Double"):
test_weg2_1334_bounce_lane_axis.py, 9 cases, on the REAL
_weg2_shadow_hook through its own two production callers:
- The three-arm matrix (ring/exchange/shadow) proven by execution, not
read: bounce_lane_armed() itself is asserted per arm AND the hook's own
reachability past its gate is spied and checked to match, for both the
source and destination legs.
- Danger-direction mutant (order's own): bounce_lane_armed monkeypatched
to shadow_armed reproduces boot weg2xsn16's exact shape (the lane never
arms under exchange) -- proving the real code is what stands between
this and BOOT7's A1 measuring pieces=0 for this exact reason.
Regression: 125/125 (this suite + the sgl-project#1329 shadow execution smoke +
sgl-project#1394 draft-in-exchange + sgl-project#1394/sgl-project#1369 wake-source-gap + gate-axis sgl-project#1273 +
sgl-project#1391's own suite + inject-wiring sgl-project#1342 + wcode census sgl-project#1263 + sgl-project#1397
band-credit wiring).
No new W-code (none needed -- no refusal added, only a verification and
two comment fixes).
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…s undefined on a
quantized checkpoint too -- refuse by name (W4/W106 reused), never attempt
it
Coordinator relay of a real boot death: A2 (Ring AUS, authoritative) died
at scheduler init with W4 Weg2WakeRefused (weg2_memory_saver.py:368,
"--enable-memory-saver without --enable-weights-cpu-backup on a
'compressed-tensors' checkpoint"). Verification requested in three steps,
answered here with file:line, per the coordinator's own explicit
"pruefe das, statt es zu uebernehmen" doctrine (third time today):
(1) Does the guard, or either of its two callers, read any exchange axis?
NO. assert_backup_off_wake_refill_is_defined (weg2_memory_saver.py:328-382)
reads only `quantization`; its predicate contains no exchange_armed() /
weight_source() / CARRIER_EXCHANGE check anywhere. Of its two callers:
scheduler.py:2310-2316 (the ACTUAL death site, launch-time, before any
weight load or plan exists) reads only the raw `server_args.
enable_weights_cpu_backup` flag -- no exchange axis, unconditional refusal
whenever that flag is off and the checkpoint is quantized. weight_updater.
py:1753 (this file, the wake-time call) is reached ONLY when
_weg2_wake_weight_carrier() already resolved to CARRIER_DISK -- it never
runs under CARRIER_EXCHANGE, so it is already correctly gated by the
carrier routing above it, just not by a literal axis read inside the
guard call itself. CONFIRMS the coordinator's reading for the death site:
scheduler.py's launch-time check predates the exchange entirely and does
not know a third lane exists -- OUT OF THIS FILE'S BOUNDARY, reported
rather than edited.
(2) Does the exchange carry post-transform bytes on the wake side? YES,
confirmed against today's own execution smokes (test_weg2_1394_draft_
in_exchange.py, test_weg2_1397_band_credit_wiring.py, both driving real
cross-pair legs under WEIGHT_SOURCE_EXCHANGE + INJECT_AUTHORITATIVE).
_weg2_join_dst_addr resolves the DESTINATION's own EXISTING, already-
loaded parameter's data_ptr() (weight_updater.py, via
_weg2_rank_param_table); run_bounce_leg / _weg2_xchg_bounce_leg write raw
bytes into that address via device-to-device-through-host copy. Neither
touches load_weights, process_weights_after_loading, or constructs a new
Parameter at any point -- the bytes it moves are the peer's own live,
already-transformed VRAM tensor. Matches the guard's own "defined" lane
("the TMS restore carries the post-transform bytes and no reload runs").
(3) Completeness -- THIS DESK'S OWN PART, fixed here: a tag without an
exchange source falls to the sgl-project#1394 disk-reload path today, and that path
is the SAME undefined operation the W4 guard names, reached through a
caller (_weg2_xchg_draft_reload_from_disk) the guard did not know about
either. The exemption in _weg2_xchg_wake_source_gap that unconditionally
answered "covered by disk" for weights_draft assumed the fallback was
always safe -- it is not, on a quantized checkpoint, and this morning's
own sgl-project#1394 doctrine ("der Checkpoint ist das Netz") never actually checked
that against the process's real checkpoint.
FIX, reusing W4 and W106 -- no new W-code:
- _weg2_xchg_wake_source_gap: the weights_draft exemption now checks
_weg2_draft_checkpoint_quantization() (new helper, mirrors
checkpoint_quantization's own two-holder order for the draft runner)
before granting it. Quantized + no descriptors -> a real gap, refused by
name (W106) at the sleep leg, before the pause, with the tag's own
reasoning cited alongside assert_backup_off_wake_refill_is_defined's.
Unquantized: unchanged, still exempt.
- _weg2_xchg_draft_reload_from_disk: calls
assert_backup_off_wake_refill_is_defined itself, BEFORE anything is
locked or entered, with the draft checkpoint's own quantization --
defense in depth for the boot-time INITIAL sleep, which
_weg2_xchg_deposit_before_sleep skips by construction (flip_index < 0),
so the sleep-leg's own gap-check never ran for it. No guard weakened:
this calls the SAME guard the launch arm and the main wake already call,
one caller wider, exactly the "one definition, shared" doctrine already
established for the other two call sites.
Tests (test_weg2_1394_1369_wake_source_gap.py, 4 new cases, RED-FIRST
verified by reverting the production change and observing both new tests
fail with exactly the expected shapes, restored after):
- the quantized-checkpoint gap, its text checked against the REAL W4 text
(driven through assert_backup_off_wake_refill_is_defined itself, never
hand-typed -- the fixture the order asked for) for shared reasoning, not
a duplicated string;
- the unquantized regression guard (unchanged behaviour);
- the draft-reload guard firing before the fake draft worker's
update_weights_from_disk is ever called;
- the danger-direction mutant (coordinator order): the OLD, unconditional
exemption restored inline, shown to answer "no gap" on exactly the case
that must refuse (zero descriptors, quantized checkpoint) -- passes only
because it demonstrates the danger the real code prevents.
Regression: 122/122 (this suite + sgl-project#1394 draft-in-exchange + sgl-project#1397 band-
credit wiring + sgl-project#1334 bounce-lane axis + gate-axis sgl-project#1273 + sgl-project#1391's own
suite + inject-wiring sgl-project#1342 + wcode census sgl-project#1263).
NOT FIXED, OUTSIDE THIS FILE'S BOUNDARY, REPORTED PER "SAGEN, NICHT TUN":
this commit does not unblock A2's own observed death. scheduler.py:2310-
2316's launch-time check is a blanket, argv-only refusal that fires
before any weight load, any manifest, or any plan exists -- it structurally
cannot verify per-tag exchange completeness at that point, which is
exactly the tension between "recognise a third lane" and "vollstaendigkeit
als Bedingung, nicht als Annahme" the coordinator's own order names. This
desk's fix makes the WAKE-TIME logic (weight_updater.py /
weg2_memory_saver.py) correctly safe once that gate is ever relaxed; it
does not relax it, and does not decide who should.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…s undefined on a
quantized checkpoint too -- refuse by name (W4/W106 reused), never attempt
it
Coordinator relay of a real boot death: A2 (Ring AUS, authoritative) died
at scheduler init with W4 Weg2WakeRefused (weg2_memory_saver.py:368,
"--enable-memory-saver without --enable-weights-cpu-backup on a
'compressed-tensors' checkpoint"). Verification requested in three steps,
answered here with file:line, per the coordinator's own explicit
"pruefe das, statt es zu uebernehmen" doctrine (third time today):
(1) Does the guard, or either of its two callers, read any exchange axis?
NO. assert_backup_off_wake_refill_is_defined (weg2_memory_saver.py:328-382)
reads only `quantization`; its predicate contains no exchange_armed() /
weight_source() / CARRIER_EXCHANGE check anywhere. Of its two callers:
scheduler.py:2310-2316 (the ACTUAL death site, launch-time, before any
weight load or plan exists) reads only the raw `server_args.
enable_weights_cpu_backup` flag -- no exchange axis, unconditional refusal
whenever that flag is off and the checkpoint is quantized. weight_updater.
py:1753 (this file, the wake-time call) is reached ONLY when
_weg2_wake_weight_carrier() already resolved to CARRIER_DISK -- it never
runs under CARRIER_EXCHANGE, so it is already correctly gated by the
carrier routing above it, just not by a literal axis read inside the
guard call itself. CONFIRMS the coordinator's reading for the death site:
scheduler.py's launch-time check predates the exchange entirely and does
not know a third lane exists -- OUT OF THIS FILE'S BOUNDARY, reported
rather than edited.
(2) Does the exchange carry post-transform bytes on the wake side? YES,
confirmed against today's own execution smokes (test_weg2_1394_draft_
in_exchange.py, test_weg2_1397_band_credit_wiring.py, both driving real
cross-pair legs under WEIGHT_SOURCE_EXCHANGE + INJECT_AUTHORITATIVE).
_weg2_join_dst_addr resolves the DESTINATION's own EXISTING, already-
loaded parameter's data_ptr() (weight_updater.py, via
_weg2_rank_param_table); run_bounce_leg / _weg2_xchg_bounce_leg write raw
bytes into that address via device-to-device-through-host copy. Neither
touches load_weights, process_weights_after_loading, or constructs a new
Parameter at any point -- the bytes it moves are the peer's own live,
already-transformed VRAM tensor. Matches the guard's own "defined" lane
("the TMS restore carries the post-transform bytes and no reload runs").
(3) Completeness -- THIS DESK'S OWN PART, fixed here: a tag without an
exchange source falls to the sgl-project#1394 disk-reload path today, and that path
is the SAME undefined operation the W4 guard names, reached through a
caller (_weg2_xchg_draft_reload_from_disk) the guard did not know about
either. The exemption in _weg2_xchg_wake_source_gap that unconditionally
answered "covered by disk" for weights_draft assumed the fallback was
always safe -- it is not, on a quantized checkpoint, and this morning's
own sgl-project#1394 doctrine ("der Checkpoint ist das Netz") never actually checked
that against the process's real checkpoint.
FIX, reusing W4 and W106 -- no new W-code:
- _weg2_xchg_wake_source_gap: the weights_draft exemption now checks
_weg2_draft_checkpoint_quantization() (new helper, mirrors
checkpoint_quantization's own two-holder order for the draft runner)
before granting it. Quantized + no descriptors -> a real gap, refused by
name (W106) at the sleep leg, before the pause, with the tag's own
reasoning cited alongside assert_backup_off_wake_refill_is_defined's.
Unquantized: unchanged, still exempt.
- _weg2_xchg_draft_reload_from_disk: calls
assert_backup_off_wake_refill_is_defined itself, BEFORE anything is
locked or entered, with the draft checkpoint's own quantization --
defense in depth for the boot-time INITIAL sleep, which
_weg2_xchg_deposit_before_sleep skips by construction (flip_index < 0),
so the sleep-leg's own gap-check never ran for it. No guard weakened:
this calls the SAME guard the launch arm and the main wake already call,
one caller wider, exactly the "one definition, shared" doctrine already
established for the other two call sites.
Tests (test_weg2_1394_1369_wake_source_gap.py, 4 new cases, RED-FIRST
verified by reverting the production change and observing both new tests
fail with exactly the expected shapes, restored after):
- the quantized-checkpoint gap, its text checked against the REAL W4 text
(driven through assert_backup_off_wake_refill_is_defined itself, never
hand-typed -- the fixture the order asked for) for shared reasoning, not
a duplicated string;
- the unquantized regression guard (unchanged behaviour);
- the draft-reload guard firing before the fake draft worker's
update_weights_from_disk is ever called;
- the danger-direction mutant (coordinator order): the OLD, unconditional
exemption restored inline, shown to answer "no gap" on exactly the case
that must refuse (zero descriptors, quantized checkpoint) -- passes only
because it demonstrates the danger the real code prevents.
Regression: 122/122 (this suite + sgl-project#1394 draft-in-exchange + sgl-project#1397 band-
credit wiring + sgl-project#1334 bounce-lane axis + gate-axis sgl-project#1273 + sgl-project#1391's own
suite + inject-wiring sgl-project#1342 + wcode census sgl-project#1263).
NOT FIXED, OUTSIDE THIS FILE'S BOUNDARY, REPORTED PER "SAGEN, NICHT TUN":
this commit does not unblock A2's own observed death. scheduler.py:2310-
2316's launch-time check is a blanket, argv-only refusal that fires
before any weight load, any manifest, or any plan exists -- it structurally
cannot verify per-tag exchange completeness at that point, which is
exactly the tension between "recognise a third lane" and "vollstaendigkeit
als Bedingung, nicht als Annahme" the coordinator's own order names. This
desk's fix makes the WAKE-TIME logic (weight_updater.py /
weg2_memory_saver.py) correctly safe once that gate is ever relaxed; it
does not relax it, and does not decide who should.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Hello, I am willhe from the XVERSE Infra Team.
We want to integrate our XVERSE models into the sglang framework, including:
XVERSE models are critical for serving various AI applications, and integrating them into sglang will allow us to efficiently deploy and scale them.
Modifications
Dense Model: The XVERSE Dense Model shares the same structure as the LLaMA model but includes custom variable and weight names that need to be aligned with the llama format.
I added a new file,
xverse.py, in thesglang/srt/models/directory to handle the model-specific adjustments.MoE Model: The XVERSE MoE Model was developed using an architecture similar to the deepseek-v1 model, and I implemented support for its mixture of experts layers and specialized routing mechanisms.
I added a new file,
xverse_moe.py, in thesglang/srt/models/directory to define the MoE layers and routing logic.Checklist