Repository navigation
Support more OpenAI API test - #916
Merged
Merged
Conversation
Ying1123
requested changes
Aug 4, 2024
Ying1123
requested changes
Aug 4, 2024
This was referenced Aug 4, 2024
Ying1123
requested changes
Aug 4, 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 27, 2026
…CE is not a claim: Claim.role and the sync-free sgl-project#913 guard prologue) into the flip train
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 27, 2026
sgl-project#917/sgl-project#918 added, clear 2 UP037 `--verify` named exactly what moved: THREE new mem_cache modules (test_row_reference_not_owner_916.py, test_quiesce_reports_what_happened_917.py, test_reservation_span_derivation_918.py) and not one changed sha256 among the 181 already in the table. MEASURED on this tip, hermetic (CUDA_VISIBLE_DEVICES=""): * fresh serial reference, 184 modules, one process, one order: 2 failed / 2745 passed / 927 skipped, 169.1s. 2745 = the previous 2683 plus exactly the 62 the three new modules contribute, and the 2 failures are the same two test_acceptance_emitters_758.py::RefillTiming names, compared as a LIST, not as a count. * the 181 solo logs carried forward, plus three new solo probes. sgl-project#918 rewrites 141 lines of memory_pool.py, so carrying proofs forward is a claim that needs evidence rather than an assumption. The builder supplies it: admission is `solo failure set == serial failure set`, and the SERIAL half was just re-measured against the new bytes. Any module whose failure set the reservation-span derivation moved would no longer match and would be DEMOTED with the reason recorded. Demotions: ZERO -- which is the measurement that sgl-project#918 perturbs no module's outcome, not a hope that it does not. before PARALLEL 168 RANKS 13 UNCLASSIFIED 3 after PARALLEL 171 RANKS 13 SERIAL 0 EXCLUDED 0 -> VERIFY OK gate_partition.tsv (managers) DELIBERATELY NOT REBUILT. sgl-project#917 adds one module there, and that table already carries a 35-module gap whose original solo logs (/tmp/868_solo) no longer exist. Rebuilding it now would hand 270 proven PARALLEL rows the reason `unproven:no_solo_log` and demote them all -- a table made worse to make one row look better. The new module therefore lands in the serial lane by the table's own default-for-the-unknown rule, the runner names it "unclassified: not in the partition table" in its report, and the serial lane's own arithmetic shows it ran: 606 -> 617 passed, exactly its 11 tests. gate_partition_scheduler.tsv untouched: no scheduler test module moved bytes. UP037 x2 in kv_vmm_backing.py, the same hygiene as Train-2 and 2b. The file carries `from __future__ import annotations`, so unquoting is inert at runtime; re-imported and the sgl-project#918 suite re-run (20 passed) to prove it rather than assume it.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 27, 2026
…t when Full triggers it
Boot 2f died 40 s in, 14 s after the first real cache hit. Not a wedge -- the
scheduler RAISED at on_idle:
pool memory leak detected! [full] total=465669, available=132894,
evictable=346, protected=8192, session_held=0, uncached=0,
withheld=324357, double_owned=8129, double_owned_src=live
THE DEFECT IS EXCLUSIVITY, NOT ACCOUNTING, and the ledger is only what
noticed. `double_owned_src=live` means the number came from
`_live_double_claimed_rows`, which is `len(free_rows & cached_rows)` over the
allocator's real free set and `all_values_flatten()` -- "the SIZE OF AN
ENUMERATED INTERSECTION, the ids are known, not estimated". So 8129 rows were
genuinely on the free list AND named by live tree nodes. Those ids stay
matchable, which is the sgl-project#767 direction: a later prefix hit can serve KV out of
rows that have already been reissued.
ROOT, one line. `full_component.evict_component` (:115-118) frees the device
rows on ANY cascade that reaches it and deliberately leaves `cd.value` set --
correctly, because `free_swa` has to read it first, so the clear is deferred
to `_cascade_evict`. That deferred tombstone then asked
trigger.component_type == BASE_COMPONENT_TYPE
which is a DIFFERENT QUESTION from "were Full's rows freed". A cascade
triggered by MAMBA or SWA (`mamba_component.py:529`, `swa_component.py:441`)
that reaches Full freed its rows and never tombstoned them, so the node went
on naming ids the allocator had handed back -- permanently, not for a window.
The fix asks the question the deferral actually owes: `base_rows_freed`, set
when Full is the trigger OR when the cascade loop evicts Full, and the
tombstone fires on that. The opposite direction is preserved and pinned: a
cascade that never reaches Full must NOT clear `value`, because stranding live
KV is a deficit -- the worse defect in the other sign.
SIBLING SWEEP, and the class is a single instance: `mamba_component.py:484`
and `swa_component.py:393` both clear `cd.value = None` INLINE, immediately
after freeing. Only Full defers, only Full needed a completion condition, and
only Full got it wrong. Nothing else to fix.
WHY NOW, AND WHY IT IS OLD (#wurzel-vor-wirkung): the intersection can only be
as large as the tree. Until the mamba checkpoint grid stopped vetoing every
anchor, no prefix match ever succeeded -- the tree stayed at `evictable=1` and
this term measured about ONE row, which is exactly the 2c precedent that
motivated sgl-project#912's live reading. The first real 8538-row cached prefix turned it
into 8129. The defect is not in a516b37's diff; a516b37 only made hits
reachable.
THE ARITHMETIC, since it names the sign: PP0's raw ledger is
132894+346+8192+324357 = 465789, a 120-row SURPLUS over 465669. Subtracting
double_owned=8129 makes it an 8009-row DEFICIT, and `_check_pool_invariant`
raises on `!=`, so either sign is fatal. The two peer ranks sit at a 64-row
surplus with double_owned=0; the 56-row difference is exactly PP0's extra free
rows. All three trees hold the same 8538 rows (8192+346 on PP0) -- only the
lock and the free-list overlap differ, which is why the rank that matched is
the rank that died.
RELATIONSHIP TO THE NEIGHBOURS, checked rather than assumed: sgl-project#916 (lawful
tree/request share) and sgl-project#922 (stale _resident_rows) are different populations
and are untouched. sgl-project#912 is the DETECTOR, and it worked exactly as designed --
it was built to catch a row claimed by two owners and it caught one. This is
not an indicator defect; the indicator was right.
Tests, hermetic, CUDA_VISIBLE_DEVICES="": test_cascade_tombstone_927.py,
5 passed. Red-first proven: restoring the old trigger-gated condition turns
`test_the_tombstone_is_not_gated_on_who_triggered` RED, then reverted.
SPECIMEN 2 ARRIVED MID-BUILD AND CHANGED THE VERDICT. The targeted repro
(boot_2f_a516b3750b_0827_0649.log) reproduced it with double_owned=8192 -- the
WHOLE hit prefix, so the first specimen's 63-row gap was incidental, not a
discriminator. And its ledger BALANCES EXACTLY:
available 125865 + protected 8192 + evictable 1111 = 135168
= the post-cutover free pool ("POOL CENSUS post-cutover ... free=135168")
135168 + withheld 305265 = 440433 = total -> surplus ZERO
So on that run there is no leak and nothing to correct: the raise is caused
ENTIRELY by subtracting 8192 from an exact ledger. That means the two free
readings disagree by exactly the protected count -- `double_owned` is derived
from `free_reading.rows` (an ENUMERATION) and subtracted from a ledger built
on `available_size()` (a COUNT), and `FreeRowReading`'s own docstring warns
that "HOW MANY" and "WHICH ONES" are different questions on this allocator
family. Nothing compared them.
SO THIS COMMIT DOES NOT CLAIM TO CLOSE 2f, and says so rather than letting the
tombstone fix take credit for a crash it may not cause. The second change is a
DIAGNOSTIC, not a gate: when the live reading fires, it now logs the
enumeration size against the count and the delta. Whether the enumeration
over-reports or `available_size()` under-reports decides which side is the
defect, and the fix differs on each side -- so it names the disagreement and
leaves the verdict to the reader instead of guessing.
The tombstone fix stands on its own merits, independent of 2f: a live node
naming freed rows is wrong whatever the ledger says about it, and the sibling
parity argument (both peers clear inline) is what proves it rather than the
specimen.
OBSERVABLES for the next boot: the new "sgl-project#927 FREE READING DISAGREES WITH
ITSELF" line and its delta -- if it prints delta == protected, the enumeration
is the defect and the correction term must be built from the count; if it does
not print at all while double_owned is still large, the rows really are doubly
claimed and the tombstone path is the one to keep pulling.
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
Support more OpenAI API tests and correspondingly make the backend more robust/ add more support
cover mostly (completion, chat_completion) x (echo, no echo) x (parallel sampling, no parallel sampling) x (stream, no stream) x (logprob, no logprob) x (single input, list input) x (str input, token id input)
Fix #910 which is caused by the conflict of PR #888 with parallel sampling and I made the backend more robust
Modification
OpenAI API test and the backend support that
Checklist
pre-commit run --all-filesor other linting tools are used to fix potential lint issues.