Skip to content

docs: update setup github runner - #1050

Merged
zhyncs merged 1 commit into
sgl-project:mainfrom
zhyncs:ci
Aug 12, 2024
Merged

zhyncs merged 1 commit into
sgl-project:mainfrom
zhyncs:ci

Conversation

@zhyncs

@zhyncs zhyncs commented Aug 12, 2024 •

Copy link
Copy Markdown
Contributor

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

  1. Ensure pre-commit pre-commit run --all-files or other linting tools are used to fix potential lint issues.
  2. Confirm that modifications are covered by complete unit tests. If not, please add more unit tests for correctness.
  3. Modify documentation as needed, such as docstrings or example tutorials.

CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Blocked -- run-ci is required first.

@zhyncs
zhyncs merged commit 89f23a5 into sgl-project:main Aug 12, 2024
@zhyncs
zhyncs deleted the ci branch August 12, 2024 08:11
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 31, 2026
…se that could not fail is gone

BOOT 17 AND BOOT 18 DIED OF THIS, at the first genuine idle, rank-uniform:
`ValueError: pool memory leak detected! [full]` from `on_idle`. The admission
wedge that came with it was a symptom -- 99 ADMITs still happened in the same
window -- and the timeout that ended the load driver did not cause the death,
it EXPOSED it by producing the first idle the boot ever had.

THE CHAIN, MEASURED, five boots and no counter-instance (loadback-genuine /
orphan-events / max-unaccounted): 1043b 0/0/0, 1043c 0/0/0, 1046cut 3/18/54626,
1048fix 69/21/43803, 1049n9 30/6/21608. Zero load-backs -> zero orphans -> zero
ratchet. The orphan sizes are LITERALLY the load-back prefix lengths (5834,
4618, 350), rank-uniform on PP0/PP1/PP2, and the last census `unaccounted=`
before death is identical to the size of the killer's `leaked_full_pages` set
(21608 = 21608, contiguous 1..21608). An identity, not a plausibility.

So this is not a regression of the load-back. It is sgl-project#938 -- registered open
since 2026-08-27, Stage A (instrument) shipped as 226d34e, Stage B never
built -- made FATAL because the load-back finally works: whole 4618-token
prefixes are locked at the drop where the register's pre-registered fork
expected ~283 rows. That fork is hereby answered from metal, 16x larger.

WHAT CHANGES

* `UnifiedRadixCache.reclaim_rows_for_drop` returns every row the tree still
  holds, locked ones included, and `drop_prefix_tree_returning_rows` calls it
  before `reset()`. `evict` refuses locked nodes and `_reset_full` zeroes the
  protected book without freeing a row, so those rows were leaving with nobody
  owning them, one drop's worth per flip cycle.

* THE sgl-project#938 PREMISE IS NOW CHECKED, NOT ASSUMED. sgl-project#938 refused to free because a
  lock here is supposedly an in-flight write-through, and freeing under a live
  reader is a use-after-free in the sgl-project#913 family. Correct -- so the reclaim runs
  ONLY when `ongoing_write_through` is empty. On boot_855_1049n9 all 13
  `sgl-project#792 post-retract writeback fence` lines report `outstanding=0`, including
  the two drops that orphaned 5834 and 4618 rows: the in-flight explanation
  held on no drop of that boot. When a copy IS outstanding the reclaim refuses
  and prints the count -- today's behaviour, kept.

