Skip to content

Multi-node Tensor Parallelism - #550

Merged
Ying1123 merged 7 commits into
mainfrom
multinode-tp
Jun 18, 2024
Merged

Ying1123 merged 7 commits into
mainfrom
multinode-tp

Conversation

@Ying1123

@Ying1123 Ying1123 commented Jun 16, 2024 •

Copy link
Copy Markdown
Contributor

Similar to torchrun, enter command into each node with respective node-rank.

GLOO_SOCKET_IFNAME=eth0 python3 -m sglang.launch_server --model-path meta-llama/Meta-Llama-3-70B-Instruct --tp 16 --nccl-init-addr 172.16.5.82:20000 --nnodes 2 --node-rank 0
GLOO_SOCKET_IFNAME=eth0 python3 -m sglang.launch_server --model-path meta-llama/Meta-Llama-3-70B-Instruct --tp 16 --nccl-init-addr 172.16.5.82:20000 --nnodes 2 --node-rank 1

@Ying1123
Ying1123 marked this pull request as draft June 16, 2024 03:46
@Ying1123
Ying1123 force-pushed the multinode-tp branch 13 times, most recently from 3cfeb85 to f993650 Compare June 16, 2024 09:49
@Ying1123
Ying1123 force-pushed the multinode-tp branch 4 times, most recently from 2a0f15b to b35de42 Compare June 16, 2024 10:17
@Ying1123
Ying1123 force-pushed the multinode-tp branch 4 times, most recently from e071cac to 0d994b3 Compare June 16, 2024 10:34
@Ying1123 Ying1123 changed the title Multi-node Serving Multi-node Tensor Parallelism Jun 16, 2024
Comment thread python/sglang/launch_rpyc_service.py Resolved
Comment thread python/sglang/srt/server.py Resolved
Comment thread python/sglang/srt/server_args.py Resolved
Comment thread python/sglang/srt/utils.py Resolved
Comment thread python/sglang/srt/utils.py Resolved
@Ying1123
Ying1123 marked this pull request as ready for review June 18, 2024 03:40
@Ying1123
Ying1123 merged commit 09593e9 into main Jun 18, 2024
@Ying1123
Ying1123 deleted the multinode-tp branch June 18, 2024 03:41
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 6, 2026
…on gap stays open

BOOT. kv-session-offload and HiCache came up together for the first time under
one joint pinned-host-RAM budget: 3x 1.00 GB kvso spill pools alongside an
8.00 GB HiCache tier, O_hicache_contention byte-coherent within the A-vs-A
band. Two fixes were needed to get there.

--hicache-mem-layout page_first_direct is MANDATORY on this hybrid GDN model.
HiCache's MambaPoolHost accepts only that layout, and the server_args layout
normalizer resolves layout-vs-io-backend pairs but has no hybrid-model case,
so the default reaches pool construction and dies with a scheduler traceback
instead of a named argument error. Recorded on the arm; a parse-time refusal
belongs in the HiCache path but is foreign code and out of this scope.

The allocation log named the wrong feature: every pinned host pool announced
itself as "hierarchical KV cache", so a kvso spill pool logged as HiCache.
With both live that reading is simply wrong, and this line is the first place
an operator looks when the joint budget refuses. It now names the post.

MEASURED, and the answer is not the one a PASS would suggest. ms/round =
median streaming inter-token interval, 16 streams x ~20k prompt tokens.
WITHOUT HiCache: 115.11 ms/round, A-vs-A floor 0.48 ms (0.4%). WITH HiCache:
151.39 ms/round mean, A-vs-A floor 75.97 ms (50.2%). That floor IS the result
-- one WITH run spilled and the other did not, so the arm straddled two
regimes. Like for like, the no-spill runs are 113.40 (with) vs 115.11
(without): no measurable HiCache penalty in steady state. The spilling run
cost 189.38, but the control never spilled, so spill cost and HiCache
contention are confounded. Gap (2) is NOT closed and the pair stays opt-in.

