Repository navigation
[Feat]Add support for optional start len of logprobs - #1035
Merged
Merged
Conversation
Contributor
Author
|
In this PR, we automatically set the logprob_start_len to len(input_ids) - 1 to increase the cache hit rate. When user specify logprob_start_len, we will just follow the instruction of the user in SGL frontend language. |
yichuan-w
requested review from
Ying1123 and
merrymercy
and removed request for
Ying1123
August 12, 2024 08:11
Contributor
|
strat? typo? |
merrymercy
force-pushed
the
ignore_prefill_logprobs
branch
from
August 15, 2024 05:21
a46ffdd to
aa88c6e
Compare
hnyls2002
force-pushed
the
ignore_prefill_logprobs
branch
from
August 16, 2024 22:16
4ea910c to
01b064d
Compare
hnyls2002
force-pushed
the
ignore_prefill_logprobs
branch
from
August 16, 2024 22:17
01b064d to
b6cad38
Compare
hnyls2002
force-pushed
the
ignore_prefill_logprobs
branch
from
August 17, 2024 05:11
cf52946 to
f9736f2
Compare
This was referenced Sep 3, 2024
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
Co-authored-by: Ying Sheng <[email protected]> Co-authored-by: Yineng Zhang <[email protected]> Co-authored-by: Lianmin Zheng <[email protected]> Co-authored-by: Liangsheng Yin <[email protected]>
hhhh1252023
added a commit
to hhhh1252023/sglang_public
that referenced
this pull request
Jul 20, 2026
Three errors occurred in PR sgl-project#1035's CI run: 1. TestNPUStreamingSessionEagle / EagleRetractLargePage: `RuntimeError: npu_rms_norm ... error code is 161002` `Io input dtype or format is not supported, get io input info is x(DT_BFLOAT16, ND) gamma(DT_FLOAT16, ND) ...` Server process killed (exit code -9). Root cause: EAGLE3-LLaMA3.1-Instruct-8B draft's RMSNorm weight is float16 while Llama-3.1-8B main model hidden state is bfloat16. NPU aclnnRmsNorm does not support this dtype combination. Fix: switch all EAGLE3 variants to Qwen3-8B + Qwen3-8B_eagle3 (the same pair already validated in test_npu_streaming_session.py). 2. TestNPUStreamingSessionEagleV2: `AttributeError: 'Envs' object has no attribute 'SGLANG_ENABLE_SPEC_V2'` The CI image's sglang version does not yet expose this attr. Fix: remove the `SGLANG_ENABLE_SPEC_V2` env override. The variable defaults to True in current sglang, so no explicit setting is needed. 3. RetractMixedChunk / RetractLargePage: switch from Llama-3.1-8B-Instruct to Qwen3-8B for consistency with the EAGLE3 variants (single model pair across the whole file reduces cache pressure and CI runtime).
hhhh1252023
pushed a commit
to hhhh1252023/sglang_public
that referenced
this pull request
Jul 28, 2026
NPU port: streaming_session_extra + multi_instance_release_memory_occupation (cases 9, 10)
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 30, 2026
…ve the anchor pool its own budget
Handover 2100 §9.1 step 1. Two paths could turn "the host anchor pool is
full" into "there was nothing in storage", neither of them audible.
1. unified_radix_cache.prefetch_from_storage: a component returning an EMPTY
transfer list (MambaComponent when `_mamba_pool_host.alloc(1)` fails twice)
sets `alloc_failed` and votes the whole prefetch down. The SEMANTIC is
right -- a KV span without its anchor is unmatchable, so not prefetching
beats publishing an unmatchable node -- but it was completely silent: no
counter, no line, indistinguishable in every log from a storage miss.
Now named, counted, and printed WITH the host anchor pool occupancy that
caused it ("sgl-project#1035 PREFETCH DROPPED").
2. hybrid_cache_controller._storage_hit_query: the `else` branch answers
through `batch_exists`, i.e. WITHOUT the component boundary. That is
correct for a controller with no non-KV pools; on this controller non-KV
pools ARE registered, so reaching it means a component declined and the
uncapped answer publishes a KV-only node the conjunctive match walk can
never match -- an unmatchable node bought at full host-memory price, with
both counters reporting success. Now refused with 0 pages and a named
line ("sgl-project#1035 UNCAPPED-PUBLISH REFUSED"), which is what a real miss
already returns.
DESK-DERIVED, NOT YET BOOT-MEASURED: at the only unified call site an
empty list is already consumed by (1), so (2) is expected to fire ZERO
times on this boot form. That is the point of counting it -- a zero here
becomes readable as "never happened" instead of "not instrumented", and
the branch is closed either way.
3. MambaPoolHost sizing. The anchor pool was sized off --hicache-ratio, i.e.
off the DEVICE slot count: 20 device slots x 1.5 = 30 host anchors at
~74.8 MiB. Measured on boot_855_1028rerun: 22 anchors published per rank
in a five-cell session -- ~73 % of the ceiling from a handful of short
prompts, and the anchor-DENSITY step raises that rate by design.
New --hicache-mamba-host-mib (absolute MiB per rank) and an auto default
of 2x the ratio: 31 -> 61 slots, 2.2 -> 4.46 GiB per rank.
Deliberately NOT a share of free RAM: pinned_host_budget's own docstring
records that live availability shrinks per rank, so a free-RAM policy
yields divergent sizes and can raise on rank 2 while passing on rank 0 --
a divergent anchor capacity is a divergent prefetch vote
(raenge-nie-uneins) and a divergent boot raise is an NCCL hang. Every
input is rank-invariant; the machine-level question stays with
check_and_register_pinned_post, which sums and refuses by naming posts.
One provenance line per rank per boot carries source, slots, per-slot
MiB, device slots, ratio and total.
Check (speed mode, one matched check): the failure class of this batch is a
new CLI field not surviving the ServerArgs argparse machinery, so the check
was to build the real parser and parse the flag -- lands as 4096, defaults
to 0 -- plus a scope check that every new symbol in the two instruments
(req_id, prefetch_key, comp, logger) is actually bound in its enclosing
function, and py_compile on all edited files. Boot next.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 30, 2026
…pool's Measured on boot_855_1035anchor: MambaPoolHost is constructed TWICE per rank, not once. The provenance line printed six times, in two shapes -- slots=61 (ratio 1.5) and slots=41 (ratio 1.0) -- which is how the second site was found at all. The second site is phase_flip_boot.py:2056, the post-flip HiCache rebind, and it passes ratio=1.0 with the stated intent "mirror the device pool". Baking MAMBA_ANCHOR_HOST_AUTO_MULT into the pool applied it there too and silently doubled a deliberate, documented choice at a site that never asked for the policy -- the same defect class this ticket exists to close, reintroduced by its own fix. The multiple now travels as an argument, `anchor_auto_mult`, defaulting to 1.0 (no change). The assembler passes 2.0 for the L2 tier that is actually sized from --hicache-ratio; the rebind keeps mirroring at 1.0. Effect: L2 61 slots as before, rebind back to 21 instead of the leaked 41. Also corrected in prose: the ~74.8 MiB per anchor is NODE-WIDE, not per rank. Measured split under stage ratio 32,18,14: 37.41 / 21.82 / 15.59 MiB on PP0 / PP1 / PP2, totalling 2.23 / 1.30 / 0.93 GiB for 61 slots = 4.46 GiB node-wide. The previous commit message said "per rank" and overstated this step's cost by 3x. Check: the failure class is an ImportError/NameError on the newly exported constant plus a call site not receiving it, so the check imported the assembler, asserted the constant resolves there, asserted the new parameter exists with default 1.0, and read BOTH call sites to confirm which one passes it. (The first probe reported the L2 site as not passing it -- a false negative from too small a source window; reading the call site verbatim settled it. Instrument text lies; read the line itself.)
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 30, 2026
…ment; probe WHERE the nearest anchor is
Two things, both driven by what boot_855_1035anchor actually measured.
1. MAMBA_ANCHOR_HOST_AUTO_MULT 2.0 -> 1.0. It shipped at 2.0 for exactly one
boot, on the inherited premise (handover §9.1) that an exhausted host anchor
pool was starving read-through and that density must therefore wait for a
bigger pool. That boot measured the premise FALSE:
- "sgl-project#1035 PREFETCH DROPPED" = 0 with the path provably exercised
(39 HiCache prefetch successes, 12 batch_exists_v2 events -- and
batch_exists_v2 is reachable ONLY with non-empty pool_transfers, i.e.
MambaComponent was asked for its anchor slot and got one every time).
- The realised-loss distribution was BIT-IDENTICAL to the previous boot at
half the pool: 3x kv=343, 3x kv=349, 6x kv=521, all claimed=0.
The pool was never the binding constraint. The doubling bought nothing and
cost ~2.2 GiB node-wide on a box whose cgroup memory.peak is 104.8 GiB of
118 GiB, with memory.events oom_kill standing at 6 (cumulative, untimestamped
-- baseline recorded in /spinning/gpu-arb/OOM_BASELINE_1035.txt). A default
that costs memory and pays nothing does not ship.
Kept: --hicache-mamba-host-mib, the per-rank provenance line, and both sgl-project#1035
counters. The lever stays exactly where the evidence can reach it -- if
"sgl-project#1035 PREFETCH DROPPED" ever reports non-zero, raise the flag.
2. #1035b: print WHERE the nearest anchor is, at the failure point.
"claimed=0 caps={}" is produced by two different worlds that the #1028B line
cannot separate:
(i) anchors ARE inside the queried range but never at a reachable
trailing position -> a GRANULARITY problem, which denser publication
fixes; or
(ii) the queried range was cut SHORT of the nearest anchor -> a SPAN
problem, where denser publication inside the span changes nothing.
The line now carries, per capped component, how many of its blobs exist
among the queried keys and the DEEPEST index carrying one (-1 = none).
Computed only on the already rate-limited logging path.
This is deliberately measured before the density step is built: "fix an
unverified root" has already cost this strand two roots, and the queried
span here is keys=521 against a 4618-token prompt, which is itself
unexplained.
Check: py_compile on both files plus an import asserting the constant now
resolves to 1.0 and the L2 tier returns to 31 slots.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 30, 2026
The census (/spinning/gpu-arb/CENSUS_1035_readthrough_chain.md) listed every gate on the read-through chain with its instrument or BLIND. Three BLIND rows needed no new mechanism, only exposure, and all three share one shape: a gate that can ZERO the read path while printing nothing, so a boot where it fired and a boot where storage was simply cold produce identical logs. That is how this campaign measured "#cached-token: 0" for weeks without being able to say which link produced it. R11 -- unified_radix_cache.py, sgl-project#841 host-only insert declined. This is the sgl-project#841 law itself: it marks the whole fetched tail unclaimed and returns. It logged at logger.DEBUG, i.e. INVISIBLE on every boot this strand runs. Raised to warning, rate-limited, and the line now says the declined tail is released rather than published. Cheapest row on the list: a level hub, no new logic. The counter it increments already existed. R13 -- hicache_storage.py, empty KV prefix. #1028B fires only when a COMPONENT cap moved the number (final_pages != kv_pages). When the KV prefix is itself 0 the claim is already zero and NOTHING printed, so "storage genuinely holds nothing for this key" and "everything is fine" were the same log. Now named as an honest cold miss, explicitly distinguished from a capped claim. W12 -- staging_write_ring.py, refused admission. refused/refused_tokens have been maintained all along, but stats() -- their only exposure -- has ZERO callers in the tree, so a write-through page refused for want of staging room left no trace anywhere. Nothing can be READ back that was never WRITTEN, which makes a silent write-side refusal indistinguishable from a read-side miss to whoever debugs the read path afterwards. Emitted at the refusal itself rather than waiting for a reporting site to be invented. NOT built, named only (register lines, per the census): R6 symmetric participation vote returning zero silently; R15/R16 match validators and dead-node stop (sgl-project#904 exists but is unarmed); W9 -- under write_through _evict_device_leaf DELETES a childless node outright, taking its mamba anchor with it, which is a correctness candidate in its own right and not an instrumenting job. Check: the failure class here is a NameError on a logger or on an uninitialised rate-limit attribute, so the check was py_compile on all three files, a grep asserting each module defines `logger`, and an AST scope check that every name the three new emitters reference (keys, tokens, matched_length, total_len, node) is genuinely bound in its enclosing function. All pass.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…ent; every rank applies that one number Re-attaches the admission arc for one field and replaces the sgl-project#1035 gate with a constructive form. The gate bought rank-uniformity by throwing the information away (nobody loaded back, every revived token recomputed on every rank); this keeps the uniformity and returns the tokens by taking the extent from ONE rank. WHY IT IS DECIDE-AT-N / APPLY-AT-N+1, not a same-pass stamp. The per-pass proxy frame is received at scheduler_pp_mixin.py:4476, AFTER that rank has already planned its batch at :4292 -- a full admission later. There is no arc in the loop that lands a PP0 fact before planning: the request chain is the only pre-planning receive and its own induction argument promises delivery "at the top of the current or NEXT pass", and a blocking pre-planning receive is the shape of the arc sgl-project#1015 deleted after it deadlocked PP3-solo. So PP0 does not apply its own offer either; the row makes one lap and every rank, PP0 included, first applies a given extent on the same pass. Uniformity is constructive, not a bet that two ranks measured the same thing. The cost is one pass per rid and it lands on a chunk boundary: the first chunk of a cold-warm request runs without the prefix -- that is the batch whose frame carries the fact -- and every later chunk honours it. Bounded by ONE HiCache chunk, the standing sgl-project#939 bound, not by the prompt. Absent fact = no load-back on any rank, never a local substitute. A rank told an extent its own host tier cannot cover refuses loudly (PPScheduleRefused, both numbers named) rather than loading less, which would be the 1815081d46 shape divergence arrived at by being helpful. Carrier: PPAdmissionEntry.load_back_len, appended at the end of the wire row and read by index under the existing width guard, so a shorter row from an older sender reads back as None. Popped on receive before PPProxyTensors is built (the slice path maps v[key] over every entry). Relayed verbatim by middle ranks so PP2 applies PP0's number and not a re-derivation. Also deletes two stale comments that each asserted a live mechanism over code where it is dead: * ":4662 sgl-project#1015 SEND IS UNCONDITIONAL NOW" -- the contract 60fdee3 [#969J] deleted, sitting directly above the guard that does the opposite. Cost a full design round on this slice. * ":4437 pp_output_payload_with_return_trip as an independent, unaffected carrier" -- that function has 1 definition and 0 call sites, as does reconcile_pp_admission_decision. Evidence, boot_855_939reread_0840f82601_0830_232150: 15/15 genuine sgl-project#1035 refusals, 5 rids x 3 ranks, host hit rank-IDENTICAL for every rid (1278, 350, 4618, 4618, 350). Read as a hazard, never as a licence -- the docstring says so explicitly so no later optimiser adds a local fast path. Desk checks: codec round-trip with the new field, width tolerance (row 11 -> 10 reads back None), refusal path raises with both numbers, honest-miss returns None without falling back to the local hit, pp_size<=1 unchanged. Ruff finding set identical before/after (172/172, no new rule types).
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 31, 2026
…s; delete the load-back delivery chain OPTION A, in the hard form. Two edits that only work together: the memory-axis watchman moves onto the group availability floor FIRST, and only then does the delivery chain come out. sgl-project#1045 -- THE FLOOR IS PUBLISHED UNCONDITIONALLY ON A GROUP. It used to stay None whenever availability happened to be equal that iteration, and `unified_radix_cache`'s load-back fell into a RANK-LOCAL memory decision when it was None, guarded only by the delivery signal `pp_load_back_told`. A watchman on one axis was hanging off the delivery of another, and it stood down exactly when nothing looked wrong. PRICE VERIFIED BEFORE BUILDING, per the no-new-collective rule: at the live path (scheduler.py:6396) `min_avail` and `max_avail` are BOTH harvested from the same already-performed all-reduce (`t[0]`, `t[max_avail_at]`), so dropping the comparison removes work rather than adding it. The single-rank path now publishes the LOCAL value instead of None -- it IS the group min for a group of one -- which is what lets None become a construction violation everywhere downstream. Behaviourally identical on even pools: the published floor equals the live local value, and the sgl-project#694 ledger keeps it tracking through the iteration. FIX-6 IS NOW ONE BRANCH. `floor is None` at the load-back raises, naming rid, kv_tokens and local availability. A rank that cannot answer from a group number must not answer from a local one -- that is how ranks stop agreeing, and the 21:52:25 wedge is the measured price. sgl-project#1046 -- THE DELIVERY CHAIN IS DELETED. Consumption is local: `_pp_load_back_extent` returns this rank's own stamp, chosen at its own match by one shared expression over the same content. Uniformity comes from identical DERIVATION, not from one rank shipping a value. Deleted with it: `apply_pp_load_back_row` and both its call sites, PP0's self-row parking and the one-lap delay, `pp_load_back_told` and all four readers, the `sgl-project#1035` deferral ledger, the fact carriers, `holders_with_unspent_extent`, `_spend_for_entry`, the spend transition, the `sgl-project#1041` population counter and the `sgl-project#1044` ship/recv ledgers. EVERY READER WAS DECIDED, NOT SWEPT ALONG -- the enumeration is the point, because a reader falling silently into a rank-local branch is the class that found the edge in the first place: unified_radix_cache.py:2713 group-fact signal -> moved to the floor (sgl-project#1045) schedule_policy.py:107 delivery mechanics -> local stamp schedule_policy.py:2305 delivery gate -> deleted, no fact to await schedule_policy.py:2360 clamp gate -> KEPT, re-pointed. Its hazard (a GDN anchor adopted at `_applied` while the KV is cut) is created by the load-back itself and is independent of where the extent came from. KEPT AND UNTOUCHED: the admission row, its `prefix_len`/`extend_len` columns and the sgl-project#791 membership and ordering rules -- batch geometry, a different axis. The `load_back_len` FIELD stays on the wire for width tolerance and always travels None. sgl-project#1042's lifecycle contract stays, minus the spend transition that had no consumer left. CHECKS: check_1045_floor_watchman.py proves the guard CAN FIRE (a crash guard that cannot crash is worse than the branch it replaced), that a small floor is an ordinary refusal, that the rank-local fallback is DELETED rather than bypassed, and that publication is unconditional and counted. check_1042 updated: the row build must now LEAVE the field alone -- a build that still cleared it would resurrect the eraser through the back door. check_1040 green. The 1041, 1043 and 1044 checks are DELETED with their subjects; the cell's zombie test picks up their markers (ROW APPLIED, DEFERRED, EXTENT POPULATION, ROW SHIP) so a stale build cannot pass silently. py_compile + import smoke on all five modules; ruff clean. NOT YET BOOTED -- this commit is desk-proven only.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 10, 2026
…ts name; two anchor diagnoses died, so the holder is now counted instead of guessed Boot weg2sn6o: the #1317k W cap WORKED (`need=109131 got=4096 lost=105035 available=26422`), the #1317j retirement and the re-issue both WORKED (`UNDEFERRABLE RETIRED site=intake` then `site=retry`), and (j) is MET for the first time in the series -- `exempt_carrier_exceeds` genuine 0, RETIRED 6x, **D `#new-token` total = 1**, so the phase law holds. The read was then voted down at the ANCHOR pool, 84x, `host_anchor_avail=0 host_anchor_size=13`. THIS COMMIT SHIPS NO CAUSAL FIX, ON PURPOSE. Two diagnoses of that vote-down died in the last hour and a third would have been a guess: * "the mamba component still asks for the whole prompt" -- REFUTED. The PREFETCH arm allocates exactly ONE slot and reads neither `prefetch_tokens` nor `token_ids` (`mamba_component.py`, `alloc(1)`). The proposed fix (cap that parameter at its call site) would have changed nothing and would have spent a GPU window; it was withdrawn before booting. * "the host-eviction H-leaf predicate cannot reach interior nodes" -- REFUTED. `MambaComponent.drive_host_eviction` walks the mamba host LRU and TOMBSTONES internal nodes; non-leaf nodes are reachable by the reclaim. My own first text asserted this blind spot and is corrected in the same commit rather than left standing. WHAT MADE THE FIRST ONE POSSIBLE, and it is the defect this commit actually fixes: the `sgl-project#1035` line printed `len(prefetch_key)` -- the whole prompt tail -- UNDER THE NAME `prefetch_tokens`, on a line whose subject is what this read asked for. A field honest about its number and misleading about its NAME. It now prints `asked_tokens` (the capped window), `remaining_tokens` (the tail) and `anchors_asked` (1) as three separate values, and a test pins that they are three different expressions, because printing one value under two names is the same defect wearing a longer line. THE HOLDER IS NOW COUNTED. An eviction ran between two allocs of ONE slot and freed nothing, and no instrument could say why. `#1317m ANCHOR RECLAIM FAILED` counts the three candidate holders at the failure site -- `lru_anchor_holders`, `of_which_host_pinned`, `of_which_h_leaves` -- so the next boot names the root instead of producing a fourth hypothesis. That is the shape the C1 refusal census already paid for one tier up: it is what let sn6n's root be named in one boot instead of five. If `host_pinned == lru_anchor_holders` the holder is the PIN and the root is a record that never retires (the census read `already_in_flight=31`), not a pool that is too small; if `lru_anchor_holders` is 0 while `avail` is 0 the anchors sit outside that LRU entirely and the reclaim cannot see them. `#1317m ANCHOR CEILING` prints the arithmetic once per binding -- slots x W as the store-read prompt ceiling, beside solve_window's live-anchor count, and explicitly WITHOUT picking a holder. Both pool readings sit on one line because on sn6o the KV pool had 26,422 rows free while the anchor pool was at zero, and one number without the other is exactly what made two honest instruments look contradictory. The pool size itself is a PINNED LEDGER ARM (`--pin-ledger-arm-m 600` -> 13 slots, one anchor priced at 46.76 MiB on TP0) with a host-RAM cost by the ledger's own `charge_terms`, so it is named as the operator's lever and not silently changed here. Tests: 36 in test_weg2_window_liveness_1317k (the two refutations pinned so neither can be re-proposed, the three-holder census, the ask/remainder split, and that the ceiling line names no holder). 237 passed / 1 skipped across all twelve affected files, hermetic. One assertion failed first and it was the third instance today of a source-text assertion matching PROSE instead of code -- it tripped on the site's own comment saying "reads neither prefetch_tokens nor token_ids" -- so it now strips comments and says why.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 15, 2026
…tore read: partial hit = admit Boot xsn121 (991e1ea), rid 06089842 (Q1 prefix + 6.8k appendix): the told carrier now lands (PP0 told=4095, PP1 ABSORBED/WAITED, 'sgl-project#988 LOADBACK prefix moved to 4095', no mismatch), but PP0 then went through the sgl-project#1324 'STORE READ INCOMPLETE delivered=4095 deliverable=11126 shortfall=7031' arm (A12.2 store_prefix_short deferral), re-issued the 7031-token remainder every pass ('sgl-project#1035 PREFETCH DROPPED host anchor pool exhausted avail=0 size=4', 'sgl-project#915 PREFETCH REFUSED alloc_failed_post_vote'), sat 'ADMISSION-WEDGE: 1 queued, 0 running' for 120 s and died on 'sgl-project#973 RING COMMIT TIMEOUT' -- while PP1 had admitted (extent 4095..8191). The arm was built for the single-stage CONSUMER (group D, leg 2: P's write-through still in flight, boot weg2sn6s). On a PP prefill group the store has no producer to wait for -- the group itself prefills the rest -- so a read that terminated short is a partial hit to admit. `_weg2_note_store_shortfall` returns None on `ps.pp_size > 1`; the single-stage form is byte-identical (no ps on the harness doubles -> 1). Tests: test_weg2_store_consistency_1324 (+1: PP group admits the partial hit) + test_weg2_store_told_1400: 39 passed.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 23, 2026
…in-Pool, sgl-project#1035 nennt 'arena_unbound' (fnFL2x25) x25 (0f5294f): W45 weg, Flip D->P 14,6 s (x24-Wand weg), dann im P->D-Flip ein Gloo-Abort 'op.preamble.length <= op.nbytes. 8 vs 4 ... collective mismatch' -> W17. Davor auf D TP1/TP2: 'sgl-project#1035 PREFETCH DROPPED (host anchor pool exhausted) ... host_anchor_avail=6 host_anchor_size=6' und 'sgl-project#915 PREFETCH REFUSED reason=alloc_failed_post_vote' -- die Worker stiegen rang-lokal aus (D laeuft dcp_size=1, kein Token-Vektor, Teilnahme nicht kollektiv), TP0 registrierte (DORMANT-HOLD, sgl-project#1455-Prefetch waehrend des Flips) -> die naechsten Prefetch-Kollektive liefen auf ungleichen Mengen. Wurzel: der 27B-Merge brachte den Arena-Anker-Pool (#1427b). x25 zeigt 'mambahost=ArenaMambaPoolHost' auf allen drei D-Raengen, x22 (ein Commit vor dem Merge) 'MambaPoolHost'. Auf einem Form-A-Worker traegt der FormAWorkerNullStorage weder Arena noch canonical_mamba_blob, ensure_bound antwortet still False, build_hicache_transfers gibt [] -- mit 6 von 6 freien Slots. Dritte Merge-Naht derselben Klasse (x23 Arena-KV bei page_size 64, x24 Meta-Manifest, x25 Arena-Anker): ein Byte-loser Worker trifft einen Mechanismus, der jedem Rang Bytes unterstellt. - memory_pool_host.mamba_host_pool_cls(plain_cls): EIN Chooser fuer beide Konstruktionsstellen (Assembler, Phase-Flip-Rebind); Arena nur, wenn der Knopf an ist UND der Rang kein Form-A-Worker ist; die Arena-Klasse wird erst beim Wahl-Treffer importiert; der Aufrufer reicht seinen eigenen MambaPoolHost-Namen durch (die hermetischen Fixtures patchen ihn). - sgl-project#1035 nennt die Ursache: 'exhausted' vs 'arena_unbound', plus Pool-Klasse. Tests: test_mamba_host_pool_cls_form_a_x25 (3; Worker -> Plain rot auf 0f5294f), mem_cache 41 rot = Basis, weg2-Liste 18 = Basis, test_unified_radix_cache_unittest 645/860 = HEAD. Arm: NEEDLE_N Default 500 (~10k) statt 12800 (259k), SGLANG_LOAD_PROFILE=1 per Default auf P und D (Nutzer-Order 23.09.).
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 26, 2026
…tch SGLANG_WEG2_TOLD_PROBE_TREE_KEY, default off) 27B agent boots 0925/0926 (bar1agent 1922/2206, nvfp4bar1agent 2328, bar1final 0145): every P leg cached_tokens=0. PP0's store read found the previous turn's prefix in the arena (sgl-project#1439 ARENA-PRESENT leading_complete= 22934 first_stem=c90c5e64, sgl-project#905 PREFETCH-COMPLETE completed=22934), then the sgl-project#1416 clamp probe asked the same arena with UNIGRAM keys (first_stem=f9ec16cd, leading_complete=0, sgl-project#1035 R13 EMPTY KV PREFIX) and clamped told to 0 (sgl-project#1416 ANCHOR-CLAMP completed=22934 anchored=0) -- sgl-project#1419 caps every rank's match at told, so P re-prefilled the whole prompt. The tree keys bigram (is_eagle / SGLANG_HICACHE_BIGRAM_KEYS, sgl-project#1233: c90c5e64 bigram vs f9ec16cd unigram); the probe passed origin_input_ids[:told] as plain ids. Since xsn171 (first clamp boot) every clamp answered anchored=0. Switch on: RadixKey(ids[:told+bigram], is_bigram=tree.is_eagle), sgl-project#1442 handoff keys substituted like _storage_hit_query. Off: byte-identical. Decision stays on PP0 only (told on the wire), followers unchanged. Tests: test_weg2_store_told_1400.py 24 passed (+5: off reproduces the 0, on keeps told, on still clamps beyond the leading run, unigram tree unchanged, handoff keys). UNIFY (UN6, Operator 26.09. Vorrang): pick of desk/27b-pprefix-0926 (4d216bb, PX) onto the unified head, clean. Modellneutral (NF MTP bigram alike), switch default off. dup_defs_gate vs 27b-rc9-103712cdb2 + nf-rc2.1l-d1c7094ba6: 0 new. test27b.sh: test_weg2_store_told_1400.py 24 passed.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 27, 2026
… park retained Metal dkr27bparkdraftbar1w209270645 (27B, rid weg2-2-5) and dkrnfh91bar1dauer09270859 (NF, weg2-1-13 / weg2-6-29): the same root on both models, so the repair is model-neutral. WHY 256 OF 417. park_running retracts with retain=True; cache_finished_req inserts min() of the components' retention lengths. With --mamba-scheduler-strategy extra_buffer the mamba component answers req.mamba_last_track_seqlen, the last DECODE TRACK point (multiple of --mamba-track-interval 256): sgl-project#1469 RETAIN token_ids_len=417 cache_len=256 (NF 47262 -> 47104, 45697 -> 45568). The KV above it is freed and never written (sgl-project#1439 census of the 416 keys: 255 COMPLETE, 161 state 0). 256 IS the last valid mamba anchor; KV beyond it cannot be resumed without a state and is recomputed anyway -- correct, not the defect. WHY THE REST WAS NOT READABLE -- never written, and asked for anyway. The dormant-hold read and the sgl-project#1471 settle registered the request's WHOLE context (417 / 47262 tokens), a span the store can never complete: * NF: prefetch INCOMPLETE delivered=47104 deliverable=47232, every re-read of the 128 declined below the threshold (vote_negative), SETTLE-RELEASE lapsed held_after_wake_s=20.0; * 27B: the store held 255 bigram pages -- one under prefetch_threshold 256 -- and the prefetch thread revoked every read (storage_hit_count < prefetch_threshold), record materialized 0, four sgl-project#1456 zero-answers, held_after_wake_s=20.1; after the lapse the fresh read (hand-off keys dropped at the wake) answered sgl-project#1035 R13 EMPTY keys=417 and D prefilled all 418 tokens. THE REPAIR (SGLANG_WEG2_PARK_READ_CAP, default on; 0 = the old read byte for byte): * cache_finished_req stamps the raw token span of the key it inserted (weg2/d_park_read.py RETAINED_ATTR; bigram = units + 1); park_running clears a stale stamp before the retraction and stamps (retained, request length) on every parked request, one line WEG2-D-PARK RETAINED; * _prefetch_kvcache ends the store read of a request whose length has not changed since the park at that span (after the fork cap): the read lands COMPLETE, nothing to settle, the resume's extend computes the tail (< one track interval); * that read may be smaller than the threshold (min_tokens=1), and the controller now honours a caller's floor on the store hit too (managers/weg2_min_hit.py, registered before the operation is queued, consumed once, never raises the threshold) -- the same second-threshold gate had also defeated xsn437's sub-threshold tail re-read. All terms are functions of the request ids and the retained key (identical RETAIN on TP0/1/2 on both models, Form A workers included) -- no collective, no file. Not changed: the retain itself (a live-state anchor at the park would need sgl-project#747's grid rule lifted); PK2's zero-read settle stays as the net. Tests: test_27b_park_retain_read_0927.py 13 (retained span arithmetic bigram/plain, read span == stored units, cap inert once the request grows, switch off/no stamp = old read, controller floor lowers once never raises + metal numbers 255<256, bounded table, park stamps/clears/logs, REAL UnifiedRadixCache+MambaComponent: stamp == what the tree holds with a 16-of-21 track cap and the KV above freed, wiring order). Mutant (stamp the whole span) caught. Affected suites per file (weg2 park/hold/settle/refetch/store-short, mamba anchor, prefetch gate/participation/generation, controller reset): branch 380 passed / 8 failed, base 9417507 367 / 8 -- the same 8 (mamba_anchor_seams_747 x1, prefetch_completion_generation_905 x1, participation_desync_580 x6) fail identically on the base; test_unified_radix_cache_unittest exceeds the 3G test cgroup on both.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 28, 2026
…mba anchor lands where the next session reads -- rc12z30e (P log ...09282117_ca2a9706ec_0928_211748, PP0 21:27:17): weg2-14-37 (16869 tok) '#1028B FETCH CAP n=7: kv=251 claimed=0 lost=251 ... anchors_in_range mamba (0,-1)' -> 16869 tokens prefilled from 0 (8.29 s) although the store held 251 KV pages (16064 tok) of the shared prefix: the writer anchored only at its chunk end 16384 and its end, both past the divergence ~16090.
Intra-chunk anchors (upstream extra_buffer / mamba_track_interval) rejected with numbers: 34.29 MiB per anchor on PP0 ('sgl-project#1035 ANCHOR-POOL per_slot=34.29 MiB'), ~56 MiB over P; every 4096 tokens ~14 KB/token, more than the KV itself (PP0 7168 B/token), on EVERY prefill, against a 9-slot host staging, a 32-slot arena and a device retention budget of 8; upstream tracks one snapshot per forward. Gain on the boot: 1 of 9 PP0 FETCH CAPs lost more than 4096 tokens.
Instead: the store probe notes kv_uncapped > claimed per rid (hybrid_cache_controller, prefetch thread); PP0's adder (PP group P, TP 1 -- followers execute its forwarded extent, sgl-project#791) cuts a TRUNCATING extend at the fork depth = max(_prefetch_registered_prefix_len + kv_uncapped pages, key_match_depth), floored to the anchor grain -- only when the cut is FREE (ceil((N-fork)/C) <= ceil((N-p-L)/C)) and, under SGLANG_WEG2_MAMBA_ANCHOR_INTERVAL, where that rule donates an anchor anyway. 14-37: 16064 + 805 instead of 16384 + 485 (2 forwards both), anchor at 16064; the next session with that prefix claims 251 pages and computes ~805 tokens instead of 16869. Paid cuts are not taken (counted). No switch: off on group D and on non-PP groups by construction.
Metal marker: 'WEG2 P-FORK-CUT CUT rid=... fork=... src=store|tree cut=...' (SKIP lines rate-limited with counts outside/paid/interval).
Tests test_weg2_p_fork_cut_0928 (11, 14-37 numbers): the wiring test red on decb604 (module absent there: all red), all green with the fix; neighbours 29 files (adder/chunk/end-anchor/tail-fold/twin/prefetch/handoff/fork_anchor): 45 old failures identical on base and fix, 0 new.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Oct 23, 2026
…probe, probe=n:keys:wall:cpu)
Boot boot_weg2_dkr27bint4arbar1int4ar10231444_a45112428e_1023_144422, D TP0 14:49:12-36Z: 34 gaps of 450-580 ms
cause=other, run_ms ~20, spans recv/admit/result < 50 ms, "rest" 400-500 ms -- no span named it. In the same rounds D
re-probed two hand-backs the lifetime gate refused (D-ADMIT-AFTER-REFUSALS refusals=37 waited_s=20.1
gates={lifetime:37}): sgl-project#1439 ARENA-PRESENT keys=118709 / 107619 census=[(0, n)], sgl-project#1472 READ-TRACE asked=512 readable=0
why=no-file, sgl-project#1035 R13 EMPTY KV PREFIX, every round.
HiCacheFile.batch_exists_v2 (the one presence probe all paths take) now reports keys, wall and the CPU of the thread that
ran it (functools.wraps decorator, instrument only) to d_decode_gap.note_probe; the tracker takes them per decode round,
prints probe=n:keys:wall_ms:cpu_ms on the D-DECODE-GAP line and names the gap store_probe when the probes' thread CPU
is at least half of the unnamed rest (also counted in the census). No decision reads it; rank-local, no collective.
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
#902 required by #852
Modification
tokenizer manager
Checklist
pre-commit run --all-filesor other linting tools are used to fix potential lint issues.