Skip to content

Update readme - #568

Merged
merrymercy merged 4 commits into
mainfrom
update-readme
Jun 27, 2024
Merged

merrymercy merged 4 commits into
mainfrom
update-readme

Conversation

@merrymercy

Copy link
Copy Markdown
Collaborator

No description provided.

@merrymercy
merrymercy merged commit 945aa9b into main Jun 27, 2024
@merrymercy
merrymercy deleted the update-readme branch June 27, 2024 18:37
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 5, 2026
…buffer with garbage

The sgl-project#286 ledger parked a module by capturing state_dict() and restored it with
to_empty(device=...) followed by load_state_dict(..., strict=True).
state_dict() omits NON-PERSISTENT buffers by definition; to_empty()
re-materialises them anyway, with whatever was in that memory; and the strict
load then fills only the keys the state dict has. So every non-persistent
buffer came back as uninitialised memory, while park and restore both reported
success and the measured restore latency looked healthy. strict=True cannot
catch it: the keys are missing from BOTH sides, which is precisely why the
asymmetry is invisible at the seam.

For the translator that buffer is the rotary inv_freq. The symptom is NaN
cos/sin -> NaN attention scores -> NaN logits -> "probability tensor contains
inf, nan or element < 0" from torch.multinomial, one park and thirty layers
from the cause, and only when sampling actually runs.

REACHABLE BY DEFAULT. IdleParkConfig.enabled is True, and the sgl-project#546 translator
idle park drives exactly this pair: ledger.park_all() on the way down,
ensure_resident() -> ledger.restore() on the way back. So the corruption was on
the default path of a default-on feature, not behind a flag.

The same failure already had a repair on the LOAD path
(qwen3_tts_compat.refresh_rotary_buffers, whose docstring describes this NaN
chain in full). The RESTORE path never got an equivalent and nothing connected
the two -- the fork had diagnosed the failure once and stayed exposed to it
through a second door.

Fixed GENERICALLY in the ledger rather than per-module: park captures the
non-persistent buffers (named_buffers() minus the state-dict keys, skipping
meta) alongside the state dict, and restore writes them back through
register_buffer(persistent=False) into the owning submodule, so the flag
survives the round trip and a second park still finds them. The bytes are
carried VERBATIM rather than recomputed -- recomputation is a per-module repair
someone has to remember to write for each new buffer, while copying is correct
for every module the ledger will ever be handed, and is bit-exact besides.
Kept in its own dict, not merged into _cpu_state, because the restore's
strict=True load rejects keys the module does not expect.

A module with no non-persistent buffers takes the unchanged path.

Tests (CUDA_VISIBLE_DEVICES=99, hermetic, no GPU, no server):
  PYTHONPATH=python pytest test/registered/translator -q
  -> 645 passed, 2 warnings, 37 subtests passed in 24.80s

CAN-FAIL PROVEN: neutralising the restore write-back turns 3 of the 5 new tests
red -- "the non-persistent buffer did not survive the park round" for the
bit-identity test, plus the second-round and nested-submodule tests -- because
to_empty leaves the buffer holding whatever the allocator handed out. The other
two are the no-regression halves (persistent state untouched; a module without
such buffers unchanged) and stay green either way, which is their job.

The tests assert CORRECTNESS AFTER RESTORE -- the values, and that inv_freq is
genuinely absent from state_dict() so the premise is checked rather than
assumed -- not how many such buffers a model has, which is a property of the
model and no constant worth pinning.

FEATURE_CATALOG gains the round-trip-asymmetry family entry.
ruff check: no new findings. ruff format: clean on all added lines.
codespell: clean.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
…mposability fixes)

