Repository navigation
Add io struct for embedding models [unreachable code] - step 2/3 - #987
Merged
Merged
Conversation
Ying1123
force-pushed
the
llama-embed-merge
branch
from
August 8, 2024 07:15
e384b10 to
241be3a
Compare
merrymercy
approved these changes
Aug 8, 2024
merrymercy
enabled auto-merge (squash)
August 8, 2024 07:23
This was referenced Aug 8, 2024
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 28, 2026
…aterialises it Root (R9 census, boots 6-7): 506 of 513 void-causing refusals were ONE rid failing the sgl-project#791 fill-length clause by ONE token -- rank 0 alone holds a sampled output token that never crossed the tp_to_pp seam (sgl-project#631 OUTTRACE: PP0 n=1 tail=[25], followers n=0), so 8447 vs 8446; rank 0 alternates offers 7939/0, resetting the told-keyed sgl-project#944 streak every pass: 1 termination in 506 laps. sgl-project#984 was measurably neutral on these counts (its docstring premise falsified, recorded). Part B (the serving fix): PPAdmissionEntry gains optional fill_len + fill_tail (cap 8); build publishes on both entry branches; the follower adopts at the ONE junction directly before the clause reads local_fill_len, materialising the tail into a SHADOW pair honored only by _refresh_fill_ids -- NEVER into output_ids: consumer sweep found two unguarded readers (output_streamer slices output_ids into the CLIENT payload on pp_rank 0; the per-rank max_new_tokens check would let one rank finish a step early = the recorded cross-rank hang class). The clause itself is untouched -- the fix ends the disagreement instead of weakening the guard. Adopt is idempotent, self-cancelling once the rank catches up, refuses loudly (log, no new raise) on cap/behind. Wire codec rewritten index-based: a legacy 8-wide row decodes to fill_len=None (byte-identical); the old fixed-arity unpack would have crashed on any width skew between ends one commit apart. Part A (abort net): the sgl-project#944 streak keys on refusal persistence -- _refused_since_offer written by PP0 as it absorbs its own void (strictly local; a schedule refusal laps home with ZERO entries, which is why UNRESOLVABLE read 0 beside a 506-refusal census), consumed in note_offer; the told<=0 exemption no longer applies to a refused rid. The alternation livelock now escalates in ~4 laps to the existing terminator. sgl-project#955's healthy end preserved: an unrefused moving offer never escalates. Part C: sgl-project#986 -- pp_queue_orphaned_chunked_req returns the admission tree-lock ref (adjudicated NEW-with-#968b leak). Plus the test-agent's zero-case instrument at the rehome reset-shape return. Instruments: sgl-project#987 FILL-ADOPT (both fills + appended count, gated first+64th), sgl-project#987 FILL-REFUSE (cap/behind), refusal-streak visible in the existing UNRESOLVABLE line. Bonus recorded: last_chunk is now computed from the same number on both ranks. Execution proof: import smoke on all five modules (CVD=""); call-graph chains close at scheduler.py:9472/:8982, schedule_policy.py:1442/:1804, event loop :9515; the 1390-clause ran 338x in boot 7 -- the adopt site is on a proven hot path. 31/31 cold checks on the exact boot-7 numbers (appended=1, id=25, veto-before/pass-after, 4-lap abort vs 506); one fixture self-catch recorded. Suites live in the test-agent lane.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 28, 2026
…, not at the exits Boot 8 died 25s into load: prepare_for_extend's sgl-project#965 invariant (len(prefix_indices) == extend_range.start, asserted at schedule_batch.py:3262) failed on PP0. R11 rooted the writer pair, refuting both suspects (neither the sgl-project#944 told=0 terminator -- it took its report-only branch -- nor the sgl-project#987 adopt, which moves only the fill): the host load-back in PrefillAdder.add_one_req grows prefix_indices in place and is followed by budget/align/sgl-project#967 early returns that never reach set_extend_range; reachable because the waiting_queue loop carried no membership guard, so a request already resident in can_run_list (the void family's deliberately preserved co-residency) was visited a second time, its prefix moved, and the bail-out left the first visit's extend_range behind it. Fix, the sgl-project#965 lesson (one junction, never per-branch bail patches): re-derive Range(prefix, prefix) IMMEDIATELY at the mutation -- every current and future early return inherits a consistent parked shape automatically; the success paths overwrite it with the real range as before. Plus the identity membership guard at the loop head (skip census 'already_in_batch'; identity not rid -- two objects with one rid are a different defect and must not be masked). Plus the sgl-project#988 LOADBACK instrument line (module-level, rate-limited). Sibling class registered as ONE posten, not fifteen: 11 further prefix_indices reassignments without same-function re-derive across the cache stash paths (R11 sweep; they run where the next admission re-derives, so not reachable as this crash). Execution proof: import smoke green; the load-back ran on every cache-hit admission in boot 8 (FILL-ADOPT and cached_pos=8 prove the hit path hot); the guard sits in the loop that produced boot 8's crash batch. Boot 8's collapse numbers stand: unexec 513 -> 10, abort net 6x bounded, batches and cached at family bests -- this closes the last named layer of that boot.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 28, 2026
Boot 16 (996fbf4, 22:21:48, boot_943bx_996fbf4aca_0828_221614.log) died 68 s after first load. PP1 and PP2 both logged sgl-project#987 FILL-ADOPT rid=da614e20... local=8446 -> upstream=8447 appended=1 tail=[271] and PP1 then took scheduler_pp_mixin.py:2147 RuntimeError: sgl-project#631 PROXY LEFTOVER REFUSED: a proxy stamped mb_id=1 seq=17 rows=4096 epoch=2 arrived while this rank is on mb_id=2 in flip epoch 2 -- the SAME-epoch branch, i.e. a proxy for a pass this rank had already left. All three ranks down. THE ROOT IS NOT WHERE sgl-project#995 LOOKED. `_add_scheduled_req` decided whether a forwarded extent finishes its request with last_chunk = prefix_len + extend_len >= local_fill_len under a comment claiming that was "the schedule's to say ... arithmetic on forwarded integers rather than re-taken against a local budget". Two of the three integers are forwarded. The third is not: `local_fill_len` is `len(full_untruncated_fill_ids)`, rebuilt from THIS rank's origin + output_ids (+ carried tail) on every pass by `Req._refresh_fill_ids` (schedule_batch.py:1326 -- unconditional, ahead of the tree_cache gate at :1355). The verdict was a rank-local quantity wearing a forwarded one's clothes, and the fill is exactly the quantity this seam is known to disagree about. THE GUARD COVERED ONLY HALF THE DISAGREEMENT. `schedule_refusal_reason`'s third clause refuses `prefix + extend > local_fill_len` -- the decision asking for more than this rank holds. The opposite skew, this rank holding MORE than the rank that decided, passes every clause and silently flips "last chunk" into "mint a continuation". `adopt_carried_fill` cannot close it either: it only APPENDS (:1628-1633), so it lifts a short follower up to the decider and never brings a long one down. 8446 vs 8447 is that skew, and the continuation nobody decided on is what put the leftover proxy on the wire. THE FIX IS A CARRY, NOT A FOURTH CLAUSE. `PPAdmissionEntry` gains `last_chunk`, set by the deciding rank in `build_pp_admission_decision` from the same `fill_carry_for` reader that already publishes `fill_len`, projected by `forwarded_last_chunk` (the third projection of the one decision object, alongside `forwarded_fill_carry` and `_pp_forwarded_schedule_from`, so all three empty on the same passes and can never name different rid sets), and executed at the receiver. Tightening the refusal clause to `!=` was the available alternative and is wrong: `prefix + extend < local_fill_len` is the normal case for every legitimate middle chunk, so that refuses every pass. BOTH READERS OF THE VERDICT MOVE TOGETHER. `add_chunked_req` asks the same question one method later ("is this still the chunked request") and answered it by reading `extend_range.end` back off the request -- equivalent only while BOTH sides derived it locally. It now reads the same carried source via `_told_last_chunk`, or the two halves of one fact would drift, which is this ticket's own defect class one level up. `None` MEANS SAY NOTHING. A legacy sender, an unreadable fill, PP0 itself and every pp_size<=1 boot all yield no entry in the map, and both readers fall back to the pre-sgl-project#996 local derivation unchanged. RATCHET, same diff: the three `new_chunked_req = req` sites were bare assignments, so a second mint in one pass would have SILENTLY overwritten the first -- the overwritten request left in can_run_list with a partial extend range, tracked by nobody, re-prefilled next pass (the double prefill the standing law forbids, with no assert anywhere on the path). They now go through `_mint_chunked`, which asserts `new_chunked_req is None` and names both rids and the site. Nothing has been observed doing this; `chunked_req_outstanding` is set once per pass and knows only about the RESIDENT continuation, so neither existing watcher could see it. This is the check the family (sgl-project#951, sgl-project#959, sgl-project#995, sgl-project#996) kept discovering it did not have. DESK EVIDENCE, the boot-16 skew reproduced end to end and falsified in the dangerous direction: producer holding 8446 with a chunk landing on its end publishes last_chunk=True; a receiver holding 8447 derives False locally and would mint, and executes True with the carry. Old behaviour mints, new does not. Import smoke on all three modules; ruff clean on all 265 added lines (the 125 findings in these files are pre-existing and untouched). NOT yet boot-proven -- that is the next boot's job, and the sgl-project#996 log line fires exactly when the carry changes the verdict so the seam is readable directly.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 29, 2026
`trace_round` is the only rid-precise instrument that separates "this round appended nothing" from "this round produced nothing" -- the two cases the void->output_ids->fill chain has to tell apart. Its own docstring says so, and the sgl-project#631 comment directly above the decode append (batch_result_processor.py:853) says the same: "A round that appends nothing and a round that produced nothing look identical in output_ids alone." It could never fire on this configuration. `armed_after` is `after_left > 0`, and `after_left` was set in exactly one place: `cutover()`. With the flip off there is no cutover, so the instrument built for this question is structurally unavailable on the config where the question now lives -- which is why nobody has measured it there. That is the third instance of one pattern in this window, and the most expensive of the three. sgl-project#994 framed "bigger pool serves worse" as flip-bound while the mechanism occurs flip-free; sgl-project#987 framed its fill divergence as "across tp_to_pp" and I measured it with flipdone=0. Those cost a wrong search each. A flip-bound INSTRUMENT costs the possibility of searching at all, and it does so silently: a zero from a never-armed probe looks exactly like a zero from an armed one. A SECOND GATE, NEVER INSTEAD OF THE FIRST. `cutover()` still sets `after_left = self.post` untouched -- taking the flip path's window away to give this one a window would be the next regression. `SGLANG_631_TRACE_OFFFLIP=N` arms N rounds at construction; unset or 0 is today's behaviour byte for byte, asserted in the smoke together with the cutover path still setting its own window afterwards. Evidence: desk. py_compile; smoke asserting the default stays disarmed (after_left 0, armed_after False), that the env arms it (6, True), and that `cutover()` afterwards still sets its own window (post=8). Belegstufe: DESK-BEWIESEN.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
… the epoch, not to a rank's span Boot 30 died 1 minute into load. `#1059c` gave the row a sender for the first time, a told prefix of 12288 arrived, and it was applied to a request the cutover had just re-admitted -- whose pinned span was legitimately 0, because that same cutover dropped the tree one line earlier (`RESIDENTS RELEASED ... the prefix tree dropped returning 15943 row(s)`). `uniform_pass_geometry` raised `UniformWidthPromiseBroken` and crashed the group. The told value was not wrong. It was STALE ACROSS A CUTOVER, and the guard's premise -- "told <= pinned holds by construction" -- is true only WITHIN one cutover epoch, which nothing enforced. THE TRIGGER IS THE EPOCH AND NOT THE LOCAL SPAN, and that is the whole design. The obvious formulation -- "void when told exceeds MY pinned span" -- reads a RANK-LOCAL quantity and is therefore the 26th divergent input into the one replicated decision. The guard's own message already forbids exactly that: "compensating locally here would move the batch and reappear as sgl-project#631 on a peer." `PhaseFlipRuntime._epoch` advances once per COMPLETED cutover on every rank and the runtime's consensus reduction raises DESYNC if two ranks disagree, so `row.decided_epoch != current epoch` yields the SAME verdict everywhere without any rank consulting its own state. * PP0 stamps `decided_epoch` at PUBLICATION (the instant the row becomes a promise to the group). A relaying rank re-sends the raw row verbatim, so the epoch that travels the chain is PP0's. * The column rides at the END of the wire row under the same index-and-width discipline as sgl-project#987's pair and sgl-project#968's `load_back_len`. Per ENTRY, not per decision, because the outer payload is unpacked as a FIXED 2-arity tuple -- growing THAT is the fixed-arity crash the row's width tolerance exists to avoid. * The apply compares against the LIVE epoch through a registered read-through accessor, not a cached int: boot 30's apply ran INSIDE `_release_residents_for_cutover`, so a value refreshed per pass would have been one generation stale precisely where the staleness had to be seen. * A mismatch (or an unverifiable half-absent pair) routes into the contract's OWN already-proven no-adopt path -- boot 29 ran it for its whole life without a divergence. That is a way ONWARD, never the boot-15 per-rank refusal that re-fired 1448 times and wedged the ring. * `UniformWidthPromiseBroken` is NOT softened. It stays as the in-epoch invariant's backstop and is now unreachable: if it ever fires again the pin itself has failed, which is a group crash by `raenge-nie-uneins`, as written. SECOND HALF -- #1060b: THE TOLD COUNTER MOVES TO THE APPLY SITE. Boot 30 proved the row arrives by DYING on it, while `sgl-project#1058 TOLD-VS-LOCAL CENSUS` read `evaluated=13 absent=13` on PP0 and `evaluated=0` on the two ranks that crashed. The census sat at the CONSULT -- and PP0 makes the offer and never receives one. A fact's arrival must be counted where it takes EFFECT. `apply_reached` is the denominator; `adopted>0` is the only positive proof that a row travelled AND was applied. Emitted unconditionally at teardown and on the death path, like #1058b. MATCHED CHECK -- red-first at the boot-30 specimen plus the mandatory danger-direction mutant. The replay reproduces the raise with the log's own numbers (told=12288, pin=0), so the gate is proven to be what prevents it; the mutant asserts that the LOCAL-SPAN rule produces a SPLIT verdict across three ranks differing only in their span while the epoch rule produces one identical verdict -- if a future edit swaps the trigger, it goes red. Plus a wiring proof that drives `apply_uniform_pass_geometry_1059` itself with a live epoch source, because the pure-function tests prove the RULE and not that the apply consults it, which is the present-wired-never-populated shape that cost boot 29 a window. 11/11 green, plus 47/47 on the existing sgl-project#1059/sgl-project#791 suites (no regression) and 6/6 on sgl-project#1060. ruff clean on the added lines, py_compile green. Evidence: /spinning/evidence-665-f1/specimen_1060cens_boot30_uniformwidth_crash/
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 1, 2026
… re-home by subject Both pins lived in files whose subject was the deleted void relay and went down with it in sgl-project#1072, although neither pin was about the relay: the disciplined release path and `pp_rehome_displaced_chunked_req` both still have a live caller in `_pp_void_own_batch`. Re-pinned here in a file named for the discipline, so the next deletion sweep on the PP ring family runs straight through it. RETRACTION, AND IT IS THE REASON THIS FILE READS THE WAY IT DOES. The predecessor pin `test_the_discipline_has_exactly_one_expression` was RED when its file was deleted and was handed over as a surviving defect. It is not one. It asserted that `free_mamba_cache(` appears NOWHERE in `_release_voided_request`; sgl-project#993 later added a post-failure give-back inside the `except` handler, with a measured justification (boot 12, 7b855f6, 2026-08-28 21:46:05: `release_req` raised, the swallow left a re-admissible request holding a req-pool row, and the memory_pool.py:395 assert killed rank 0 one second later). The stale half was the ASSERTION: its subject was "the normal path delegates", its implementation was "this string never appears in this function", and deliberate containment added later violated the letter while keeping the intent. Measured split: try body release_req( yes; free_mamba_cache( no; token_to_kv_pool_allocator.free( no; dec_lock_ref( no except handlers free_mamba_cache( yes; pool.free( yes; release_req( no So the discipline is now asserted where it is claimed -- on the normal path -- and the containment is asserted to STAY containment: reachable only from a failed release, never raising out of it, mamba given back before the req-pool row it is keyed on. The re-home pins cover the #968b-2 junction that boot 5 died on (the park-shape equality refused the un-parked mid-plan occupant, returned None, and the caller's next statement nulled it: a drop), plus the deliberate log-only reset-shape decline (sgl-project#987) and the queue junction's refusal path. Both pin classes are proven can-fail, not merely green: a mutant that moves the give-back onto the normal path is CAUGHT, and a re-home that stops parking the un-parked occupant is CAUGHT.
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.
This is a follow up PR after