Repository navigation
fix: replace pillow with PIL in PACKAGE_LIST - #781
Merged
Merged
Conversation
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 20, 2026
…ecated bridge The boot env was assembled by concatenating a captured shell environment, a heredoc and EXTRA_ENV. That is not a configuration mechanism, and it failed as one twice over: SGLANG_UNEVEN_TOKEN_VECTOR was set to 14,10,8 and then cleared by an empty override appended later. Uneven token sharding -- which must never be off -- was silently disabled for a day. SGLANG_PHASE_POLICY_TP_DECODE_FLOOR_S was 10 in the captured half and 8 in the heredoc. 8 won. The 10 had been dead for as long as both lines coexisted and nobody had noticed; it was found only because the first defect prompted a systematic check. Both are the same defect: a value someone deliberately set, silently overwritten by a value nobody compared it against. "Last one wins" is not a diagnostic any reader can see -- the unit line is one screen wide and the two entries sit forty keys apart. A flag cannot fail those ways. argparse rejects a typo that env silently ignores, there is one definition instead of a name matched by string in N places, the value is visible in `ps` and in the boot log, it cannot be written twice, and the planner can solve it. So the six phase-policy tuning knobs become ServerArgs fields, and config_from_env resolves each through _flag_or_env: the flag wins, the env is read only when the flag is unset and warns via the existing _warn_deprecated_env_to_cli_flag. Fields default to None -- "not specified" -- so every deployment that has not moved to flags is byte-identical today. ServerArgs is pickled whole into each scheduler subprocess, so the flag reaches every rank without an env round-trip. That also sidesteps the sgl-project#754 class of bug for these knobs: nothing has to re-parse a global env after the fork. Also declared here (fields only, consumers wired in the following commits): seam entry margin/delay, flip seam chunk, collective census interval, and phase_flip_corridor_floor_mib -- the last one lands on a hook that was already built and inert at phase_flip_spill.py, and replaces SGLANG_CORRIDOR_FLOOR_MIB, which had been silently overriding the corridor law in code (corridor_guard.CORRIDOR_LAW_MIB = 1024, band 819-1229) so that measurements were judged against a band the server did not use. Test is red-first and can-fail verified: with the flag lookup neutered so the resolver ignores ServerArgs, 11 of the assertions fail; restored, 6 pass with 15 subtests. The case that matters most pins a flag of 10 against an env of 8 -- the exact pair that was live in this repo.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 20, 2026
…an internal detail Sixteen more SGLANG_* knobs get ServerArgs fields: barlink and its transport, the BAR1 aperture windows, the seam entry margin/delay and staging chunk, the collective census interval, mamba slot reorder, uneven DCP and its weighted form, KV backing relief, file-backed flip images, corridor rebalance, the TP memory imbalance check, and health-endpoint generation. The consumers for most of these live in modules that are never handed a ServerArgs -- the barlink transport, the weights arena, the KV relief ladder, the rebalance lender. Rather than rewrite thirty read sites in a live serving stack, this follows the mechanism already in the file: mamba_ssm_dtype publishes itself into the typed registry, and _publish_promoted_781_flags now does the same for the rest, from the process's own argv. What that buys, precisely: the FLAG is the single source of truth and the only operator-facing surface. argparse rejects a misspelling that the environment silently ignored -- verified, --seam-entry-margin-mibb is a hard parse error where SGLANG_SEAM_ENTRY_MARGIN_MIBB would have left the default riding. There is one definition instead of a name matched by string in N places. The value shows up in `ps` and in the boot log. It cannot be written twice. The planner can solve it. And the environment stops being something a human or a boot script writes, which is what lets the unit environment go identity-only so the boot gate can refuse any SGLANG_* it finds there. What it does not buy, stated plainly rather than left to be discovered: the consumers still read env. Threading each family through its own funnel per the sgl-project#754 template is follow-up work, not done here. This narrows the blast radius; it does not claim every consumer was rewired. phase_flip_corridor_floor_mib is different -- it lands on a hook that was already built and inert, with a comment explaining it was left there for exactly this flag. It replaces SGLANG_CORRIDOR_FLOOR_MIB=1536, which had been silently overriding the corridor law in code (corridor_guard.CORRIDOR_LAW_MIB = 1024, band 819-1229). The same file already described the consequence: "armed at 1536 and judged at 1024 ... the gap between the two numbers was exactly where five corridor breaches lived, unseen." Flag first now, env only as a deprecated bridge, and the log line names the flag instead of sending an operator after an env var they should not use. Defaults are None throughout: an unset flag publishes nothing and leaves the environment untouched, so nobody's running deployment moves today. Tests pin the parts that bite. False must publish "0" rather than be skipped as falsy, or a feature the operator turned off stays on. The TP-imbalance polarity is asserted in both directions because its retired predecessor SGL_DISABLE_TP_MEMORY_INBALANCE_CHECK was inverted. The BAR1 flag is asserted to expand into the per-group suffixed keys the consumer actually builds. 12 tests, 32 subtests, green.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 20, 2026
… it is per phase --rank-kv-ratio looked like the flag this env var had already become. It is not, and a boot said so: an explicit --rank-kv-ratio vector is refused unless a non-uniform --rank-tp-ratio plan is installed, which a PP-prefill boot does not have. Promoting SGLANG_UNEVEN_TOKEN_VECTOR onto it killed the boot in 7 seconds. The deeper reason is that this instance runs TWO layouts. Under --enable-phase-flip it is PP in prefill and TP in decode, so an uneven split needs an entry per phase rather than one value that silently names only one of them. The prefill side is already carried by --pp-stage-ratio and --pp-attn-stage-ratio. This flag is the decode side, and its help says so. It is also not the weight shard split. The runtime prints the distinction itself: "KV token split [14, 10, 8] differs from the weight shard split [32, 16, 16] ... the weight shard follows compute; the token split follows each rank's memory left after its weights land." Two different questions, two different vectors, and --phase-flip-tp-vector answers the other one. Published into the environment rather than read from the field by the consumer, because the resolver runs inside the flip's SECOND stack build where the geometry is TP and not the boot-time PP -- the same scope split the sgl-project#754 fix addresses. Publishing keeps one value visible to both stacks. Worth recording how wrong the first reading was. Looking only at boot-time ServerArgs (tp_size=1, pp_size=3, dcp_size=1, rank_tp_ratio=None) the resolver bails at its first guard, and I concluded the vector had been inert all along. It is not inert; it is consumed in the decode layout, and the per-rank sizing lines show ratios 14/10/8 being applied. Reading one layout of a two-layout instance and generalising is the same mistake as reading one half of a concatenated env.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 20, 2026
…ver allocates
Boot 735-standT refused the full per-card VRAM reserve with nine unbounded
terms. Three of them were PHANTOM:
NCCL communicator buffers on <card>: ... NCCL-owned group(s): pp
(should_build_pynccl(use_pynccl=True, world_size=3,
barlink_active=False) is True), flip_tp (...), flip_dcp (...)
while the same boot log recorded, for all four groups:
barlink enabled for group 'pp:0': requested=bar1, ACHIEVED=bar1
Barlink owned every group, so no PyNccl communicator was constructed and
those buffers were never allocated. A refusal is not a warning -- it costs
the ENTIRE priced reserve, which is why the corridor verdict has been
reporting net == raw and inventing no posts.
ROOT CAUSE: an ordering defect introduced by sgl-project#781. parallel_state.
should_build_barlink (parallel_state.py:489) is
`bool(envs.SGLANG_BARLINK.get()) and world_size > 1`, and the ledger's NCCL
term calls it at argument-parse time. Before sgl-project#781 the boot script exported
that variable, so it was true when the ledger ran. sgl-project#781 made --barlink the
source of truth and the environment an internal detail this process
publishes from its own argv -- but the publish sits in
_handle_environment_variables (__post_init__ line ~6892) while the ledger
runs in _handle_gpu_memory_settings (~6745). The ledger read an unset
variable and concluded every group builds NCCL.
Same shape as the sgl-project#596 defect already documented inside
ledger_full_demand_per_gpu: a value the ledger reads, resolved after the
ledger reads it. Same remedy: resolve it first.
FIX: _publish_barlink_ownership_env, hoisted ahead of the ledger-bearing
calls. Deliberately NOT a hoist of _publish_promoted_781_flags itself -- the
first version of this change did that, and the test caught it: that method
is 145 lines and also resolves debug-cuda-graph and custom-all-reduce,
including a self.debug_cuda_graph assignment, so the "idempotent publisher"
claim was false and the blast radius far exceeded the defect. The full
publisher now delegates to the same helper, so there is one definition and
the early and late values cannot diverge.
SECOND DEFECT, the ghost remedy. The graph-capture refusal instructed the
operator to run `ingest-boot-log` against a boot log containing the
'Capture ... begin' lines. No such CLI exists anywhere in this tree; grep
over mem_ledger/, rigmon/ and scripts/vram_ledger/ finds only the string
itself. An error message prescribing a command that does not exist is a
silent falseness: the one remedy needing no GPU was unimplemented, which is
a plausible reason these terms sat unpriced for so long. The message now
names the mechanism that does exist (probe_activation.py and the per-rank
phase_footprint_rank<N>.json it writes). Implementing a boot-log ingester
remains open; it is not claimed here.
Tests: test/registered/unit/mem_ledger/test_ledger_phantom_nccl_786.py, 6
pass. The ordering guard is can-fail proven by removing the hoist (3 fail).
The ghost-remedy guard is selected BY SHAPE -- every scripts/*.py path any
ledger message prints must resolve on disk -- so the next invented remedy is
caught too, not just this one. 520 pass across test/registered/unit/
mem_ledger/. ruff: 358 errors in server_args.py before and after, i.e. none
introduced; new files clean.
Not claimed: this retires 3 of the 9 reported terms. The remaining 6 are the
CUDA-graph-capture and runtime-activation footprints on three cards, which
need scripts/vram_ledger/probe_activation.py run for this configuration.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 12, 2026
…lence is not Boot weg2xsn26 was refused CORRECTLY (run_peak 95.12 vs hard bound 94.43, source=SERIES binding weg2xsn25 8.697, W87 -> W20 "no arm of the ladder funds both moments") and the launcher had NO named override at all: the boot seat grepped the refusal text, the argparse and every SGLANG_*OVERRIDE/FORCE/ACCEPT and found zero. The user's standing rule of 2026-09-12 is that the reap mark is SOFT -- crossing it is allowed WITH a number and a runtime latch, and never silently. The ledger had the "never" and not the "with". `--host-ledger-deviation "<reason>"` + `--host-riegel-gib <float>`, BOTH OR NEITHER (W97 Weg2HostDeviationRefused, census-checked, no collision). Flag only: NO env twin, and a test pins that (sgl-project#781 fossil class -- one spelling, on the command line, where it lands in the argv echo and the form key). IT CONVERTS THE FUNDABILITY VERDICT AND NOTHING ELSE. The verdict is computed in full first; the deviation then accepts it and appends WEG2-HOST-LEDGER DEVIATION reason="..." predicted_run_peak=<GiB> hard_bound=<GiB> reap=<GiB> excess=<GiB> riegel_gib=<float> source=<...> with every number taken from the SAME arm arithmetic -- nothing is re-estimated. `test_the_sizing_is_byte_identical_with_and_without_the_flag` is the ratchet on that: every key and every value of `arm.terms` is compared against a plain `price()` of the same arm, plus both leftovers. TWO REFUSALS STAND, and they are what makes this a deviation rather than an off-switch: * predicted run peak AT OR ABOVE the REAP WATERMARK (95.90) -- the bound is soft, the watermark is where the kernel reaped. weg2xsn25 died on a prediction 5 GiB below it; accepting one AT it is booting into the killer. * riegel AT OR ABOVE the hard bound -- a latch above the bound it is meant to catch a breach beneath can never fire in time. It is decoration, and the rule asks for a latch. Sizing, ring dimensioning, the manifest guard (sgl-project#1359) and the runtime guard W22 are untouched; W22 still tears down at the latch. DRY RUN, the boot seat's real xsn26 argv (shadow form, --pin-ledger-arm-m 150): WEG2-HOST-LEDGER DEVIATION reason="xsn26 Zielfrage: erster D2D-Flip, Riegel 93.0" predicted_run_peak=95.10 hard_bound=94.43 reap=95.90 excess=0.68 riegel_gib=93.00 source=SERIES rc=0 Same argv WITHOUT the flags, as the control: rc=2, REFUSED W87 -- unchanged. Tests (12 + 46 subtests): reason without latch, latch without reason, latch >= bound, predicted >= reap, the happy-path line with its ordered fields and its arithmetic (excess == predicted - hard_bound), the arm that comes back is the one the ladder priced, byte-identical sizing, and no env twin. ruff clean. No boot, no GPU, no /dev/shm.
shiyu7
added a commit
to shiyu7/sglang
that referenced
this pull request
Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for your contribution, we really appreciate it. The following instructions will help improve your pull request and make it easier to receive feedback. If there are any items you don't understand, don't worry. Just submit the pull request and ask the maintainers for help.
Motivation
Modification
Briefly describe the changes made in this PR.
Checklist
pre-commit run --all-filesor other linting tools are used to fix potential lint issues.