Desk strand (fix/spill-composability, included via 2a156c8): six bugs with
proven can-fail falsifiers (sgl-project#552 parked-abort leak, sgl-project#552 spec-costs-spill,
sgl-project#547 dead interop honesty, sgl-project#551 GDN blob loss + lxcfs-honest host RAM,
sgl-project#568 ledger non-persistent buffer corruption), S8 docstring fix, analyses
P6/P7/sgl-project#553. Full-sweep regression proof: failing-test sets byte-identical
vs base e08946d (911=911), +41 newly passing.

GPU strand: 8 matrix cells passed on hardware (kvso under uneven DCP,
partial spill, restore gate, kvso x NEXTN, multi-session, ladder actuation,
hibernate round trip 1.29x), matrix landed in-tree as
docs/dev/ANALYSE_spill_matrix_20260804.md.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
The night merge 2a156c8 was cut at b9a9fd6 while the desk strand kept
committing; this brings in the missing tail: sgl-project#551 GDN-ladder parked-session
fix + honest host RAM, sgl-project#568 generic ledger non-persistent-buffer fix, S8
stage-feed docstring fix + AUDIT_421 B.9, analyses sgl-project#553/P6/P7 and the
rejected-register entry. Restores the Absent-means-dead and
Round-trip-asymmetry catalog families the earlier merge missed.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…omits

TICKET STATE FIRST, because it changes what the work is: the corruption sgl-project#568
describes is ALREADY FIXED. Commit 4222976 ("ledger: park/restore replaced
every non-persistent buffer with garbage") carries the park-side copy and the
restore-side re-registration, it is present in the deploy tree (4 references to
_cpu_nonpersistent) and absent from main, and three tests already cover it
(test_a_non_persistent_buffer_comes_back_bit_identical and siblings). Verified
load-bearing rather than assumed: reverting the park loop fails exactly those
three tests and nothing else.

So this commit is the REST of that omission -- the same "state_dict() is not
the module's state" mistake, one layer up, in two places the original fix did
not reach.

1. THE LEDGER DID NOT COUNT THEM. `tensors()` enumerated `state_dict()` only,
   so `size_bytes()` under-reported while `park()` went on to free the
   non-persistent buffers as well. Measured on a 64x64 parameter plus a
   512-element inv_freq: registered 16,384 bytes, freed 18,432. The register
   prices victim choices on the registered number, and the residency report
   showed a module freeing more than it was ever registered as holding.
   FAILURE DIRECTION, stated: under-counting is the SAFE direction -- the
   actuator delivers more than promised, the mirror image of the sgl-project#715 sin
   rather than the sin itself -- and it costs accuracy, since the ladder can
   pass over a victim that would have sufficed. This cannot over-count: every
   tensor now listed is one the park really frees.

2. THE RESTORE GUARD DID NOT LOOK FOR THEM, and this one is sharp. A module
   whose ENTIRE state is non-persistent buffers -- a rotary cache is exactly
   that shape -- parks with an empty `_cpu_state` and a full
   `_cpu_nonpersistent`. The guard tested only the first and declared the
   module "parked but holds no host copy ... unrecoverable in place -- reload
   it from the checkpoint", while its bytes sat on the host one attribute away.
   A park that succeeded followed by a restore that refused. Before fix (1) it
   was worse still: such a module's `tensors()` was empty, so park took the
   "nothing to do" early exit and marked it parked having saved nothing.

Both fixed at their single sources. The guard stays strict where it should:
with BOTH stores empty the module really is unrecoverable, and a test pins that
it still refuses.

SIBLING SWEEP. The rule is module-GENERIC and always was: the ledger registers
arbitrary modules by dotted path (inprocess_tts.py:274), so every asset class
it will ever be handed goes through this path -- drafters, vocoder, speaker
encoder alike. Nor is the affected state only `inv_freq`: the rotary variants
in this tree also carry `short_cos_sin_cache`, `long_cos_sin_cache`,
`cos_sin_q*_cache` and `axis_map` as non-persistent buffers. So the general
rule is pinned rather than the single instance, over three module shapes
including one made of nothing but such buffers.

THE 19 COUNT IS NOT REPRODUCIBLE HERMETICALLY, and I will not pretend
otherwise: it is an instance count from a loaded checkpoint, while the source
carries 13 `register_buffer("inv_freq")` DEFINITION sites -- how many
submodules a checkpoint instantiates is a property of the model. What the next
translator test needs is therefore an instrument, and park now logs one: the
persistent and non-persistent tensor counts per parked asset. Confirming "19"
on metal is then reading a log line rather than guessing which submodules
loaded.

Tests: 4 new (26 in the file, 640 in the translator suite). The accounting rule
is asserted over three module shapes; the only-buffers module survives the
round trip byte-identically; it is no longer treated as empty; and a genuinely
interrupted park is still refused.

Also recorded: `git stash` is BANNED by a repo hook (shared stack across
worktrees) -- it refused an attempt to A/B this fix, correctly, and the run
that looked like a "before" was actually the fixed code. Use a patch file.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…d conflict map

PREPARATION ONLY. No branch pointer was moved and nothing was merged. Every
conflict is MEASURED by trial merges in a throwaway worktree
(throwaway/merge-train-probe, removed after measurement), not predicted.

Built from git rather than from the handed list, and git contradicted the list
twice:
* fix/713-admission-intake is ALREADY in the serving line (+0 commits, 0
  files) -- not a train item, and scheduling it would be a no-op step that
  looks like progress.
* fix/728-max-bytes-uniform points at 79216e6, byte-identical to
  feat/706-phase-uniform-hicache-keys, and has NO REMOTE. It must not be
  merged as a separate item, and its identity has to be settled first: a
  local-only branch is the one kind that disappears with its worktree.

DIVERGENCE. The 4222976 class turned out not to be the risk it looked like:
that commit is PRESENT in integration/r2 and absent only from upstream main,
which is true of every fork commit. The useful axis is the merge target -- 167
commits are on the serving line and not in integration/r2, and exactly SIX of
them are on no other train branch (the sgl-project#677 range c4bc982..5fed8a6, sgl-project#708
fc6f97b, and the merge 761d0d7). All six are reachable from
feat/677-park-wiring, so that branch carries them; if any step drops or
rewrites it, those six are the loss. The serving line is also NOT an orphaned
detached head -- 5fed8a6 is exactly feat/677-park-wiring, checked, because
unbranched commits on a serving head are how a train loses a fix.

ORDER. All eleven candidates are independent siblings (a containment check
found no branch containing another), so order is a conflict question. The
measured result is two clusters and a clean set:
* Cluster A, scheduler_teardown.py: all four sgl-project#673 thread-stop branches add
  their stop logic to the same file this lane created for sgl-project#673. They conflict
  with EACH OTHER, not with the trunk, so whichever lands first sets the file's
  shape. The barlink one also touches scheduler.py and belongs to live sgl-project#722.
* Cluster B, planner/seam: fix/602-fill-side, fix/701-ledger-wiring and
  feat/704-prefill-ladder each rewrote seam_slope.py, planner/pp_cut.py and
  test_pp_cut_prefill_speed_702.py. Three lanes editing one model of the same
  thing -- the conflict is SEMANTIC, and resolving it by taking hunks would
  produce a seam model nobody designed.
* The clean six-step train (621, 699, 673-lockstep, 706, 717, 677) merged in
  sequence with no conflicts at all and can run without either cluster.

TEST MATRIX, measured on the merged probe state: mem_cache 940 failed / 973
passed and distributed 21 failed / 2716 passed, both matching the standing
baselines. managers came out at 12 failed / 2274 passed against a standing
figure of 14 -- and the point is that this suite's count is
TRAIN-COMPOSITION-DEPENDENT: this lane's branch alone shows 4, the merged probe
12, with the extra 8 arriving from the sgl-project#677/sgl-project#713/sgl-project#631 lanes rather than from
the merge. The failing classes are listed so they can be attributed, and each
owner must record their own baseline before the train, or "the branch shipped
it" becomes "the merge broke it".

HELD OUT, with the separability question answered: 2ce1ed7 is NOT docs-only
-- it changes managers/phase_flip_runtime.py, which is exactly why it earns its
review boot. The two later sgl-project#441 commits touch no file it touches, so they are
cherry-pickable without it; the only entanglement on that branch is
be1fcec -> 2ce1ed7 (same NOTE). But 4512136 carries
sgl-kernel/csrc/kvcacheio/transfer.cu, so riding it means a kernel rebuild --
its own boot-gated risk, not something to smuggle in behind a docs-and-tests
framing.

Also in this push: the sgl-project#568 ledger commit (79216e6), which the audit found
was this lane's only unpushed work.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…sgl-project#568 correction

Same-step rule was missed on 7d70249: the mechanism shipped without its
FEATURE_CATALOG line. Added beside session_handover, which is the same
five-phase vocabulary one tier down.

The entry carries three things a future lane would otherwise re-derive:

* the four GATES with line anchors -- completeness, membership (a differing
  member set is refused, naming both; RE-FORM is absent by construction, not
  disabled by flag), phase order, and the trigger TYPE (DESIGN_329 §9's
  no-transient-reflex rule is enforced by making the reflex inexpressible);
* the DETERMINATION that RESTORE is the only phase with no in-process
  implementation, with loader.py:2468's skeleton rebuild and its parse-time
  selection at server_args.py:16097 named, so nobody re-opens that question;
* the sgl-project#568 CORRECTION on record, marked do-not-re-litigate: the
  non-persistent-buffer fix DOES generalize (a rule over the persistence
  property at translator/ledger.py:436, plus weight_updater.py:361 which never
  had the bug), and NON_CHECKPOINT_NAME_PATTERNS at phase_flip_boot.py:67 is
  the weights-arena exclusion, NOT that fix -- citing it as evidence of
  non-generality is the specific error I made and retracted.

Also records that ASSET_CLASSES is not the sgl-project#286 offload register, since §17
already warns that "sgl-project#286 offload register" names two modules.

Line anchors verified against the source rather than quoted from memory; two
of them (phase-order and trigger gates) were wrong on first write and
corrected to :272 and :255. codespell clean.
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