THE SHARPER FINDING. Every passing spill arm spilled ZERO times: the probes
are a few dozen tokens against a ~120k-token device pool, so the logs carry
only arming lines and not one SPILL(. Those PASSes prove the arms boot and
stay byte-coherent; they are not evidence about the spill path. The B1 spec
gate is therefore NOT flipped -- its stated reason is one unobserved round (a
spill landing in the same round as a drafter-in-tick step) and nothing here
observed it. Spill arms need a load precondition before they can count.

Also: D_offload_x_crossalgo fails identically on the pristine base commit
(CUDA OOM in graph capture, cross-algo holding both draft rungs) -- verified,
not a regression from this branch. H_ps2_prefill_spill and I_dflash_shards
booted but returned STOP: the harness could not confirm the `graphs` field.

Production restored: watchdog active, health 200, cards released.
Tests: 986 passed in server_args + boot_matrix + mem_ledger + gdn_slot_runtime
(the 1 failure is a pre-existing cross-file ordering artifact, identical on the
base commit). ruff at baseline parity.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 6, 2026
…t pinned budget, sgl-project#549 lxcfs + GDN restore fix, sgl-project#552 arms)

Operator review: core diffs read (pinned_host_budget single owner, sum guard
replaces the sgl-project#547 refusal behind KVSO_ALLOW_HICACHE=1 opt-in, six pinned-pool
RAM checks moved to host_memory_bytes_for_pinning, fourth GDN classification
for running+parked+slotless sessions with a red-first falsifier); targeted
suites self-run hermetically on the hunter tree: 360 passed (gdn_slot_runtime,
kvso_hicache_exclusion, boot_matrix arms, mem_ledger 295). GPU window: 6 of 9
arms PASS incl. first joint kvso x HiCache boot; N passed byte-coherent but
spilled zero times, so B1 stays shut; contention confounded (spill vs no-spill
regimes straddled) -- measurement gap stays open; D OOM proven pre-existing.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 11, 2026
… them lied

A catalog-vs-code audit caught drift I introduced when rung 3 changed meaning,
including an error message that actively misinforms.

THE LIE. resolve_spill_depth's refusal printed "the deepest implemented rung
is 3 ('draft': ... the draft model's weights)". After this shift rung 3 is the
ARENA TAIL and 'draft' is rung 2, so the integer and the name in one sentence
described two different rungs. An operator reading it would conclude the arena
rung was unimplemented. Fixed by deriving the name: DEPTH_NAMES_BY_VALUE is
built from DEPTH_NAMES rather than hand-written, because a hand-written name
there is exactly how this happened.

The module docstring was also stale in two ways: the flag list omitted `arena`
and advertised "integers 0..3" when MAX_DEPTH is 4, and the rung table still
showed 3 = draft+graphs. Its rung-2 figure (~1.86-2.01 GB/rank) was the
memory-usage delta that HANDOFF_672 disproved -- replaced with the
exclusively-owned 439/285/285 MiB and a note saying which mistake it was.

Pinned so the next insertion cannot repeat it: every rung name must appear in
the flag list, the documented integer range must equal MAX_DEPTH, every rung
integer must have a table row, the name map must be derived, and the refusal
must name DEPTH_NAMES_BY_VALUE[IMPLEMENTED_DEPTH].

CATALOG (feature-catalog duty: update on every merge). Added rung 3 `arena`
with its measured 318.7/220.1/1191.0 MiB, the load-bearing ordering, and the
opposite-leg pricing. Added a full entry for corridor_guard.py, which was
absent entirely: the gate at the allocation, the two watermarks, tier-above-
cost relief, the NVML fleet gate, the two floors, refusal_is_fatal and why,
and the metal proof line. Recorded that idle mamba/GDN slots and kvso are
DISPROVEN payloads so nobody rebuilds them, and named the KV bytes that can
actually be returned.

Also fixed pre-existing catalog drift not of my making: §3 still listed
--enable-hierarchical-cache as mutually exclusive with kvso, which sgl-project#550
converted to an opt-in behind KVSO_ALLOW_HICACHE=1; §12 documented the
resolution but the §3 bullet was never updated.

Suite: 850 passed, 1 failed (the inherited _staging_bytes red).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
… the general mechanism

VERDICT FIRST: the exclusivity is LIFTABLE and was already lifted. Nothing to
build; this commit closes a test gap the lift left behind.

CHECKED BEFORE BUILDING, as instructed. The refusal at server_args.py:7385-7395
is not a hard exclusion -- it is an OPT-IN gate. KVSO_ALLOW_HICACHE=1 reaches
the pair, the default is still a refusal, and the message states the reasoning:
the two host pools are independent objects with disjoint key spaces, and their
pinned host RAM is summed by one joint budget guard instead of each validating
alone. It also names what is genuinely open, and names it correctly: "a
measurement, not a mechanism" -- the contention between kvso's in-critical-path
spill copies and HiCache's backup/prefetch transfers over the same link. That
is window work, not desk work, so I built no mechanism for it.

That half is well covered: test_kvso_hicache_exclusion_547.py, 22 tests green,
including one that pins the message does NOT claim a physical impossibility.

THE GAP. The arg-parse check sums the two CONFIGURED pools. It structurally
cannot cover pools allocated at runtime, and those go through a different door:
a process-wide registry (register_pinned_post), where
check_and_register_pinned_post admits "this pool PLUS every pool already
registered in this process instead of this pool by itself". The phase-flip host
weight images already register through it (weights_arena.py:340-357), so there
is a THIRD pinned-host consumer today.

That registry is what makes the joint budget general rather than a two-consumer
special case, and it is the door sgl-project#706's canonical host/disk tier will arrive
through. It had ZERO tests -- register_pinned_post appears nowhere in the
corpus's tests.

These 7 pin it: posts accumulate rather than replace, unregister removes only
its own, an admitted post is registered so the next caller sees it, and an
unreadable host figure does not refuse (refusing to guess beats refusing a boot
on a fabricated number). The pair that matters is a can-fail: 20 GB is REFUSED
against 40 GB available once 30 GB is registered, and ADMITTED when it is the
only post -- so the refusal is demonstrably the sum, not the size.

Stated plainly: these are CHARACTERIZATION tests and were green on arrival.
There was no defect to fix, so nothing was red-first; the mechanism is already
correct. The value is that a later tier is now accounted by construction rather
than by the next author reading a docstring.

Deliberately not touched: whether sgl-project#706's store should register, which is their
spec and their branch.

mem_cache + the 547 suite: 810 passed, 0 failed. ruff clean.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
… nothing to register

Spec note answered for the sgl-project#706 store, with the reasoning recorded rather than
the conclusion alone.

DECISION: the canonical store allocates NO host memory of its own, so it
registers nothing with the process-wide pinned budget
(pinned_host_budget.check_and_register_pinned_post; today's consumers are the
kvso host pool, the HiCache host pool and the phase-flip weight images). Both
directions take CALLER-OWNED buffers -- write_extents reads the payload it is
handed, read_extents fills the target it is handed -- and the file I/O is
os.pwrite / os.pread against those. There is no steady-state buffer of the
store's to account for, so "register at attach/resize" does not apply here
rather than having been overlooked.

Pinned by CONTRACT, which is the part that can rot: TestNoStoreOwnedBuffers
asserts the read fills the caller's tensor and the write does not relocate it.
A future change that gave the store its own staging buffer breaks those two
tests, and that is precisely the change that would have to register.

FLAGGED FOR WHOEVER OWNS sgl-project#550, and NOT fixed here because it is not ours: the
file backend takes its read target from host_pool.get_dummy_flat_data_page(),
which allocates a fresh PINNED tensor PER READ on both pool families
(pin_memory=self.pin_memory -- pool_host/mha.py:471, memory_pool_host.py:563).
It predates this work and the joint budget cannot see it. It scales with
concurrent reads rather than with tier size, so it is a per-operation spike
rather than a missing pool -- but on a prefetch-heavy path it is real pinned
memory nobody counted, and the budget refuses over-commitment on numbers that
do not include it.

Recorded in evidence-665-f1/PLAN_PERF_PIPELINE_2026-08-16.md.
Tests: 32 in the store suite (2 new), 119 across the sgl-project#706/sgl-project#703/sgl-project#718 family.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…c, cross-ref sgl-project#726

Docs only; no production file touched. Closes the three items my own retro-sweep
left open.

## 1. EVERY=32 (former section 19.3): NOT DEAD, but path-dependent

Traced the constant to its consumers rather than trusting either ledger entry.

  check_every() returns 1 when the env var is unset (barlink_abort_gate.py:
    189-197). The default is ONE, not 32 -- "=32" is only meaningful if
    somebody sets it.
  barlink_bar1.py:5177 reaches it UNCONDITIONALLY, after the
    abort_check_enabled / pending-launch gates. LIVE on bar1.
  barlink_device.py:1562 sits in the in-line fallback path BELOW sgl-project#517's
    _abort_poll_active early return, so on the device transport it is bypassed
    entirely whenever the watchdog feeds the flag.

BOTH LEDGER READINGS WERE PARTIALLY RIGHT AND NEITHER WAS COMPLETE. "Dead since
sgl-project#517" is true of the DEVICE path only -- that is exactly what phase 2 made
cheap -- while bar1 never got that treatment and still consults the knob.
NOTE_517 itself treated ..._EVERY as arm B3, expected to buy nothing on top of
the staged read; "buys nothing measurable" is not "the consumer was removed",
and that elision is how the two readings drifted apart. The sgl-project#431 utilisation
figure (72-84% -> 86-91%) predates sgl-project#517 and was never re-measured after it.

THE RECIPE QUESTION, answered: the production boot recipe does NOT set it --
absent from startkommandos-rig.md (grep -c = 0). So there is no dead knob in the
recipe misleading the next operator, which was the specific worry.

Worth recording: this is the SAME bar1-vs-device asymmetry I found independently
in sgl-project#673, where bar1's check_aborted never consults _abort_poll_active while the
device path short-circuits on it. Two investigations converged on one structural
fact about these two transports.

Section 19.3 is now empty and points at the settled 19.1 entry.

## 2. Stale spill-matrix doc (section 19.4): corrected at both sites

ANALYSE_spill_matrix_20260804.md claimed kvso x HiCache is mutually exclusive
and that "kvso cannot run on the production recipe at all". sgl-project#550 superseded
that: the combination is OPT-IN, gated on KVSO_ALLOW_HICACHE
(server_args.py:7502, `if os.environ.get("KVSO_ALLOW_HICACHE", "0") != "1":
raise`). Per the refusal's own text the two host pools are independent objects
with DISJOINT KEY SPACES and their pinned host RAM is summed by ONE JOINT BUDGET
GUARD instead of each validating alone; what remains is a measurement
(spill-copy vs prefetch contention), not a mechanism.

Fixed in section S1 and in the H15 matrix row, with the original text kept
inline so the change is legible rather than silently rewritten.

ANCHOR CORRECTION: the gate is at server_args.py:7502, NOT the :7385-7395 given
in the brief. Cited by symbol per the anchor rule -- the sgl-project#621 sweep found audit
line numbers had drifted, two of three into the wrong file.

## 3. sgl-project#726 cross-reference added to section 19.1

The INT8-KV IMMA-QK builder must CREATE the dtype surface, not find it: choices
at server_args.py:1026 carry no int8, the fp8 KV scale path is hard-coded
per-tensor, and the one per-group-scale precedent (MHATokenToKVPoolFP4)
dequantises eagerly before any backend sees it -- copying it buys VRAM savings
but NOT the bandwidth savings an int8-KV lane exists for. Budget the plumbing as
new work. The anchor is VERIFIED; the FP4-precedent detail is marked
UNVERIFIED-LEDGER (relayed from ANALYSE_726, not re-read here).

PRIOR-ART GATE honoured: grepped FEATURE_CATALOG, docs/dev and git log --all
--grep before each change; both absence claims carry the file:line of the
refusing gate (KVSO_ALLOW_HICACHE at :7502, kv_cache_dtype choices at :1026).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
Merged the serving lineage in. Three doc conflicts: exec won two on CONTENT,
not category -- its edits correct my own run-card (--hicache-size takes an
integer number of gigabytes, so my '5G' would have failed the boot the card
exists to drive) and retract a NOTE_545 claim with a real attach/detach run
behind it. Docs-keep-mine would have shipped a bad flag value.

sgl-project#630 did NOT clear, and the reason is a cross-lane contradiction rather than a
missing patch: sgl-project#703 removed the PARSE-TIME blocker because the runtime twin was
gone (7336c08), exec restored the runtime twin (90e84ad), and restoring
the parse-time one would refuse the very boot this train's own run-card tells
F4-r4 to perform. Left failing with the decision named.

sgl-project#612 declared, sgl-project#584 both constants filed with differentiated verdicts.

New: exec's double-billing fix reds two sgl-project#550 admission tests. Its credit-back is
sound only under the invariant its own comment states (registration follows
allocation); sgl-project#550's fixture registers without allocating. Not patched -- either
the fixture is impossible or the credit-back under-charges, and rewriting one
lane's test to match another's model would erase the question.

Zero UNEXPLAINED new failures: three remain, each with cause and owner.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…ct the sgl-project#550 fixtures

sgl-project#630: the parse-time blocker is back, narrowed to match 90e84ad EXACTLY
(pp_size > 1 AND enable_hierarchical_cache AND a storage backend), with the
same reason string and a pointer to the runtime twin. Refusing at parse costs a
second; the runtime twin fires after a full weight load, which cost 11 minutes
and a dead instance. The sgl-project#703 comment is rewritten to the new truth with its
provenance: 9da9dfd BOUNDED the wait and never rooted the desync, and
test_hicache_bounded_waits_630.py proves only that a bounded call raises on
schedule against mocked Work objects.

test_v1_blockers_named now names a storage backend, because the narrowed guard
deliberately no longer refuses the device+host-local tier.

DESIGN_706_BOOT.md gains PRECONDITION 0 -- this boot is BLOCKED until the
pp_sync rendezvous is rooted -- so the refused boot and the run-card that
describes it cannot drift apart, and it names what stays reachable meanwhile.

sgl-project#550 DETERMINATION, from the producers rather than from either model. Every
consumer except one goes through check_and_register_pinned_post. The exception
is weights_arena.py:428 (_register_image_post), and it registers BEFORE it
allocates -- lines 439-460 do the allocation -- so exec's stated invariant
'registration FOLLOWS allocation for every producer' is literally inaccurate.
But the gap closes inside the same call, so any LATER checker sees bytes that
are already allocated and the credit-back is sound where it is used. No
producer leaves a registered-but-unallocated post standing on a success path.

So the fixtures encoded an impossible machine, and they are corrected on
physics:  is read LIVE, so an allocated 30 GB post cannot coexist
with a static 40 GB available, and it cannot stay 40 GB after 20 GB is
allocated. Both tests keep their exact intent -- a post must not be admitted on
its own arithmetic, and the second post must see the first -- with numbers a
machine can actually be in.

Residual, named not buried: on the weights_arena allocation-FAILURE path the
post stays registered with nothing allocated, and there the credit-back would
under-charge. Narrow, real, and owned by sgl-project#706/sgl-project#695.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…etermined, latecomers in

Ledger updated with T1-T4. Six suites now at zero failures (mem_ledger,
server_args, boot_matrix, mem_cache plus the two already clean); the two
remaining deltas are the cluster-b inherited set and one order-dependent
pollution pair that passes alone and under filters.

No unexplained failures remain.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…indow; audit finds it systemic

The residual filed in the train's T2: a post registered with nothing allocated,
where sgl-project#706's credit-back then under-charges the next admission.

WHY IT EXISTS, and the audit answer is bigger than the filing. Every producer
declares its post BEFORE allocating, deliberately -- "an over-commitment is
refused instead of discovered: the registry's whole job is to fail at the
declaration rather than at the allocation" (read_buffer_pool.py:70-72). Correct
for the check, and it necessarily opens a failure window: if the allocation
raises, the post describes bytes that never existed, and the credit-back
subtracts already-allocated posts from the next demand. A post that never
allocated is credited back anyway, so the next admission is charged too little
-- the registry waves through the exact over-commitment it exists to refuse.

AUDIT (brief item 3): the brief expected two siblings; ALL EIGHT producers have
this shape, none is clean.
  FIXED    model_executor/weights_arena.py:428  (alloc at :439-460)
  FIXED    mem_cache/read_buffer_pool.py:73     (alloc at :79)
  FILED    mem_cache/memory_pool_host.py:141, :770, :1147, :1680
  FILED    mem_cache/pool_host/mha.py:684
  FILED    mem_cache/pool_host/base.py:164
The six filed are on the KV-pool hot path and each wants its own
allocation-failure test; fixing eight at once on a train branch is a blast
radius this slice did not need. unregister_pinned_post already exists and both
fixes use it, so the rest are mechanical.

FIX SHAPE, constraint honoured: the success path is byte-identical -- same
allocator, same fallback, same return. Only the failure path is new, and it
obeys sgl-project#386: the post is taken back and the ORIGINAL exception is re-raised
untouched, so the operator still reads cudaHostRegister's own words instead of
a cleanup message. _register_image_post returns the name it registered so there
is something to take back; None means nothing was registered.

TESTS extended, not rebuilt (gate): 4 cases added to
test_pinned_post_registry_550.py, the sgl-project#548/sgl-project#550 characterization file --
the poisoned state, the sgl-project#386 no-masking property, a success-path guard so the
fix cannot pass by never registering, and the same window in read_buffer_pool.

CAN-FAIL, three mutations, each redding ONLY its own case:
  cleanup made a no-op            -> test_a_failed_pinned_image_leaves_no_post
  error re-wrapped in a new one   -> test_the_real_error_is_not_masked
  ring cleanup disabled           -> test_a_failed_read_buffer_ring_leaves_no_post

unit/mem_cache 1148 passed / 0 failed. unit/model_executor 15 failed / 660
passed, IDENTICAL to the pre-slice commit fac99d6 measured in a pristine
worktree -- those 15 are pre-existing and this slice adds none.

FEATURE_CATALOG gains the window, the two fixes and the six open sites by
file:line, so the next producer written does not repeat it.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…oject#550's audit

The comment on the credit-back said it was sound "because registration FOLLOWS
allocation for every producer of a post". That is FALSE, and it was a
misreading of weights_arena on my part: `_register_image_post` declares the post
BEFORE `_alloc_host_image` allocates (:458 vs :476), deliberately, so the
registry can refuse an over-commitment at the DECLARATION rather than discover
it at the allocation.

The fix itself stands; only its stated justification was wrong, and a future
reader would have verified the wrong property. What actually makes the credit
sound is weaker and sufficient: by the time a LATER post is weighed, the EARLIER
posts' allocations have COMPLETED, so their bytes are already absent from
`available` -- which is what was measured (MemAvailable 33.62 GB while the
schedulers held 86.51 GB resident on a 126.75 GB box).

The real hazard is a post registered whose allocation NEVER happens: credited
back without ever being resident, so the next admission is charged too little
and the registry waves through the over-commitment it exists to refuse. sgl-project#550
found that window independently and closed it (`_unregister_image_post` on the
raising path). The comment now names that as the standing obligation on any
future producer that can leave a post registered with nothing behind it.

TESTS  23 passed + 3 subtests across the sgl-project#706 double-count, sgl-project#550 registry,
sgl-project#630 rendezvous and guard suites together -- the two fixes compose.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…t is a build

Ordered step (1) says read the refusal's reason before touching it. Read,
with blame: the answer is a third option, neither of the two the brief
anticipated.

NOT a sgl-project#718-class safety guard. git blame puts it in 05933d0
(2026-07-13), the flag's OWN introducing commit, listed among ordinary
validations ("hierarchical/unified radix tree rejected") with no measured
failure behind it.

NOT merely never-composed either. The unified mamba component contains no
reference to mamba_checkpoint_interval, is_on_interval or
mamba_track_interval, while MambaRadixCache consults the grid in six
places. So composing the flags today would corrupt nothing and would
leave --mamba-checkpoint-interval SILENTLY IGNORED while its help
promises deterministic absolute-multiple positions. That is the sgl-project#742
class exactly -- and lifting the guard would replace an honest refusal
with a dishonest acceptance, which is worse than leaving it.

The stated reason is also aimed at the wrong class: it blames
HiMambaRadixCache, which per NOTE_745 has no construction site
(registry.py:107-112 routes hybrid-SSM + hicache to the unified tree).
Second time that aiming error has surfaced in this area.

Scoped instead of forced: the lift is a mirror of the grid at five seams
of the unified component (match validator/finalize, commit_insert,
prepare_for_caching, split redistribute, evict/drive_eviction), each
named with the mamba_radix_cache.py line it mirrors.

The eviction seam is the subtle one and it gets EASIER under the unified
tree. With the interval set, MambaRadixCache spares the deepest anchors
per path because "losing the deepest one silently moves the resume point
of identical requests and re-introduces run-to-run drift"
(mamba_radix_cache.py:1092-1097) -- a determinism contract that exists
because a spilled anchor is a DEAD anchor on a device-only pool. With a
host tier an evicted anchor is still a valid match and loads back
(mamba_component.py:71-74, :139-144), so the protection window can be
weaker here, not stronger. That is exactly the directive's goal: 8k
deterministic anchors that survive on disk.

Recommended shape recorded for when it is built: cadence 8192 (16 x
chunked_prefill_size), anchors host-tier-eligible with no separate pin
class, red-first with a hermetic construction smoke plus an
anchor-reaches-host-tier test, and the refusal deleted only in the same
commit that makes the grid effective.

Method precedent: sgl-project#547 -> sgl-project#550, reading a describing-not-reasoning
refusal against the tree to tell impossibility from unbuilt.

Docs only; nothing boot-verified. Post-boot branch, not for the closing
train.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 22, 2026
…edger

THE PREFLIGHT COULD NOT SEE THE LARGEST PINNED HOST CONSUMER ON THIS RIG. The
launcher-side joint pinned-host check (sgl-project#550/sgl-project#729) exists, but it is reached
only inside the --enable-kv-session-offload x hierarchical-cache branch of
ServerArgs validation, and only when the spill pool is non-zero. A boot without
kv-session-offload prices no host tier at parse time at all. On top of that the
default sizing is --hicache-ratio, which hicache_configured_host_bytes
correctly declines to price before the device pool exists. So the standing
boot's 22.01 GB of MHATokenToKVPoolHost across three PP ranks reached the
preflight as nothing.

Under --hicache-host-role staging both obstacles are gone: --hicache-size is
mandatory and absolute, so the number is exact at parse time. Declaring it is
what turns a smaller tier into headroom somebody has summed, rather than into a
figure that first appears in a boot log after the RAM is already gone.

MULTIPLIED BY THE RANKS, deliberately. --hicache-size sizes ONE rank's tier and
every scheduler process allocates its own (sync_fixed_hicache_size syncs the
token COUNT to the group minimum; each rank still allocates its own per-rank
buffer for that count). The joint check is about this machine's RAM, which all
ranks share, so the group product is the honest demand. NOTE for the next
reader, and left uncorrected on purpose: the pre-existing check in the
kv-session-offload branch passes a SINGLE tier's bytes and therefore
under-counts a multi-rank boot by the rank factor -- three on this rig.
Correcting it would change what a RETENTION boot accepts, and this role's
contract is that retention stays byte-identical. It belongs to sgl-project#729/sgl-project#550.

PRICED, NOT REGISTERED. joint_pinned_host_error is a pure function. The runtime
registry in pinned_host_budget is PROCESS-LOCAL and the pools are allocated in
the worker processes, where HostKVCache registers them already; a
register_pinned_post here would create a post in the launcher for bytes the
launcher never pins.

The check degrades to no guard when pinned_host_memory_bytes() has no honest
figure, per that module's own rule: refusing a boot on a fabricated number is
worse than not checking.

Default unchanged: _handle_hicache_host_role returns before any of this under
retention, so no launch that does not name the role is priced, refused, or
logged differently. The diff is purely additive.

Tests: test/registered/unit/server_args/test_hicache_staging_host_ledger_810.py,
8 cases, hermetic (CUDA_VISIBLE_DEVICES=""), with the host-memory reading
injected -- a guard whose verdict depends on how much RAM the box happens to
have free is not a test of the guard. Both directions: a tier that fits is
accepted and one that cannot is refused; the rank product is shown by a size
that fits once and not three times, for PP and for TP separately; the spill
pool is shown to be summed with it; the no-honest-number path is shown not to
refuse; and the retention default is shown to price nothing even at a size that
could not possibly fit.

Mutants, 5, all confirmed dying:
  ledger call removed                -> 4 failed
  no rank multiplication             -> 2 failed
  spill pool left out of the sum     -> 1 failed
  refusal removed                    -> 4 failed
  ranks counted from pp only         -> 1 failed
Source green again at 8 passed. 16b's 9 role cases stay green unchanged.

SUITE DIFF FOR ALL THREE sgl-project#810 COMMITS, EMPTY:
test/registered/unit/{mem_cache,distributed,server_args} on a clean detached
checkout of 66cf0f6 is 103 failed / 5217 passed / 1663 skipped / 1632
subtests; with these three commits it is 103 failed / 5271 passed / 1663
skipped / 1632 subtests. 5271 - 5217 = 54 = exactly the 33 + 13 + 8 new cases.
The 100 failure ids compare byte-identical between the two runs, so no
pre-existing test changes status. ruff/black/codespell clean on every new file
and on every hunk touched in the modified ones.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 22, 2026
…ost nothing allocates

`fits_pinned_host_budget()` had no caller and no test anywhere in the tree --
not even in its own module's test file, which imports the other eight names and
not this one. That alone would make it dead code. What makes it worth a commit
rather than a deletion in passing is its SIDE EFFECT: it called
`check_and_register_pinned_post`, i.e. it registered a sgl-project#729 post in the PLANNER
process.

THAT REGISTRY IS FOR PROCESSES THAT ALLOCATE. It exists to make the second
allocation in a process see the first, and it credits earlier posts back
against live availability -- `available + already_allocated` -- on the stated
precondition that those posts' bytes are ALREADY RESIDENT and therefore already
missing from `available` (pinned_host_budget.py, "the already-allocated posts
must be credited back", measured 2026-08-17). A planner allocates nothing, so
this post is exactly what the same comment goes on to name as "the real
hazard": registered and then never allocated, hence credited back without ever
having been resident, so the NEXT admission is charged too little and the
registry waves through the over-commitment it exists to refuse. sgl-project#550 closed
that window for the image posts with `_unregister_image_post`; the same comment
adds "a future producer that can leave a post registered with no allocation
behind it must do the same". This helper was that producer and did not.

Unreached today, so nothing is broken today. It is removed rather than left
because the whole cost of the defect is paid by whoever wires it -- and a
helper named "fits the budget" is exactly what a future caller reaches for.

NOT REPLACED BY A PURE VERSION, and the reason is that the question already has
a better answer elsewhere. `ServerArgs._post_hicache_staging_host_ledger`
prices the staging tier through `joint_pinned_host_error` without registering
anything, jointly with the spill pool, and by the RANK PRODUCT -- every rank
allocates its own tier, so the per-rank figure this helper used under-counts a
multi-rank boot by the rank factor, three on this rig. Keeping a second,
per-rank, planner-side reading of the same question would be two readings free
to drift, which is the shape refused in the sibling commit for the file-tier
watermark. The module docstring now says where the question is answered and
what a planner-side pre-check would have to be (pure, rank-aware) if one is
ever wanted.

Tests: two cases added to
test/registered/unit/planner/test_hicache_staging_810.py, hermetic
(CUDA_VISIBLE_DEVICES=""). The property is pinned BEHAVIOURALLY rather than by
absence: the full derivation path is exercised and `registered_posts()` is
asserted empty afterwards, so a re-added registering helper fails even if it is
spelled differently; the second case pins the removed name itself and points a
future reader at the replacement.

Mutants, 2, both confirmed dying:
  the removed helper is put back (verbatim pre-removal source) -> 1 failed
  the derivation itself registers a post                       -> 1 failed
This is the red-first evidence for a deletion: the first mutant IS the old
code, and the new guard fails on it.

Suite diff empty: test/registered/unit/planner/ is 2889 passed / 1 failed
before (16b's recorded figure, the failure being the pre-existing
test_rejected_evidence_pins.py sgl-project#797 case) and 2891 passed / 1 failed after =
2889 + the 2 new cases, same single failure id. ruff/black/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.

2 participants