Repository navigation
misc: update issue template - #963
Merged
Merged
Conversation
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
qybnb
pushed a commit
to qybnb/sglang
that referenced
this pull request
Jul 10, 2026
Update test_npu_performance_utils.py
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 28, 2026
… was in the tree ROOT, per-rank coverage of window-958 boot 2 (pin 78d030e) plus both boot logs. Under pure PP the HiCache storage-prefetch veto is a RANK-LOCAL verdict: prefetch_ballot.prefetch_done_under_ballot returns the local value when the ballot is None, and the ballot rides _update_uniform_pool_budget's reduce on tp_cpu_group -- a group the PP loop never passes, and which has world 1 under pp_size>1 in any case. The ranks therefore decide independently. scheduler.py :9048 (`continue` after _note_skip("prefetch_pending")) is the LAST line PP0 and PP1 both ran; :9050 is the first PP0 ran ALONE. Everything downstream -- add_one_req, `self.chunked_req = adder.new_chunked_req`, the unconditional stash at :7010-7011 -> stash_chunked_request:5449 -> mem_cache/common.py:169 -> cache_unfinished_req -- is PP0-only. PP0's radix tree gains a 1250-token prefix PP1's and PP2's never received. From there it is self-sustaining. PP0 matches its own tree and offers told=1250; PP1 measures local=0 HONESTLY against its own; sgl-project#791 retracts, sgl-project#797 voids, the requeue resets the REQUEST and nothing resets the TREE. PP1 can only acquire the prefix by running the batch it is refused for lacking the prefix. WHY THE EXISTING BOUND COULD NOT REACH IT. PPAdmissionCongruenceGuard is, in its own words, "RID-SCOPED, ONE-SHOT", and its termination argument is per rid: each new retraction for THAT rid lowers THAT rid's floor. The argument is sound and silent about the POPULATION. The shortfall is a property of the TREE, so every fresh rid over the same prefix starts unclamped and buys its own voided pass -- six distinct rids in one second, all told=1250 local=0, which is why _learned_floor was measured RUNNING and LOWERING on PP0 and never bound. FIX: the same actuator, scoped to the prefix the offer was made over. No new mechanism and no new collective -- the recorded fatal (the 2026-08-17 HiCache ack-count reduction) rules out a collective on this path, and a group-uniform INSERT is structurally impossible: the radix value is a tensor of that rank's own KV slot ids, dereferenced as real memory by four consumers (allocator free at unified_radix_cache.py:1713, evict at full_component.py:96, HiCache backup at :2284, write-back into req_to_token at :1325), and the GDN mamba component donates a live state slot a non-computing rank does not have. offered_prefix_key() names the prefix by a blake2b fingerprint of its tokens -- NOT hash(), which is PYTHONHASHSEED-salted and would disagree between the very ranks this keeps congruent (tree_congruence's constraint 3, same lesson). Length is mixed in so a prefix and its extension cannot share a floor. prefix_key=None leaves the pre-sgl-project#963 rid-scoped path byte-identical. PRIOR ART, gated rather than duplicated. #616g's group-MIN reduces available_size(), a different quantity, and is switched OFF in the PP phase (tp_cpu_group world=1). sgl-project#823's tp_head_congruence MINs the right quantity but only REORDERS, and its enforcer_gate returns GATE_OFF_TP_WORLD_OF_ONE here. sgl-project#825's tree_congruence detects exactly this divergence and emitted 0 in BOTH boots: in the PP phase on_round is reached only via scheduler_pp_mixin.py:2477 with require_armed_and_parked=True, so it samples only at an armed flip -- which the livelock prevents. That is this instance's compensator-reachability gap. RED-FIRST, and the first red was rejected as worthless: all six cases failed on the SIGNATURE (TypeError), not on behaviour. Four mutants were then run against the finished fix and their errors READ: consultation withdrawn -> assert 6 == 1 (boot 2's six voided passes, exactly) learn withdrawn -> assert 6 == 1 clear-on-serve withdrawn-> assert 0 == 1250 (permanent loss on a healed prefix) key-blind clamp -> assert 0 == 1250 (loss on a prefix nobody reported) The last two are the danger direction: this fix must never discard a prefix every rank holds. It clamps only against an OBSERVED shortfall on a SPECIFIC prefix, and clears the moment the group serves that prefix, so the cost is one voided pass once rather than one per rid for ever. Double-prefill law: the requeue loses 0 today and still loses 0; what changes is that it terminates. An UNRESOLVED miss (observed_local=None) teaches the prefix floor NOTHING -- the stakes are strictly higher than for the rid scope, since a floor invented from a number nobody measured would cap every request over that prefix. The sgl-project#944 consumer ratchet CAUGHT this file on its first gate run and is now registered. NUMBERS, desk gate scripts/gate_tier2_partitioned.py, CVD="" : BEFORE 2 genuine (test_collective_family_siblings_610.py x2), 685.00 s AFTER 2 genuine (the same two), plus 14 new tests green count probe: 2 named == 2 summary, SUBFAILED and ERRORS included ruff clean on both touched files. NOT CLAIMED: no boot, no metal. The divergence SOURCE (the rank-local prefetch verdict under PP) is named here and left open -- closing it needs the sgl-project#791 ring lap to carry a prefetch-pending fact home, which is its own posten. This makes the system self-healing against a divergence however caused.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 28, 2026
…te the group, and let the guard speak sgl-project#965 -- THE CO-DERIVED MATCH TUPLE. `Req.init_next_round_input` reads the radix tree ONCE and unpacks that single `match_result` into EIGHT attributes in one tuple assignment: prefix_indices, last_node, last_host_node, best_match_node, host_hit_length, swa_host_hit_length, mamba_host_hit_length, mamba_branching_seqlen. One reading of one geometry wearing eight names. `truncate_prefix_to` moves the prefix they were derived from. Its own docstring says why that matters -- "the geometry was DERIVED from the prefix that just moved, so it is now a stale reading rather than a report" -- and that sentence is true, word for word, of every field in the tuple. It wrote prefix_indices, and over two separate windows, each discovered by a boot, cache_protected_len (sgl-project#930) and extend_range (sgl-project#958). Six were left standing. This is the complete sibling sweep those two never got. NOTHING RE-DERIVES IN BETWEEN. scheduler.py calls init_next_round_input (all eight derived), both arms of the `pp_size > 1` fork call truncate_prefix_to, then adder.add_one_req reads them. No match_prefix on that path. WHAT THE STALE READINGS DO, at PrefillAdder.add_one_req: * `real_input_tokens = cand_extend_input_len - req.host_hit_length` subtracts a host hit no longer part of this prefix, under-counting against the budget; * `needs_host_load_back()` is still true, so init_load_back runs on a stale best_match_node/host_hit_length and does `prefix_indices = torch.cat([prefix_indices, new_indices])` -- leaving `[0, told)` then `[L_dev, L_dev+H)` with a HOLE between, while prepare_for_extend sizes the cross-stage tensor off len(prefix_indices) as though it were contiguous. The silently-wrong-context class; * that branch then sets `cache_protected_len = prefix_len`, re-raising the exact value the truncation lowered nine lines earlier -- undoing sgl-project#930. FIXED AS ONE CONTRACT, not a seventh one-field patch, because two of the eight were already bought one at a time by two boots. The ratchet (`test_every_co_derived_field_is_accounted_for`) reads the producer tuples from the AST -- not by grep, since a grep needs a name and the whole point is a field nobody has thought of yet -- and FAILS when a ninth joins, telling the author to decide TRUNCATED / CLEARED / HANDLE. Planted-ninth-field proof: it names `newly_added_ninth_reading`. `last_node` IS NOT NULLED, and that asymmetry is deliberate: it is not a reading but a RESOURCE HANDLE holding an outstanding inc_lock_ref, and this attribute is the only surviving reference to it. Nulling it would leak the ref and make the node permanently unevictable -- a defect that already exists on the PP void path (`_release_dynamic_chunk_probe` frees rows without cache_finished_req / dec_lock_ref, unlike schedule_batch.py:2170-2175 and disaggregation/prefill.py :1159-1161, which do). Registered, NOT fixed here. A NO-OP TRUNCATION STILL INVALIDATES NOTHING. My first test asserted the opposite; the invalidator's own documented rule -- "a no-op truncation leaves a valid geometry valid, clearing it there would void healthy passes for nothing" -- is right, and clearing there would discard a host hit every rank still holds. The test was inverted to pin the documented behaviour instead of contradicting it. sgl-project#967 -- THE sgl-project#959 GUARD WAS UNMEASURABLE. It is closed by two bare `return AddReqResult.OTHER` statements. A refusal that leaves no trace is indistinguishable from a scheduler that simply built nothing, which is precisely the state the sgl-project#963 investigation spent a boot separating by hand out of per-rank coverage databases. Unconditional per-site counter plus a rate-limited `[sgl-project#967] SECOND CONTINUATION REFUSED` line, following the neighbour that already got this right (`_note_seam_chunk_refused`: first three, then every thousandth). Module-level, because PrefillAdder is rebuilt every pass and an instance counter would reset before anyone could read it. THE TWO GUARDS ARE IN DIFFERENT METHODS -- add_one_req_ignore_eos:1692 and add_one_req:1935 -- and my first wiring pin inspected only add_one_req, so it measured nothing and failed on the UNMUTATED tree. That is how the mistake was caught. Rewritten to walk the module AST, and it now names the offending line number when a guard's counter is stripped (proof: "guard(s) at line(s) [1935] return without counting"). The site labels are the method names. CAN-FAIL, read rather than asserted: sgl-project#965 clearing withdrawn -> 8 failed, one per field, each naming its own field sgl-project#965 ninth field planted -> ratchet names it sgl-project#967 one guard's note stripped -> wiring pin names line 1935 NUMBERS, scripts/gate_tier2_partitioned.py, CVD="" : BEFORE 2 genuine (test_collective_family_siblings_610.py x2), 685.00 s AFTER 2 genuine (the same two), 580.49 s, 358 modules count probe 2 named == 2 summary, SUBFAILED and ERRORS included truncation family + prefill adder + schedule_policy suites: 54 passed ruff: schedule_batch.py 45 before / 45 after, schedule_policy.py 21 / 21, both new test files clean TICKET_961_WINDOW.md gains section 8: the "race" of section 7 is NOT a race (ServerArgs byte-identical, the LOAD ARM differed -- 8422 chunked vs 2822 sub-chunk, and an over-one-chunk prompt forces a chunked_req onto every rank, so Arm A masks the defect), and the acceptance now counts flip EPOCHS and phase=tp BATCHES SEPARATELY: 3+3 "both directions" was 3 RANKS confirming ONE epoch, and no batch ever ran phase=tp, so every post-flip guard's green was vacuous. NOT CLAIMED: no boot, no metal, no effect measurement.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 28, 2026
…d becomes symmetric
Root (R7, boot 6): every void treated the ranks differently. Followers
obey the family's own doctrine ('A VoID IS A PARK, NOT A RETRACTION')
and keep prefix+pages; rank 0's batch members went through
_release_voided_request -> release_req -> reset_for_retract, which
clears prefix_indices and returns the pages. The two ends of the ring
then disagree about the same request every cycle: 169 told=0 refusals
(a FULL re-prefill of computed prefix per voided rid per cycle -- a
standing double-prefill-law violation on every void), 333 past-fill
refusals (total-token mismatch downstream of the same state), 6
duplicate-rid decisions (dedup-free tail requeue), rotating membership
that killed boots 3-6 after every earlier layer was closed.
Fix at both void release loops: pp_park_voided_batch_member -- the
member is queued UNRESET (prefix_indices, prefix KV pages, req slot,
retraction_count survive); only THIS pass's admission-side increments
are handed back: the prepared-never-run chunk via
_park_chunked_prefill_chunk(pass_allocated=True) and the admission
tree-lock ref via pp_give_back_admission_lock_ref. Dedup behind
pp_void_keeps_request (ordering load-bearing: reachability scans
running_batch, a different slot than running_mbs[mb_id]).
_release_voided_request keeps one caller: already-FINISHED members.
retract_decode/retract_all untouched -- their passes RAN.
Briefing premise falsified by the builder, recorded: keeping the
last_node lock ref would have REOPENED sgl-project#969 by a new route --
init_next_round_input re-matches with no dec_lock_ref anywhere on that
path, then admission takes a second ref. Pages-versus-claim is the
boundary, not keep-both: the prefix pages stay in the tree, the
request's claim is returned, which is the ordinary state of a queued
request. Both the wrong draft and the correction are in the docstring.
Instruments: 'sgl-project#984 VOID-PARK' per member (rid, prefix, kept_pages,
chunk_given_back, lock_ref_returned, slot, route) + per-loop census
INCLUDING the zero case, outside the sgl-project#801-spin suppression; #791b/#797d
now also print parked=/dup-skipped=. Boot 6 measured #791b 514x but
#797d 0x -- only the void-output loop is metal-proven; the census
closes exactly that blind spot next boot.
Execution proof (standing order): the rewired void-output loop IS boot
6's hot path (514 traversals); import smoke green; cold check driving
the REAL _pp_void_own_batch body: 23/23 (prefix survives, requeue,
dedup, one free = never-run chunk only, one lock-ref give-back, no
double free, finished-member path intact). Suites live in the test-agent
lane; predicted red there: test_pp_void_lock_ref_969.py encodes the
retract premise this commit retires -- its invariant (no leaked ref)
is preserved via the give-back.
Named posten, not bundled: sibling unreturned admission refs on the
#968b route and the kept chunked member; _pending_prefill_tokens_for
over-reports a parked member's backlog (honest figure: total -
len(prefix_indices)); req-pool kv_committed_len discrepancy duration now
unbounded for queued members (worth a test); sgl-project#963 prefix-floor wiring
stays its own posten.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 1, 2026
… producer since #1072c #1072c removed both retraction branches of `reconcile_pp_admission_decision`, so nothing mints `PPAdmissionEntry.retracted=True` any more. Everything keyed on that predicate became unreachable in the same commit, and this deletes it. The measurement is BY CONSTRUCTION, not by sampling: a consumer whose predicate no producer can set is unreachable, not merely unused, and no uniformity rate from any boot could change that. Verified from two sources, because a grep-null is not an absence: the only `retracted=True` hits in the tree are a different class (servability_matrix `RequestState`, `req.is_retracted` on the Req object), and on the construction side the only `replace()` calls on an entry are one that READS `e.retracted` and one that sets `observed_local`. GONE: `_learned_floor` and its four accessors (`learned_floor`, `_remember_prefix_floor`, `outstanding_rids`, `forget_observed_coverage` -- the last two already had zero callers), `entries_retracted_by_rank` (zero callers since #1072c dropped its import), the `if entry.retracted:` arm of `record_return_trip`, and the floor term in `prefix_len_for`'s clamp. AND THE PART THAT WAS NOT IN THE PLAN: `_prefix_floor` (sgl-project#963) dies with the SAME predicate one hop later. `_remember_prefix_floor` was its only writer and that function's only caller sat inside the deleted arm, so the dict became something nothing writes. It is removed rather than left as a clamp that can never fire under a comment claiming it still clamps -- which is the defect class this campaign has spent the day removing, and it was about to be created in the act of removing it. KEPT, DELIBERATELY, and each was checked rather than assumed: * the `elif entry.admitted:` arm (promoted to `if`). It is the ONLY clearer of `_unresolved_rounds` (sgl-project#944), `_terminator_spent` (sgl-project#955) and `_offer_streak` (#944b) -- one pop site each, counted across the module. Folding it into the deletion would have made three live gates unclearable. * `note_observed_coverage` at the top of the loop -- the sgl-project#1059 feed that makes PP0's published prefix realizable by every rank. It sits ABOVE the retracted/admitted split on purpose (its comment says why), so it survives the producer's death by design. Boot 27 is what happens without it. * the sgl-project#944 escalation, whose trigger is PP0's own re-offer and never a reported round count (#944b moved it off the lap deliberately). TESTS: a test of a deleted mechanism is deleted with it; a test whose subject survives is re-pinned, not stubbed. `test_pp_prefix_scoped_floor_963.py` goes whole. Four tests in `test_pp_unresolved_defer_cap_944.py` and one in `test_pp_forwarded_schedule_791.py` had the floor or the retraction as their SUBJECT -- the 791 one set `guard._learned_floor[RID] = 0` as its premise and would have become a test that cannot fail. `test_pp_terminator_rearm_955.py` keeps its test and loses one stale assertion: its other four checks are the reset it is actually about, and they still pass, so the clearer is intact and only its inventory shrank. THE RATCHET CAUGHT ITS OWN CASE: `TheConsumerSweepRatchet` fired on the vanished 963 reader -- the can-fail proof for the "or one vanished" half of a pin that had only ever fired for additions. Updated with the reasoning it demands. Desk-proven: py_compile, import smoke (guard constructs, `prefix_len_for` passes through, sgl-project#944 and sgl-project#1059 intact), falsifiers 25/25 + discipline 11/11, 944 18/18, 955 13/13, and 791 back to its 7 PRE-EXISTING failures, measured by A/B against the pre-cut file rather than asserted.
5 tasks done
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.
Thank you for your contribution, we really appreciate it. The following instructions will help improve your pull request and make it easier to receive feedback. If there are any items you don't understand, don't worry. Just submit the pull request and ask the maintainers for help.
Motivation
Please explain the motivation behind this PR and the goal you aim to achieve with it.
Modification
Briefly describe the changes made in this PR.
Checklist
pre-commit run --all-filesor other linting tools are used to fix potential lint issues.