Skip to content

Fix Incorrect CURL Request Example in README - #287

Merged
merrymercy merged 6 commits into
sgl-project:mainfrom
amirarsalan90:main
Mar 13, 2024
Merged

merrymercy merged 6 commits into
sgl-project:mainfrom
amirarsalan90:main

Conversation

@amirarsalan90

Copy link
Copy Markdown
Contributor

The CURL request in readme for Triton example had a minor issue, apologies for the mistake. this minor change fixes that.

@merrymercy
merrymercy merged commit 745ea00 into sgl-project:main Mar 13, 2024
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
vschandramourya pushed a commit to vschandramourya/sglang that referenced this pull request Feb 3, 2026
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
EdwardXuy pushed a commit to shun8686/sglang that referenced this pull request Apr 8, 2026
Add For checkpoint decryption testcases
efschu added a commit to efschu/htsglang that referenced this pull request Jul 29, 2026
…oject#287): kv_pressure_ladder.py — LadderStep/PressureLadder (Typen base|relief|geometry_flip|external, Herkunfts-Label je Eintrag, Sanity im Konstruktor), KvPressureSensor (Wasserstand + projizierte Erschoepfung per LSQ-Trend, Flip- und Pre-Stage-Verdikt), on_pressure_boundary-No-Op-Planer (Phasen none|pre_stage|abort_stage|flip|descend); 6 Invarianten im Code erzwungen (relief-vor-geometry doppelt, Capture-Guard fuer Flip UND Pre-Stage, keine unkapturierte Zielsprosse, Prio-Schutz, lange external-Hysterese, Monotonie-Sanity); Uebergabestrategien inkl. anticipatory_shadow als NotImplemented-Stubs mit Messfragen; planner/kv_ladder_table.py baut Stufen-Tabelle vorab via key_solver.nesting_hull (nicht nestend = harter Fehler), injizierbare capacity/gain/cost-Fns, ehrliche Platzhalter-Labels; Konfliktfreiheit mit on_admission_boundary getestet (disjunkt, Kollision loest deterministisch auf admission); 112 neue Tests, Bestand 410 + planner 1644 gruen, server_args/offload_register rein additiv
efschu added a commit to efschu/htsglang that referenced this pull request Jul 30, 2026
…nning-requests-ceiling sizes pools/mamba-slots/capture set at the ceiling while admission floats below (start value = old flag); rank-uniform pressure sensor from replicated quantities only (avoids uneven-DCP admission divergence -> collective desync); two-tier throttle-before-retract (water-mark early + hard throttle before retract_decode, freed slots not re-admitted into next victim); per-lane via ContextVar following sgl-project#274 C1 overlay idiom; 77 new tests, 372-file sweep failure-set identical to base
efschu added a commit to efschu/htsglang that referenced this pull request Jul 30, 2026
…ish case names with cold JIT (translation card-validated); sgl-project#287 ceiling proven at 4/16 (8/64 unbootable on this rig — ceiling sizes mamba pool, 3080 short 559 MiB at 64: real coupling finding, own task): admission floats, 17 rejected without silent clamping, pressure scenario throttle PREVENTED retract entirely (count 0/0 — stronger than the programmed line-order check), no-flag regression identical; solo-placement pair NOT started (own window next); new independent bug: /v1/loads 500 AttributeError _IncludedRouter.path

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…was an ARITHMETIC bug, not pool-per-ceiling in general — fit_cap clamped against the full post-weights budget while the 1 GiB prefill-activation reserve was subtracted after it (explains the similar 407/559 MiB shortfalls); fix: fitted ceiling — pool auto-fits to the mamba side of the split only when the token pool would drop below 256 MiB, working boots keep pools slot-for-slot, admission floats below the fitted ceiling rank-uniformly via existing min-reduce; Fenster-3 constellation: ceiling 64 -> effective 14 with 3.4-5.8 GiB KV left; lazy slots rejected (RAM tier empty exactly when ceiling exercised + va_stable graphs), per-rank ceiling rejected (request count lives on every rank, degenerates to fitted ceiling); 21 new tests incl. falsifier of the negative arithmetic + desync test, 77 sgl-project#287 tests unchanged; GPU proof program s307 written; flagged: wizard has no ceiling support yet
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…esis premise is factually wrong — the sm86 NVFP4 path is NOT a slow 16-bit detour but gptq_marlin with in-kernel E2M1 dequant at 0.93-0.96x the card's own dense bf16 (the 3080s' best lane family); asymmetry is one-sided-up on the 5090 only (W4A4 native fp4 phi0 1.3-2.0 unmeasured; W4A16 is a 5090 PESSIMISATION at 0.38x); compute-tipping thesis ceiling 3.6% of the prefill window vs the 3.18% floor — does not pay; the REAL payoff is the VRAM/decode axis, symmetric: decode modelled -27% (7.43 vs 10.93 ms/token anchor), -7736 MiB, context 1.57x, and all-Linear-NVFP4 (V4) is the first format fitting solo on the 5090 with a real KV pool — deleting the 64-80% collective floor and enabling the weightless lane; checkpoint scissors: V4 is the only good variant and hard-refuses sm86 (min_capability 100, no fallback) -> sgl-project#291-S3 promoted to highest-value; two latent bugs found (ModelOptFp4Config exposes no weight_block_size = uneven-TP coarsening dead, FIFTH alignment-family member; expert-offload installs on NVFP4 MoE with no half, sgl-project#268 guard is an exclusion list) plus fp4_utils auto never selects the fork's sm120a JIT kernel; sgl-project#287 prerequisite named: rank_gemm_scores must widen to per-(rank,family) — cheaper before sgl-project#287 than after; recommendation: phi0 lane microbench XS with stop rule <1.33, VRAM/decode case stands regardless
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…amily) axis over mlp/attn_gdn/vocab/moe in the score derivation — families filled ONLY from genuine per-module declarations (ModelOpt MIXED_PRECISION quantized_layers, CT >1 config_groups), a family matching the checkpoint-wide format gets no own vector so mixed never lies; new lane keys nvfp4_native/nvfp4_marlin + format keys nvfp4_a4/a16, dispatch order only, no probes, NO PROFILE_VERSION bump; exactly one production caller existed and was switched, non-MIXED checkpoints bit-for-bit unchanged (pinned against #298a fixtures); side fix: hf_quant_config.json read when config.json lacks the quant block; per-family prefill-time arithmetic DELIBERATELY deferred to sgl-project#287 (sum(p)/r vs sum(p/r) differ in last bits — would break the byte-identity promise); 28 tests/30 subtests, planner+spec 1919 green; finding: the on-disk Qwen3.6-27B-NVFP4 is CT single-group W4A4 (nvfp4_a4, no family split), the genuine MIXED V1 is not on this box (mocks + config shapes)

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…fable per user approval): staircase axes rung x phase x depth-bin (0.05-1.0, 'auch dazwischen') x format; relief order re-pinned per sgl-project#320 (dcp_ratio < admission_cap < kv_spill < weightless_rank < session_offload); solve_operating_grid solves the KV vector per bin as argmin of lockstep time under fit constraint — format factors exclusively from the sgl-project#324 per-(rank,family) scores, missing inputs named not guessed; STAGE-1 LIMITS HONEST: admission_cap + session_offload are wired actuators, dcp_ratio/kv_spill/weightless_rank are PLANNED-ONLY (physical KV move = sgl-project#297), named in boot inventory and every flip line; rank uniformity: replicated inputs only, commits only at consensus boundaries with UNCONDITIONAL cadence, one MIN-reduction of [v,-v] pairs via the sgl-project#312 bounded_collective, min!=max raises the same loud KvLadderError on all ranks; desync falsifier green (poisoned rank -> all three fail loudly, nobody hangs, nobody commits); graph decision: stage-1 rungs mutate CPU scheduler state outside capture paths, geometry rungs get graph sets later; per-family sum(p/r) arithmetic gated on gemm.mixed — single-scheme checkpoints bit-for-bit unchanged (closed-form pin); 38 new tests, planner 1722 green; CARD PASS: flips 0->1->2 rank-uniform with 0 desync, exactly one retract then prevented, descend + release uniform, negative control byte-identical (first 'differs' was a comparison calibration error, corrected)

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…e per approval): lane_pairing.py — grain = one forward, saturation = GEMM rows vs calibratable threshold (default 64; roofline ~117 bf16 / ~26 Q3_K), serving extend tokens / lane dominance rule; ShareMeter deliberately NOT an automatic input (occ=duty!=SM width + self-conditioning ban) but per-window calibration evidence; policy = work-conserving reorder at job pick with 500 ms starvation cap, all-saturating -> FIFO never serialize (C3 1.130>0.974); COLLECTIVE-RELEVANT: NO with evidence (lanes only on shared rank, no communicator, batch read-only — no sgl-project#287 consensus needed); GIL: zero Python between lane forwards; policy-off byte-identical FIFO pinned on 200 random queues; two card-found defects fixed in-window (signal aging during 1.1 s prefills, job dominance); boot 3 policy ENGAGES (occ_r 0.761->0.864, both class rates up) but in-boot E gain honestly NOT reported (n=1 vs off-spread 1.19-1.44, under proof threshold — more windows per arm = next posten); sgl-project#328-1 DELIVERED: r8-E remeasured on corrected window = 1.441/1.534 (r8 said 1.035/1.140) — the sgl-project#284 submission gap VANISHED on cc52280, loss now purely sm_competition (occ_r ~1.0, cost_r 2.01/1.71), carrying merge unmeasured -> bisect-shaped posten; chain gain concurrent +6.5% (direction of r8 +10.2% reproduced); 28 new tests, 277 sweep green

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…KV resharding at phase boundaries — two-phase PACK -> NCCL batch_isend_irecv with per-pair checksums -> layerwise gather-before-scatter WRITE -> cutover; pool untouched until checksums pass (transport error = clean abort, retry legal; only write phase is fatal-loud); core simplification: the physical row is a PURE FUNCTION of slot id + vector, so req_to_token/radix/allocator need NO metadata rebuild; graph decision: fitted ceiling over the declared vector set (--kv-reshard-vectors) gives stable addresses and NO re-capture (replay metadata rebuilt host-side from refreshed backend bounds), VMM growth is the named follow-up; ownership transition matrix with every reader named, cutover refreshes every backend instance via WeakSet registry + hicache memo invalidation; sgl-project#287-pattern consensus with (armed,ready,epoch,vector) MIN-reduction, desync falsifier green (poisoned rank: all loud, nobody hangs, zero bytes moved); MEASURED: 7,3,3 -> 2,11,10 in 63.5 ms (53 ms NCCL warmup) and back in 9.9 ms — the <1 s target beaten 15-100x; rows mirrored exactly, checksums equal, multi-turn coherent, negative control byte-identical, rerun-text gate honestly falsified via A/A (stock path diverges without the move — move exonerated); two card finds fixed (idle loop never reached a consensus boundary; gloo P2P works are unpollable — sgl-project#312 caught it as a loud 120 s CollectiveTimeout on all ranks, exchange now NCCL-device-native); ladder wired: dcp_ratio flip ARMS the move, POST /kv_reshard; open: stage B, C-raise (the 6.18x sgl-project#320 gain needs growing max_total_num_tokens), kv 7,3,3 no-flag OOM footnote; 19/19 hermetic tests

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…s job (sgl-project#339, #344a)

The second half of the §8 directive. The preview taps are still open; this
is client liveness.

A client that closes was already handled -- Starlette throws into the
response generator and its finally tears the job down. The case that was
not handled is the client that neither closes nor reads: the socket stays
open, the TCP window stays full, the sink coroutine never returns, and
back-pressure working exactly as designed holds a decoder, an encoder, the
engines and the reservation for a viewer who left. From the server's side
that is indistinguishable from a very slow viewer, so the duration is the
policy and it is configured rather than constant.

Progress means bytes the transport accepted, not bytes the chain produced.
A stalled client makes the chain stop producing, so 'the pipeline is idle'
is a consequence of the stall and cannot be its evidence; the watchdog is
stamped after the yield returns, which is the one moment in the process
that proves the peer is still there.

Per endpoint class, because the right number differs by an order of
magnitude: a paused player is normal and reclaiming its job would be worse
than holding it, while a preview tap that has accepted nothing for ten
seconds has no viewer. Defaults 300 s / 15 s / 60 s, parseable as
'video_stream=120,preview_tap=5', non-positive disables detection for that
class, and GET /v1/video/liveness reports the resolved policy.

Two things the end-to-end test found that reading would not have:

  * A suspended generator never reaches its own finally. The stage teardown
    that runs there on a normal or a cancelled stream does not run for a
    client that simply stopped calling __anext__, so the release path closes
    the stages itself. Without that the decoder and encoder sessions survive
    the job.

  * executor.cancel() does not unblock a stalled pipeline. A stage blocked
    in ring.put on a full ring only sees the flag after that await returns,
    and on a stalled pipeline nothing is draining. The release closes the
    rings, which is what wakes every blocked producer -- the same thing the
    DELETE endpoint already did, now done in both places.

Teardown is bounded and escalates to a cancel: a release that will not
finish must not leave the reservation held by a job nobody is watching.

Not built, and listed as open: during the grace window the resources stay
where they are rather than joining the reclamation ladder (sgl-project#341, sgl-project#287).

22 tests, all CPU. The demonstration drives the real service and the real
executor: a consumer takes one chunk and then stops, with no close and no
further read, and within the configured timeout the executor is cancelled,
every stage is closed, and the decoder -- willing to produce 100000 frames
-- is stopped within one ring's worth of where it had reached. 314 tests in
the package pass.
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…four fixes, one registered open finding

Card window 2026-07-31 12:40-13:21 UTC, TP=3 Qwen3.6-27B-FP8 uneven
(7,3,3), --kv-reshard-vectors 2,11,10 --enable-vram-dial. Fitted C=251965,
boot plan caps {7,3,3: 522197; 2,11,10: 251965} (the sgl-project#320 431k/6.18x
prognosis belongs to a different reserve configuration; on this boot the
capacity winner is the boot vector -- direction is config-dependent, the
mechanism symmetric).

Proof (a) budget dial, live on a 3080: release_mib=3584 -> SHRINK commit
122.9 ms, 3292 MiB REALLY returned to the driver (nvidia-smi 19249->15957
on that card), a foreign process cudaMalloc'd 3.5 GiB of it while serving
continued; same-prompt probe byte-identical, zero graph re-captures;
dial-up restored C exactly (GROW 2.5-8.8 ms). Ledger entry
(srt-30030:rank1) follows the budget.

Proof (b) reshard interplay + C re-raise: fit guard held loudly with exact
numbers, the runtime pre-provisioned rank 1 (58794->119702 rows, 9.2 ms)
automatically, the reshard committed, and the post-cutover re-raise fired
in the same boundary window (250263->251965, 0.5-2.5 ms). Big growth after
one headroom grant: 251965->341861 (1.357x) in 8.3 ms, +1560 MiB
physically mapped on the 5090, then 260268 prompt tokens over 12 sessions
served with correct long-context recall, no OOM.

Proof (c) negative control: budget 15000 MiB below floor 15701 -> HTTP 400
naming floor/request/min-viable exactly, nothing changed.

Fixed from card findings: card-level NVML floor measurement (scheduler
thread has no current device; LXC pid namespace shifts NVML pids);
object.__setattr__ for frozen scheduler components; op_seq gate -- no
growth before the first operator dial (chunk-rounding slack otherwise
funded a spontaneous grow past the fitted ceiling and blocked declared
resharding); effective-ceiling clamp never below floor+backing (it
falsified the ledger and blocked the pre-provision escape under a
small-ratio vector).

Registered OPEN finding: 10x30k concurrent sessions after growth (held
~0.88 of grown C) hit a store_kvcache index<size_limit device assert on a
2-kv-head rank; bounds passed are live and row/draft arithmetic is
covered, implicating a path first touched when allocation reaches ids
above the boot ceiling. Dedicated debug window required; until then
dial within the boot ceiling is fully validated, growth beyond carries
this known limit (DESIGN_330 9b, INTEGRATION_R3_VALIDATION sgl-project#330).

Hermetic: 26 dial tests + sgl-project#297/sgl-project#287 suites = 63 passed. Runbook 4.1.2 and
DESIGN_330 updated in the same change.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 1, 2026
…split sensing, stage tuple subsumes the sgl-project#287 commit path; classifier built observe-only with F0/F1 green (sgl-project#363 phase 1)
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
…ignals

sgl-project#388 made the share signals near-binary at window_rounds=64 -- a window is
essentially all-prefill or all-decode -- so a pointwise A-vs-A band on them
is 1 whenever the two boots' bursts land on different boundary indices, which
they must: the same workload produced 41 active boundaries in one arm and 56
in the other. The gate-3 re-record came back ARMS_DISSIMILAR on all five
signals. The alignment was designed against traces in which the shares barely
moved; the fix that made them move invalidated the statistic chosen for them.
This has blocked three windows.

The statistic is now chosen PER SIGNAL against one criterion -- is the value
at a given active boundary reproducible across boots, or only its rate?

  prefill_share, decode_share, occupancy, queued_prompt_tokens
      distributional. Per-run summaries and band = |summary_a - summary_b|:
      peak (what reachability reads, and the signal-level band), the duty
      cycle at each constant's own value, p50/p75/p90 for shape. A constant
      clears when mean(duty_a, duty_b) > 2 x |duty_a - duty_b| -- the direct
      form of the question the gate asks, "would this signal cross the
      threshold consistently across boots?".
  rank_ms_spread_pct
      pointwise, kept. A within-boundary ratio across ranks, continuous, not
      a burst counter. Not blanket-replaced.

Both guards survive. UNDERPOWERED is unchanged in meaning. ARMS_DISSIMILAR
keeps the within-arm rule on the pointwise path and gains a distributional
form: the two runs' duty cycles, at the constants' own thresholds, differing
by more than a two-proportion difference of 2.576 standard errors. Evaluated
at those thresholds and nowhere else -- a sup-over-all-thresholds (KS) form
calls two steady arms at slightly different levels totally separated, and
that offset is a real reproducible bias that IS the band.

Also: rank_ms_spread_pct is now restricted to ACTIVE boundaries like the rest.
It goes stale rather than absent through an idle stretch, which sgl-project#388 recorded
as an omission rather than a claim the signal was clean. Its pointwise band on
the sgl-project#388 pair drops 0.6815 (the full observed range, ARMS_DISSIMILAR) -> 0.5813
against a within-arm swing of 0.675.

FALSIFIER (bands.py --falsify, three cases, each can fail):
  (i)   same duty cycle 10/40, bursts shifted 0-9 -> 20-29:
        OLD pointwise band 1.0 ARMS_DISSIMILAR (the false alarm of record,
        reproduced against the path that is still live for rank_ms_spread_pct)
        NEW band 0, duty 0.25 vs 0.25, OK, enter_prefill CLEARS
  (ii)  genuinely different duty cycles 10/40 vs 30/40:
        NEW duty 0.25 vs 0.75, z=4.47 > 2.576, ARMS_DISSIMILAR -- guard survives
  (iii) barely-moving signal, flat 0.50 vs 0.53:
        OLD band 0.03 OK; NEW band 0.03 OK -- regression pin

RE-ANALYSIS of all four archived arms, desk only, no cards
(2026-08-01_363_gate3_{a,b} and _363_gate3_388_{a,b}, reports written to
bands-report-distributional.{txt,json} in each arm-A directory):

  constant                       pre-388 old  pre-388 new  post-388 old  post-388 new
  enter_prefill                  UNREACHED    UNREACHED    ARMS_DISSIM   CLEARS
  enter_decode                   CLEARS       CLEARS       ARMS_DISSIM   CLEARS
  kv_ascend_mark                 UNREACHED    UNREACHED    UNREACHED     UNREACHED
  spread_veto_pct                UNREACHED    UNREACHED    UNREACHED     UNREACHED
  PRESTAGE_SINGLE_PROMPT_TOKENS  NO_GAP       CLEARS       ARMS_DISSIM   CLEARS

The pre-sgl-project#388 pair's blocking list is UNCHANGED (the regression pin on real
data: that pair is the barely-moving regime the pointwise statistic was built
for). The post-sgl-project#388 pair's blocking list goes 5 -> 2, and both survivors are
reachability findings already on the record. Identical on all three per-rank
files. Gate 3 still NOT PASSED: kv_ascend_mark 0.85 vs 0.1649 peak occupancy
(sgl-project#287's mark, information only) and spread_veto_pct 25 vs 0.68 peak.

NO THRESHOLD CONSTANT CHANGED. spread_veto_pct=25 against an observed range of
0.0018..0.679 (sgl-project#388 pair) and 0.0027..0.614 (pre-sgl-project#388 pair) is recorded, not
re-tuned -- calibration is a separate decision with its own evidence rules.
The two passing distributional verdicts are thin and reported as such:
enter_prefill clears by 1.29x, PRESTAGE by 1.14x. A duty cycle from 41 active
windows has a standard error near 0.07, which is most of what had to be
cleared; the fix is a busier workload, not a constant.

TESTS
  bands.py --smoke        SMOKE OK
  bands.py --falsify      FALSIFIER OK
  pytest test/registered/unit/managers/test_regime_bands.py
         test/registered/unit/managers/test_regime_gate_tools.py
                          47 passed
  pytest test/registered/unit/managers/
                          426 passed, 11 failed, 18 skipped -- all 11 failures
                          pre-existing on the base commit (test_prefill_adder 7,
                          test_rank_prefill_log 1, test_scheduler_chunked_req_gate 3),
                          verified by re-running those three files with this
                          change removed: same 11.
  ruff check / format     clean
  codespell               clean
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
…and a five-cut list

Desk analysis only, no build, as scoped. docs/dev/ANALYSE_553_elastic_coresidence.md.

What the four named building blocks actually are, read from the code rather
than from their titles:

- sgl-project#330 VRAM dial: a REAL mechanism, and its decisive property for sgl-project#553 is that
  store_bound_rows is a LIFETIME bound baked into captured graphs. So the dial
  has a FREE BAND (shrink to any floor, re-grow to the boot bound) and a HARD
  WALL above it. The free band is exactly where CUDA-graph compatibility is
  preserved.
- sgl-project#364 GDN slot ladder: a real, executing hot/cold mover, and graph-neutral by
  construction (it moves state between slots, not geometry). It is the
  existence proof that a hot/cold event need not touch capture, and its
  inventory seam -- the owner enumerates its live set, consumers never read a
  container directly -- is the pattern the other consumers need (sgl-project#551).
- sgl-project#287 KV pressure ladder: PLANNER ONLY. Seventeen NotImplementedError sites;
  the docstring says so plainly. But the ordering invariants are already
  enforced in code and the relief rungs reference existing features BY NAME, so
  the relief half can be made to execute by delegation without new mechanism.
- sgl-project#286 register: the right vocabulary, but exactly one ledger exists and it is
  wired to the translator. There is no generic tenant to raise an event
  against.

The pattern across the event table: both directions are largely built, and
what is missing is ARBITRATION. Two registries exist (dial participants, sgl-project#286
asset classes) and neither can see the other, so "free 4 GiB for the video
tenant" has no addressee.

Cut list, ordered so each cut is provable alone and no cut before the last
touches capture: (1) one registry or an explicit bridge; (2) a generic tenant
mover factored out of AudioAssetLedger; (3) make sgl-project#287's RELIEF rungs execute by
delegation -- the largest block of stubs, and it never approaches the graph
wall because relief rungs are declared "no KV layout change"; (4) the
arbitration policy on top; (5) LAST and only with the rig, cross the graph wall
via the per-rung pre-captured graphs sgl-project#287 already specifies, with cold rungs
parked as register class graph_rungs.

Graph compatibility is treated as the target state throughout, per directive:
every cut states its effect on graph state, and cut 5 carries the explicit
route back to full coverage. Until cut 5 lands, sgl-project#553 must state its band --
"elastic within the boot capture bound" -- rather than implying unlimited
elasticity.

Instrumentation named honestly: SGLANG_KVSO_TICK_TRACE=1 (throttled per-session
regulator trace: effective interval, measured tick_cost, binding headroom
ratio, host-tail size; pure logging, no control effect). The analysis states
what it is NOT -- a regulator trace, not a per-phase breakdown of device time --
and proposes no measurement it has not checked exists.

One decision deliberately left open and named as such: whether sgl-project#553 owns the
arbitration policy or whether it belongs to sgl-project#363. That fork needs the sgl-project#363
stage feed bound first, since an arbitration policy fed by a table holding one
stage would have nothing to choose between -- the same failure sgl-project#363/S8
documents one level up.

codespell: clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
Seventh addendum, and the first requirement here carrying a MEASURED cost
rather than a hypothetical one: production showed all three ranks waiting 1.2 s+
on a 74k-cached prefill, with collective wait running 2-3x compute.

R12 is R6 applied to the one vector still frozen at boot.

(a) At LOW occupancy the planner selects the PERFORMANCE-optimal vector -- KV
concentrated so DCP prefix-gathers are minimal. Not a micro-optimisation: the
gather share grows with cached context, so at low fill the spread vector buys
capacity nobody is using and pays for it in a collective floor on every
prefill. sgl-project#588 decomposes the measurement; R12 is what the planner does with it.

(b) The shift is CONTINUOUS and BIDIRECTIONAL. This generalises sgl-project#287's pressure
ladder, and the generalisation IS the removal of its trigger-on-pressure-only
design: a ladder that fires only when memory gets tight can never take the
low-fill performance win, because low fill is not a pressure event. Refusing
the return leg is the "surplus sits idle" failure in vector form -- capacity
released, but the performance it was blocking never reclaimed.

(c) Carriers verified in tree: sgl-project#287 ladder stages; sgl-project#297 phase-boundary KV
resharding, delta move measured <1 s (DESIGN_297_kv_resharding.md:83, and the
TEIL_HOT rung in registry/rungs.py prices it "<1 s, one dial re-raise");
sgl-project#363/sgl-project#578 regime controller as actuator now that slice 0 binds its feed.
Priced movement-bound under R11's gates, and R11e is exactly the comparison
that matters here: a sub-second reshard removing a 1.2 s per-prefill floor pays
for itself in two prefills.

F12a (near-empty + long prefix -> concentrated, gather share must drop), F12b
(past the capacity knee -> spread), F12c (on drain -> move BACK). F12c is the
one a pressure-only design fails while passing F12b, which is why the falsifier
is again a pair, as with F4 and F7.

Slice plan gains 4e (both legs; hermetic F12a/b/c, GPU gate is the gather-share
drop under sgl-project#588).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 10, 2026
… watermarks

Spec item 15 (added 2026-08-10 20:48Z) rejects static pool ladders and
puts residency under a runtime pressure controller. Its first build
requirement is the one existing machinery does not satisfy:

  "SPILL-VOR-ALLOC -- Pruefung an der Allokation (frei-X >= 1024 sonst
   erst synchron spillen), nicht reaktive Schwellen-Beobachtung"

KvPressureRuntime (sgl-project#287) already drives a spill ladder and already takes
a spill_fn, but it observes at a ROUND BOUNDARY and reacts. The corridor
law is a CONTINUOUS minimum -- it is broken by the trough, not the
average -- so an allocation between two boundaries can breach it and a
100 ms sampler will record a dip the controller never saw. And the
allocation that most needs guarding does not happen on a round boundary
at all: it is the seam's commit_range, inside the flip's no-return
region, which has already killed this instance once.

CorridorGuard is therefore a gate AT THE CALL SITE:
  - arms on `free - want < floor`, i.e. against the allocation that is
    about to happen, not against the current reading
  - frees to `floor + delta` (item 15b), because freeing exactly to the
    floor guarantees the next allocation spills again -- that is
    thrashing, and the spill/restore pair costs more than the
    allocation it enabled
  - spends providers CHEAPEST FIRST, which is the reclaim-ordering law
  - re-probes the DRIVER after every provider instead of trusting its
    return value: a provider that hands bytes to torch's cache has
    freed nothing NVML can see, and this chain has already credited
    such a release once
  - REFUSES when providers are exhausted. Allocating anyway would
    launder a corridor breach as a check that passed; at the seam the
    caller's refusal path already exists and abandons unanimously.

Item 15c ("all resident is hot -> kvso keeps computing over the host
tier, the price is tempo, never a corridor breach") is expressed as the
most expensive provider rather than a special case, so the gate reaches
it only after the cheap payloads are spent and still never breaches.

draft_carrier_provider adapts rung 2's carrier as the natural first
registration. Not yet wired into a production allocation site -- the
wiring wants its own commit and its own metal supervision.

Tests: 14, hermetic with an injected probe. They pin the
allocation-relative check (a guard that only reads current free passes
right before a breach), both watermarks and the no-respill consequence,
the spend order, the refusal, and the liar-provider case.

Suite 792 passed / 1 failed (the inherited _staging_bytes red).
Also adds "trough" to .codespellrc -- correct English, already used in
this codebase, mis-flagged as "through".
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
… and die

THE DEATH. 2026-08-15 23:41:01, unpinned boot 1, pool 454039, five agent lanes.
available 0, evictable 0, and alloc_token_slots raised "Out of memory. Try to
lower your batch size" out of get_new_batch_prefill -> prepare_for_extend ->
alloc_for_extend on ALL THREE ranks at once, then "terminate called without an
active exception".

WHY NO GRACEFUL PATH ENGAGED -- every relief this tree owns, traced:

  retract_decode        reachable only from update_running_batch, which runs
                        AFTER get_new_batch_prefill in the same iteration. The
                        prefill path cannot reach it.
  the sgl-project#287 ladder       needs --kv-pressure-ladder to exist at all, commits
                        transitions only every consensus_interval (8) rounds
                        behind a bounded collective, and its actuators reshape
                        FUTURE admission. It never touches the batch that is
                        about to allocate.
  kvso try_spill        wired into the decode-OOM branch and into the ladder.
                        Not reachable from the prefill allocation.
  evict_from_tree_cache the one relief the alloc site does attempt -- and with
                        nothing evictable it is a guaranteed no-op that returns
                        no signal, so the raise was reached having tried
                        nothing at all.

AND ADMISSION HANDED IT THE WORK. PrefillAdder.add_chunked_req carried:

    if _rem_tokens <= 0:
        _rem_tokens = self.rem_chunk_tokens

When the budget said the pool had NOTHING, schedule a full chunk anyway. The
comment above it is right that the request must not be dropped -- it leaks if
it leaves unhandled -- but "admit it anyway" was never the only way to keep it.
PARKING is already a first-class state here: the hybrid-SWA branch three lines
up produces it, and the scheduler documents the result at the chunked-request
stash ("a parked chunk leaves extend_range.end == len(prefix_indices), so there
is nothing new to cache and stashing would be a no-op").

THE FIX IS TWO LAYERS AND THEY ARE NOT INTERCHANGEABLE.

PREVENTION, admission side, GROUP-UNIFORM. A chunk is scheduled only for tokens
the pool can actually fund; below one page it parks and is retried when memory
frees. The availability term comes from the PUBLISHED floor
(uniform_avail_for_evict), not this rank's own size -- under uneven DCP the
ranks differ, and a rank-local branch here splits the group across different
batches, which is a hang rather than a stall. That distinction has cost this
chain two boots already, so it is not being relearned a third time. Where the
pool can fund something but less than the nominal chunk, the chunk now takes
what exists instead of the nominal size.

A NET, alloc site, RANK-LOCAL. One bounded relief, one retry, then the original
error unchanged -- the shape _mem_create_reclaiming already uses for driver
OOM, followed rather than reinvented. Providers are rank-local BY CONTRACT:
by the time execution is here the group has committed to a batch, and a
provider taking a collective would hang the first time one rank arrived and its
peers did not.

THE NET IS CURRENTLY EMPTY, AND IT SAYS SO. Nothing registers a provider: the
rank-local relief that could pay (eviction) is already spent by then, and the
ones that could genuinely free tokens are collective and belong on the
admission path. So the registry is a SEAM, and rather than let it be a term
that is present and inert -- the failure this tree keeps finding -- reaching
the alloc site with an empty registry logs, once, that no relief existed and
that admission is therefore the whole guarantee.

THE 45s WINDOW IS THE AMPLIFIER, NOT THE CAUSE.
SGLANG_PHASE_POLICY_PP_WINDOW_S=45 is live and admits roughly three times the
concurrent prefills the 15s regime did, which is why the pool reaches zero far
more often now. Nothing in this fix depends on the window length: the guard is
a function of what the pool can fund at the moment of scheduling, which is
exactly the quantity a longer window drives to zero.

Tests: 23, against a hermetic exhaustion fixture (available 0, evictable 0 --
the crash's own state). Can-fail proven by three mutations: restoring the
zero-budget override, making the admission predicate rank-local (2 fail,
including the three-ranks-one-floor case), and removing the alloc-site relief
(4 fail). NOTE honestly: the restored-override mutant is caught by a SOURCE
pin, not an execution test -- exercising add_chunked_req itself needs a full
PrefillAdder, so the decision was extracted into a pure function that the
behavioural tests drive, and the wiring is pinned separately.

No regressions: 989 pass across the scheduler/prefill/seam suites, with the
same 5 pre-existing failures before and after (test_scheduler_chunked_req_gate
and test_scheduler_pp_request_order_633, both stale test stubs whose fake
Scheduler lacks phase_flip_runtime/ps -- a collision with the phase-flip work,
flagged rather than forced per instruction).

NOT BOOTED. Desk-only by instruction.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…roject#677 to compose against

The sgl-project#679 close-out said the retry net's registry is empty because the reliefs
that could genuinely pay are collective and belong at admission. This is that
claim made concrete, written so sgl-project#677's hysteresis-drain design can consume it
without re-deriving anything.

WHAT IT ESTABLISHES.

Four reliefs exist and only four: radix eviction, the sgl-project#287 ladder's
admission_cap, kvso try_spill, and retract_decode. For each: what it frees at
the admission decision point, what it costs, and how it is invoked without
splitting the group. Two of them are not what one would guess:

  the sgl-project#287 ladder is TOO SLOW to be a rung. Its consensus boundary is every 8
  rounds; a chunked-prefill burst exhausts the pool in fewer. It is the slow
  outer loop -- and the decode path already uses it that way, throttling before
  retraction to stop the freed slots being handed straight back.

  kvso try_spill is the BEST rung, not retraction. It frees a bounded, chosen
  amount (the victim's block-aligned tail overhang), is already driven from the
  reduced value, and costs no request's progress. Its bound is the host region
  supply, and exhaustion is a reachable state the decode path already documents.

THE ITERATION ORDER, VERIFIED, AND IT IS FAVOURABLE. The reduce runs at
scheduler.py:4777, unconditional and pre-branch by its own comment; admission
at 5089; retraction at 5950 inside update_running_batch (5818). So a ladder at
admission reads an ALREADY-AGREED number and needs no collective of its own,
while retraction is genuinely downstream -- which is why sgl-project#679's crash had
nothing to fall back on, and what rung 3 must work around.

THE ORDER, mirroring the decode-OOM branch rather than inventing a second
shape: evict (baseline) -> try_spill -> throttle -> retract_decode -> PARK.
Parking stays the floor of the ladder, not its replacement.

THE COMPOSITION CONTRACT WITH sgl-project#677, stated in three rules because both
mechanisms decide admission from pool headroom:

  1. The park guard is the FINAL authority, the drain gate the prior one. A
     phase gate cannot make memory exist; it may narrow what the park guard
     allows, never widen it.
  2. Any headroom quantity sgl-project#677 branches on must be the GROUP-PUBLISHED floor.
     A rank-local reading in the drain gate reintroduces the sgl-project#603/sgl-project#583
     divergence class upstream of every safeguard sgl-project#679 added -- and a park
     guard reading the reduced floor does not protect a gate that reads a
     local one.
  3. Parking must be reachable from every path that reaches alloc_for_extend.

AND THE LIKELIEST COMPOSITION FAILURE, called out so it can be tested on both
sides before it is met on metal: hysteresis and parking can beat against each
other. A parked chunk schedules ZERO tokens, so a drain that counts admission
ATTEMPTS rather than SCHEDULED TOKENS will believe work was taken, hold its
hysteresis, and deadlock against the park at exactly the pressure where both
are needed.

Section 5 lists what this note does NOT close: the ladder is unbuilt, rung 3 is
a real refactor, and rung 1's host-region bound has never been measured under
the 5-lane load that produced the crash.

No code change. Every claim carries its file:line.
YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 27, 2026
…erlay (1+2 / final arms)

The current overlay imports sglang.srt.models.qwen4_exp_prefill_graph (sgl-project#287 line)
on its emitter QSA-indexer and P-trunk paths; every use is guarded by active().
With the prefill graph off (this recipe) the overlay takes its non-graph path.
Factor-arm code paths do not import this module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 30, 2026
…echstschlechteste Rang (Leximax) statt der Summe -- TP2 blieb an seiner x1-Kante, bs>=2 +30..65 %

Befund (NF, gleiche Replay-Last median 17249 Token, 48 Zwillingspaare):
y3j 09291933 (Schnitt [0,36,28], TP2 FR_D 0,393, 62 D-residente Experten)
dekodierte bs3 in ~42 ms, 09300002 (Schnitt [0,28,36], TP2 FR_D 0,256, 40
Residente) in ~55-61 ms. TP0 griff gleich oft fehl (5,4-7,3 je Layer und
Forward bei bs2/3 in beiden), TP2 2,5x oefter (1,1 -> 2,2-3,8): ab bs2
bindet die 3080 mit den wenigsten Residenten die synchrone Runde. bs1
unveraendert, dort bindet der Host (35,92 ms im bs1-Modell jedes Boots).

Wurzel: solve_owned_cut rangiert (max T_r, Summe, Verschiebung, lexikalisch).
Der Host bindet das Maximum, also sind alle Worker-Schnitte gleich; die Summe
kann nicht trennen, denn die KV-Zeilen, die eine 3080 abgibt, nimmt die
andere zu denselben Kosten je Zeile (y3j [7,35, 26,11] und korr 09292034
[5,17, 28,29] je 33,46; 09300002 [5,17, 30,46] gegen [7,35, 28,28], je
35,63). Die Wahl fiel an Rundungsrauschen und an die lexikalische Ordnung
des Anteil-Vektors: (0,28,36) vor (0,36,28), das KV auf TP2 bis an dessen
x1-Kante. Deshalb kippte der Schnitt von Boot zu Boot (korr 0,287, arr
0,368, ab 22:50 0,256, ab 04:27 0,206 auf TP2).

Fix: owned_rank_key -- T_r absteigend sortiert, lexikalisch verglichen, dann
die Summe. Das bs1-Ziel (das Maximum) bleibt unberuehrt; unter Gleichstand
gewinnt die Form, deren schlechtester Worker am wenigsten Fehlgriff-Zeit
traegt -- der Rang, der mit den Sitzen bindet, behaelt die meisten
Residenten, die x1 zulaesst. Keine Laufzeitarbeit (Planer beim Start), kein
Schalter; ein erzwungener Schnitt (--d-kv-token-cut owned:<vektor>) bleibt
unberuehrt und traegt den Metall-A/B.

Test test_weg2_d_owner_worker_tie_287 (3): rot auf 78b40a2 (Schnitt
(0,20,44) statt (0,36,28); owned_rank_key fehlt), gruen mit Fix;
Nachbarn owner_solve/free_search/round_x1/miss_record/flip_riegel/
d_early_start: 91 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 30, 2026
…reaches the ranks (-ml-ef), with its generator

NF's orders 30.09.: Soll profile nf-h91-dpr-sa-vis-adopt-st-cut-vsync-odx-2b-swr-e2cut-z30y2-arr-wre-ta-dh-ml-ef.env
(ARRIVAL_SEAT_RULE=1 is the release value, A/B in the noise); derive profiles_release/nf.env from what ARRIVES in the
rank, not from the text (PROFILE_ARGS is built before later NF_ENV_* appends; only exports and _form arrive);
--d-kv-token-cut NOT pinned (the planner chooses it since sgl-project#287). NF releases the draft before the freeze.

docker/flliper/release_profile.py:
- dump: sources a profile in a clean env (env -i + HTSGLANG_INSTRUMENTS/TRANSPORT, markers for HTSGLANG_TAG and
  SGLANG_WEG2_EVIDENCE_DIR) and records the final PROFILE_ARGS, the _form pairs of profile_form_env and
  profile_instr_env, the file's own exports, the PROFILE_* scalars and arrays.
- gen: a FLAT profile with the same effective set under instruments 0/1 x bar1/nccl; the instrument and nccl parts of
  --env-p/--env-d become conditional appends, refused when a base token of the same key would follow them (the
  launcher's last-entry-wins order would change); named deliberate differences only: --drop-arg flags,
  PROFILE_NAME/STATUS/OWNER/FORM, instruments default OFF (F8).
docker/flliper/profiles_release/nf.env: generated from -ml-ef (sha256 in its header), status experimentell until
NF's release, --d-kv-token-cut dropped. gpu-arb/docker/profiles_release stays untouched (operator copies at freeze).

Finding for NF (not changed here): -ml-ef puts two FORM switches into profile_instr_env, which the entrypoint calls
only with HTSGLANG_INSTRUMENTS=1 (release default 0): SGLANG_MOE_REPACK_SKIP_VETOED=1 (code default False -> OFF in
the release, although every NF metal boot ran it, e.g. acceptance_0930_083955 with HTSGLANG_INSTRUMENTS=1) and
SGLANG_WEG2_OWNED_CUT_X1=workers (= its code default, no effect).

Tests: test_flliper_release_0930.py +5 -- generator on synthetic profiles (late append does not arrive, plain
assignment does not, export does, round trip equal under all four knob combinations, instruments default off,
precedence change refused); NF draft vs target: effective sets equal under all four combinations except the named
decisions, ARRIVAL_SEAT_RULE=1 on front and D, WAKE_READ_EARLY (an -ef late append) arrives, the checked-in draft
equals a fresh generation. Mutant (STORE_MLOCK lines removed from the draft): 3 red. docker/ directory: 33 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 30, 2026
… Mehrwellen-Prefill -- Welle k+1 kopiert auf dem Prefetch-Strom, waehrend Welle k rechnet (Schalter aus bis Metall)

Befund (y4k/y4l P-Logs, PP0 16k-Chunk): der Compute-Strom-Abschnitt moe_fetch
(FWD-TIMING-PREFILL) ist gleich der Summe der Kopier-Events
(MOE-OFFLOAD-TIMING-PREFILL fetch_ms), y4k forward 1: 1453.5 = 1453.5 ms -- heute
ueberlappt nichts: jede Welle ist fetch-join-apply auf einem Strom
(P-MINIFWD-THROTTLE legte die gejointen Kopien auf den Forward-Strom). PP0 16k:
279 Wellen, 5859-7592 Spill-Experten, Kopie 1.13-1.48 s (~13 GB/s, die
Linie), apply 0.42-0.47 s.

SGLANG_WEG2_ENABLE_PREFILL_FETCH_OVERLAP (Default aus),
expert_offload.PrefillFetchOverlap im expert-major Mehrwellen-Loop:
- der vorhandene Scratch [R, R+S) wird in zwei Haelften H = S // 2 geteilt,
  die Spill-Wellen auf <= H neu geschnitten (Reihenfolge bleibt, Wellenzahl
  ~x2), Spill-Welle j liest Haelfte (j-1) % 2 (Slot R + Haelfte*H + i);
- die Kopie von Welle w+1 wird VOR dem apply von Welle w auf dem einen
  Prefetch-Strom des Rangs ausgegeben (pool_prefetch_stream), WAR per Event:
  ab w >= 3 hinter dem apply-Event von w-2 (letzter Leser der Haelfte), sonst
  hinter dem Stand des Forward-Stroms; der Forward-Strom wartet vor jedem
  apply auf das Kopier-Event seiner Welle. Keine Host-Synchronisation, kein
  Join, kein neuer VRAM;
- die Resident-Welle (w=0) braucht keine Kopie: Spill-Welle 1 wird vor ihr
  ausgegeben, die erste Kopie jeder Schicht laeuft also neben dem
  Resident-GEMM;
- _fetch(stream=, after=) ist ein neuer Zweig; ohne stream bleibt der Aufruf
  wie er war (gibt None).
Nicht genommen: Schalter aus, stream-partials (fp32-Summenfolge folgte dem
Schnitt), H107-Slot-Plaene, Graph-Capture, Scratch < 2, keine Spill-Welle.
Der Einwellen-/Decode-Pfad fragt PFO nie.
Schichtuebergreifender Lookahead im Mehrwellenpfad ist NICHT gebaut
(lookahead_dropped bleibt): er braucht resolve_sticky ueber die Wellen und
eine Vorhersage je Schicht; der erste Kopierblock je Schicht liegt schon neben
dem Resident-GEMM.

Tests: test_prefill_fetch_overlap_pfo_0930.py 6 passed (CPU, echter Planer und
Wellen-Loop, Spielzeug-apply liest die Slots: bitgleich zum seriellen Pfad und
zur echten MoE; Event-Protokoll auf Attrappen; Decode fragt PFO nie); auf
d233ce6 5 failed, 1 passed (der Schutz "alter _fetch-Aufruf
unveraendert"). expert_offload-Nachbarn (42 Dateien): 542 passed, 1 failed --
derselbe auf der Basis (expert_compute_placement_439).
Chosen-David pushed a commit to Chosen-David/sglang that referenced this pull request Oct 20, 2026
SGLANG_TLI_NEAR_PAGES/TOKENS/LEN 三 env 显式覆盖 nb/nt/nl(None 回退
α/β/γ legacy);NEAR_TOKENS=off 自由竞争哨兵 ≡ γ-off(L2 单池 topk,
L1 双池照旧);γ 三态("off"=None/未传=1.0/数值=折扣)对齐 HF 权威
实现 tli_indexer L357-364。fail-closed:几何与 α/β/γ 同传拒绝;构造期
网格约束 nb·bs≤nl、nt≤nb·bs、far≥0。冒烟已过(前轮会话)。

paper/TLI_paper_en.tex 为 paper 会话在飞 WIP 不入本提交。

Co-Authored-By: Claude Opus 4.6 <[email protected]>
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