* NEVER FREES BLIND. Candidates are differenced against the allocator's own
  enumerated free set (`read_free_rows`, the union the idle invariant and the
  sgl-project#822 census already share). A non-enumerable reading refuses outright: a
  watermark allocator can say HOW MANY rows are free and not WHICH, and freeing
  against a count would be inventing membership. Double-freeing a row is silent
  corruption -- the one outcome worse than the leak.

* The free is addressed through `FullComponent._free_full`, which resolves the
  allocator per access (sgl-project#941): a captured binding lands the rows on the other
  phase's free list as duplicates, the same symptom with a different root.

* THE DEFERRAL IS INSTRUMENTED UNCONDITIONALLY. `sgl-project#1050 CUTOVER ROW RECLAIM`
  prints reclaimed/full_rows/mamba_slots/full_held/mamba_held/already_free and
  the refusal reason on every drop, including the all-zero reading. A clearer
  that can silently never run is how the same ratchet comes back one level up
  in a new pocket.

* sgl-project#919's EXCUSE COULD NOT FAIL, AND IS GONE. The audit reported
  "pp_stack_allocator owns ids [1, 578995) and covers every sampled row" as the
  explanation for 43803 unowned rows, against a census id space of 578994 -- a
  containment test true for every sample that could ever be drawn. It excused a
  real, monotone, ultimately fatal loss. `OwnerCandidate` now carries
  `discriminating`, set false when the range is not narrower than the census's
  own, and such a candidate can no longer close the question: the new
  `SECOND-POOL-SPANS-EVERYTHING` verdict says the block is NOT excused.

CHECKS (matched to this edit's failure classes, not a battery)

* devtools/check_1050_cutover_reclaim.py, 17 cases, all pass: the double-free
  guard (an already-free row is not re-freed, and the count is reported), the
  outstanding-write-through refusal with its number, the non-enumerable
  refusal, root never harvested, and the no-mamba lane. py_compile is
  structurally blind to all of these -- `component_data` is a LIST indexed by
  the ComponentType enum, not a dict, and a `.get` there would have raised on
  every drop, on metal, mid-flip.
* devtools/unaccounted_watchman.py --selftest, 4 cases, all pass, INCLUDING a
  replay of the real boot-18 log. That case earned its place: the first version
  keyed on the rank alone, passed its synthetic staircase, and read SILENT on
  the very boot it was written for, because the census emits four readings per
  cycle and the PP-layout zeros reset the streak. Keyed on the census family it
  fires. A watchman validated only against its own fixture is not validated.
* ruff clean, py_compile clean on all three modules.

NOT YET BOOTED -- desk-proven only.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…ilt 2026-08-24, never shipped

CHERRY-PICK OF 14606c6, unchanged apart from one trivial conflict.

WHY IT IS HERE NOW. The sgl-project#1050 forensics found this commit while running the
prior-art gate on its own fix route, and found it in the state the fork keeps
producing: BUILT, hermetically green (16 tests + 4 subtests, 5 mutants killed),
flag-gated so it is byte-identical when off -- and NOT AN ANCESTOR of the
shipping pin. `git merge-base --is-ancestor 14606c6 38c6f28` says no; it
lived only on fix/811-admission-pin-ack-release and fix/849-census-resident-line.
It has stood in WINDOW-QUEUE.md as TICKET W-811 since 2026-08-30 waiting for a
metal proof it never got, because as a pure capacity optimisation it had no
symptom to be measured against.

It has one now. Boot 17 and boot 18 died with `leaked_mamba_pages` of 4 slots
out of 20 beside the full-pool loss -- {13, 3, 5, 14} and {19, 18, 11, 12} --
i.e. exactly the population whose release this commit moves from "finish" to
"write-through ack". So this boot IS the W-811 metal probe, and
`leaked_mamba_pages = 0` is its acceptance criterion.

CONFLICT: one hunk, both sides adding an attribute in `__init__`
(`_chunk_publish_n` from sgl-project#1028 here, `_anchor_ack_release_armed_cached` from
sgl-project#811). Both kept; no semantic overlap.

CHECK, matched to a merge rather than to a new edit: the commit's OWN existing
suite re-run on the merge result -- 16 passed, 4 subtests passed. Not a new
battery; the point of a merge check is that the shipped proof still holds after
seven days of line movement.

NOTE ON HOW IT WAS RUN, because the first run was a FALSE RED: without
PYTHONPATH=<worktree>/python, pytest imported sglang from the serving tree
(/spinning/htsglang-gpu) instead of this worktree and died in collection. A
worktree test that does not set PYTHONPATH is measuring another tree.

The flag stays as designed (`--mamba-anchor-ack-release`, off by default,
planner-emitted, no environment form). Arming it is the launcher's business,
declared per boot.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…nts (sgl-project#902 form)

The registry already obliges every cutover participant to name a HOOK and a
REACHABILITY PROBE. The rows the prefix tree holds at the drop had neither --
which is precisely how they went missing for two boots without anything in the
tree being able to say who was supposed to return them.

hook  = UnifiedRadixCache.reclaim_rows_for_drop
probe = the unconditional "sgl-project#1050 CUTOVER ROW RECLAIM" line

The standing invariant this instantiates: a state that survives the drop
without a declared release site is a construction error, not a runtime
condition. The registry test enforces the half that is mechanisable -- both
obligations named, both symbols existing.

test_cutover_participants_859.py: 39 passed. ruff clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…ree actually reaches

Self-caught before the boot landed, and it is the same mismatch class as sgl-project#941
one level up: not WHICH object is held, but which object is ASKED.

`_free_full` routes to `full_attn_allocator` when SWA is in the tree
(full_component.py). The guard read its free set off the TOP allocator
unconditionally, so under SWA it would have checked membership in one pool and
freed into another -- the guard passing while performing exactly the double
free it exists to prevent.

INERT ON THE BOOTED CONFIG (hybrid-SSM, no SWA), so boot 19 @ e051499
measures the same behaviour either way; this is correctness for the SWA lane,
not a change to what the boot proved.

check_1050_cutover_reclaim.py 17/17, ruff + py_compile clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
… owns them

BOOT 19 CAUGHT THIS ON ITS FIRST REAL DROP, which is what the unconditional
refusal line is for:

  11:56:03 PP0  sgl-project#1050 CUTOVER ROW RECLAIM: reclaimed=False full_rows=0
                mamba_slots=0 (tree still held full=213 mamba=1,
                already_free=168) reason=%s

and the census one second later read unaccounted=45 -- exactly 213 - 168. The
differencing was right, the free was not: the filtered ids were rebuilt as a
plain CPU int64 tensor, and `TokenToKVPoolAllocator.free` does
`torch.cat((self.free_pages, free_index))` against DEVICE memory
(allocator/token.py). Cause read off the allocator, not inferred from the
exception name.

FIX: dtype and device come from the source row vector. Also: the refusal now
prints the exception MESSAGE, not just its type -- the first version named the
failure and not the cause, which is one boot of guessing for one f-string.

CHECK: check_1050_cutover_reclaim.py gains the case that fails on the old
version -- a source tensor of a distinctive dtype must arrive at `_free_full`
with that dtype. 19/19 pass. ruff clean.

Boot 19 is otherwise a clean result for everything else it could test:
ORPHANED events 0, sgl-project#988 LOADBACK genuine 3, health 200, and the reclaim was
REACHED at every drop -- the mechanism is wired, this was its argument type.
'full reclaim failed: RuntimeError'
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
… the reclaim just prevented

MEASURED ON BOOT 20, and it is a defect my own fix created: the boot emitted 6
sgl-project#938 lines saying the rows "belong to nobody from here on" while all 90 of its
census readings said unaccounted=0. Six orphaning events, zero orphaned rows.

The sentence was true when sgl-project#938 was written and false the moment the reclaim
landed below it. Left alone it would have handed the next reader six leaks that
did not happen -- the instrument-text-lies class, and this time self-inflicted.

The line is renamed PROTECTED RESIDUE AT DROP and now states what it MEASURES
(residue existed at this drop) and points at the line that says what HAPPENED
to it (sgl-project#1050 CUTOVER ROW RECLAIM, same drop). The two are read together, in
that order. The site still frees nothing itself; the write-through gate lives
in the reclaim, and that is said rather than implied.

Text and comment only -- no behaviour change. py_compile + ruff clean. Ships
with the next boot; boot 20 is running the previous wording, which is why the
reading above needed both numbers to interpret.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…t waited for a chunk the gate refuses to build

BOOT-PROVEN EDGE (boot_855_1050dev_0840f82601_0831_115825, the boot 20
livelock). The open question of the handover was WHY the broken chunk never
completes before the 30 s abandon. It is not a race: inside the armed window
12:22:19-12:22:49 PP0 logged ZERO `Prefill batch` lines and 15 `Decode batch`
lines. The chunk was never attempted, and the re-arm is in the SAME SECOND as
the abandon (12:22:49), so no unarmed window existed in which it could be.
N9's remaining candidate (abandon deadline vs chunk completion time under
growing backlog) is therefore FALSIFIED.

THE BINDING TERM, with file:line. `prefill_blocked_here`
(phase_purity.py:1087-1095) grants the sgl-project#887 one-chunk exception only when BOTH
`prefill_allowed_in_tp_now(spent)` AND `tp_compute_fits_in_one_chunk` hold --
deliberately, so the gate and the sgl-project#838 detector permit the same batches
(REGISTER_OPEN_876 on sgl-project#887). `tp_compute_fits_in_one_chunk` is `0 < pending <
chunked_prefill_size`. The last grant was 12:22:11 with new_tokens=3392 against
a 4096 cap; the backlog then crossed the cap and never came back (12347 ->
48866 -> 101075 tok), so the gate refused on every later round, SILENTLY, at
its final `return not _relaxed(...)`.

The grant is spent AT the grant (`_spend_tp_compute_chunk`), so a refusal on
the `fits` term leaves the budget untouched. The hold
(`prefill_runnable_in_current_layout`, phase_flip_runtime.py:156) read ONLY
that budget, kept answering "TP can still make progress", and
`chunk_blocks_quiescence` kept the rank un-quiescent for ever: PP0 armed 29 /
committed 4 / abandoned 48, `this rank ready=0` in all 72 abandon lines,
backlog 4618 -> 101075 tok.

CLASS: a hold predicate that predicts another gate's decision in a different
currency. SIBLING SWEEP over the three consumers of the sgl-project#887 grant: the gate
itself reads both terms; `maybe_arm_phase_policy` (sgl-project#942, scheduler.py:13611-
13632) reads both terms and says so in its own comment; the flip hold read
one. The fix makes the third consistent with the two that were already right,
by passing the gate's OWN side-effect-free probe rather than a second copy of
it. FUTURE CHECK: a new reader of `tp_compute_budget_remaining` that makes a
runnability claim must also read `tp_compute_fits_in_one_chunk`.

AND THE OPERATOR'S CONDITION, which turns this from a deletion into a
replacement. Once the hold correctly reports "this layout cannot finish the
chunk", the cutover commits over the broken chunk. That is licensed by sgl-project#988
riding the prefix across (loss <= 1 chunk = the sgl-project#939 grant) ONLY while the
COMPLETED pages are settled in the store. The old strict arm blocked on
"incomplete"; it now blocks on the real hazard -- an unacked prefix -- read
from the EXISTING sgl-project#792/sgl-project#703 fence (`ongoing_write_through`, the same counter
sgl-project#1050's `reclaim_rows_for_drop` and `on_idle` gate on), never a second ledger.
Unknown is refusal, never permission. The hold is bounded by the ack
(milliseconds), with the 30 s park deadline still the outer backstop; no
second clock.

UNTOUCHED AND PINNED BY TEST: mid-admission (no pool row -> still blocks),
non-strict (residual, still filed not solved), and pp_to_tp drain-and-flip
(runnable HERE -> still blocks, which is what keeps all prefill in PP).
The PP-microbatch-in-flight half has its own predicate and is not read here.

DETECTION: `_why_not` returned one string for three different holds. It now
names which term is holding, including the new unacked-prefix case.

DESK CHECK (matched to the error class of this edit -- a control-flow
inversion in a restructured predicate, which py_compile and import smoke are
structurally blind to): devtools/check_1033_quiescence_edge.py, 24 cases,
hermetic CUDA_VISIBLE_DEVICES="", all pass. Includes a RED-FIRST arm that
evaluates the PRE-FIX expressions on the measured boot-20 state (budget 2,
pending 48866, cap 4096) and asserts they produce the wedge, and the POST-FIX
expressions on the same state and asserts they commit only against an acked
prefix. Plus compile + import + an order proof that both probes are assigned
before either read inside get_next_batch_to_run.

NOT YET BOOT-PROVEN. This is DESK-PROVEN at the predicate; the metal proof is
boot 21.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 4, 2026
…eft the nodes naming them

ROOT, file:line: python/sglang/srt/mem_cache/unified_radix_cache.py:6069-6250
(UnifiedRadixCache.reclaim_rows_for_drop). The pass walks every node and
returns the rows and mamba slots the tree still holds -- the sgl-project#1050 contract for
locked nodes `evict` refuses -- but it never took the reference away from the
node. Every other release of a node-held anchor goes through
MambaComponent.evict_component (mamba_component.py:653-663), which frees AND
nulls cd.value AND corrects the size book; this pass had only the first third.

THE SIBLING FORM, and why sgl-project#924's own guard was silent: nothing is freed twice.
The slot is returned ONCE and the node goes on naming it, so
MambaSlotAllocator._refuse_double_free (allocator/mamba.py) has nothing to see
(free_list_duplicates=0 in the killer line). The free list and the tree then
both own the slot: alloc() hands it to the next request while the tree offers
it as a resume anchor -- one GDN state read by two requests.

MEASURED (boot 10, /spinning/evidence-665-f1/boot_855_weg1b10_2126a4a1d2_0904_211702.log
21:29:28Z, all three ranks, line 364223 for the census):

  [mamba] total=20, available=20, evictable=4, withheld=0,
          double_owned_src=live, free_list_duplicates=0,
          duplicate_slot_ids=None, free_and_cached=4
  TREE CENSUS nodes=5 | MAMBA: tracked_evictable=4 recomputed_evictable=4

DESK REPRODUCTION of that exact line against the real function (two requests
through cache_unfinished_req + cache_finished_req, then reclaim_rows_for_drop):
  before: avail=20 evictable=4 free_and_cached=[1,2,3,4] duplicates=0
  after:  avail=20 evictable=0 free_and_cached=[]

CLASS: "a component's rows are released by a walker over tree nodes instead of
through the component's own owner-transfer primitive."
SIBLING SWEEP: the FULL half of the same function has the identical omission
(_free_full leaves node.component_data[FULL].value standing); fixed and pinned
in the same test. FUTURE CHECK: after any pass that returns rows the tree held,
free_set & tree_set must be empty for every component -- asserted directly.

WHAT CHANGED
* unified_radix_cache.py: nodes are carried beside their values;
  _disown_reclaimed_value(node, ct) is the factored-out other two thirds of
  evict_component (null the value, debit protected OR evictable per lock_ref,
  leave the device LRU, join the host LRU when a host copy survives). The FREE
  stays where it was, differenced against the allocator ledger (sgl-project#1055), because
  this pass legitimately meets already-free slots; only the DISOWN is new. An
  already-free slot is now disowned too -- that is the aliasing, not a reason
  to leave the reference.
* invariant_checker.py (_check_mamba_pool): NAMED STOP "sgl-project#924 MAMBA SLOT
  ALIASING". A negative mamba occupancy (pool.size - available - evictable < 0)
  or a free list longer than the pool is now a leak verdict with both numbers.
  Boot 10 printed `mamba usage: -0.10 ... -0.30` five times over eight minutes
  (first 21:21:20Z, log:3595) and nothing acted on it. Derived at on_idle, on
  every rank with nothing in flight -- never from a batch line inside the
  no-return region between collectives (sgl-project#969 SS W3).
* allocator/mamba.py: note_924d(), the "#924D" per-(rid, station) trail that
  decides sgl-project#1190 on boot 11. Stations: alloc (memory_pool.alloc), backup
  (BACKUP_HOST build), load_back (H->D COW target, with the node's own anchor
  printed beside it), first_state (the deferred COW execution, with cow_src),
  free / relinquish (memory_pool). Bounded by construction: one line per
  (rid, station), global cap 8192, and the cap prints its own suppressed count
  so a missing rid is never read as "that station was not reached".
  Line format:
    #924D station=<s> rid=<rid[:12]> mamba_slot=[<ids>] node=<node id> <extra>
  If a B probe's first_state slot equals a slot some node still names,
  sgl-project#1190 IS this defect; if not, sgl-project#1190 is a separate carrier and stays open.

EVIDENCE
* RED on the parent (2126a4a, scratch tree /tmp/parent924 from git archive):
  9 failed / 1 passed. The 1 pass is the can-fail control
  (test_a_balanced_pool_is_not_a_verdict), which must stay green on both sides.
* GREEN after: 10 passed.
* MUTANTS, all killed (each against a copy of the source tree):
  M1 drop the mamba disown (aliased slot survives)      -> 4 failed
  M2 STOP threshold unreachable (STOP cannot fire)      -> 2 failed
  M3 disown without the size-book debit (silent drift)  -> 2 failed
  M4 drop the FULL-half disown (sibling sweep)          -> 3 failed
  M5 discriminator per-call instead of per-rid          -> 1 failed
* SUITES, the 63 registered unit files touching the changed symbols, run once
  on each side, hermetic (CUDA_VISIBLE_DEVICES=""):
  parent    78 failed, 1612 passed, 860 skipped, 195 subtests passed
  worktree  78 failed, 1622 passed, 860 skipped, 195 subtests passed
  The failure NAME SETS are byte-identical (diff clean); the +10 is this
  commit's new file. Zaehlprobe: 78 extracted FAILED/SUBFAIL/ERROR names ==
  78 in the summary, on both sides.
* ruff: new test file clean; the six modified modules carry exactly their
  parent error counts (43 / 2 / 0 / 0 / 0 / 1), i.e. nothing added.

NOT PROVEN: this is DESK-PROVEN, not fixed. The desk shows the mechanism and
the exact ledger line; only boot 11 can say whether it was the whole of the
boot-10 trajectory, and the #924D trail is what will answer that and sgl-project#1190.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant