Repository navigation
feat: add benchmark serving - #657
Merged
Merged
Conversation
Contributor
Author
|
I also tested on my local dev and it works well. python3 -m sglang.launch_server --model /root/share/model_repos/internlm2-chat-7b --trust-remote-code --disable-radix-cach --stream-interval 1
ulimit -n 65535
python3 -m vllm.entrypoints.openai.api_server --model /root/share/model_repos/internlm2-chat-7b --trust-remote-code
python3 -m lmdeploy serve api_server /root/share/model_repos/internlm2-chat-7b
python3 -m sglang.bench --backend sglang
python3 -m sglang.bench --backend vllm
python3 -m sglang.bench --backend lmdeploy |
Contributor
|
Great! We need TRT-LLM as well. |
Contributor
Author
ok I'll land TRT-LLM asap |
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 11, 2026
…ime placement lever Item 16's REBALANCE tier had no actuator because five shifts looked for a MOVER. The allocator's CHOICE is the lever that exists: alloc, alloc_extend and alloc_decode all consume the HEAD of the free list, so a stable partition by DCP owner class steers all three at once, places bytes without moving or freeing any, and cannot starve an allocation (the tail is the rest of the list). The decision is group-uniform BY CONSTRUCTION, which is a correctness requirement and not a nicety: the free list is replicated scheduler state, so two ranks ordering it differently would write one token's KV to two rows. The absorbing card is chosen from NVML, which is rank-local, so the resulting rank index is reduced with MIN at the seam -- the one point every rank reaches unconditionally with a bounded collective already in hand. The rank -> NVML permutation rides the same reduction, resolved per rank by UUID, because --rank-gpu-id is read in CUDA order and rank 0 is the 5090 at nvidia-smi index 1 (register law 9). A checksum of the free list rides it too: a disagreement DISARMS steering for the life of the process rather than continue on a premise that has just been watched to fail. Ships OFF (SGLANG_CORRIDOR_STEERING=1 to arm); with it unset no extra collective is entered at all. Also instrumented, because it is what the tier is actually worth: the KV rung's line now splits max_live by who PINS it -- a resident request's row cannot be given up, a radix-tree row is evictable. On s38's own shipped window the floor sat 55k-210k rows above the live token count (median ~71k = 592 MiB on the binding 3080) while the traffic returned '#cached-token: 0' on 41952 batches. Nothing acts on it yet, deliberately. Tests: 1072 passed / 0 failed (test/registered family, the s38 1052 plus 20 new), including the shipped allocator methods and three can-fail proofs: a divergent free list disarms, a paged layout is refused, a malformed class is refused. The confirmation window on metal follows in the handoff.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 11, 2026
…rst boot proved it The bias methods were written on PagedTokenToKVPoolAllocator. On this rig they steered nothing: the scheduler keeps ONE allocator for process life -- the PP stack's -- and the PP layout has dcp_size == 1, so at page_size == 1 the chooser builds a plain TokenToKVPoolAllocator (model_runner_kv_cache_mixin.py:4083). The boot armed the mechanism and logged "the active allocator has no owner bias" nine times. Moved to BaseTokenToKVPoolAllocator, which both classes inherit. Every allocation path in every subclass takes the HEAD of free_pages, so one stable partition steers all of them. Pinned by two new tests: one asserts the base and both subclasses carry the methods (it fails if they move back down), one exercises the unpaged class that this configuration actually uses, including that its own alloc path returns slots of the biased class. Tests: 1074 passed / 0 failed (registered family). Separately checked and NOT mine: test/registered/unit/mem_cache/ fails 4 tests in test_mamba_checkpoint_interval.py and segfaults at 22% -- identical failure and identical crash point on 70865d7, verified in a detached worktree.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 11, 2026
…t proved that too Second boot, second identity bug, caught by the mechanism's own guard rather than by a wrong result. All three ranks logged "armed on rank 0": the scheduler's topology snapshot describes the CURRENT phase and this instance boots in PP3, where tp_size == 1 and every rank's tp_rank is 0. All three wrote their NVML column into slot 0 of the reduction, the permutation came back (0, 1048576, 1048576), and the steer DISARMED itself -- refusing to guess a column rather than push bytes onto the binding card (register law 9). Now indexed on get_world_group().rank_in_group, the same identity the flip's cutover uses to rebuild the topology, so it means the same thing in both phases. A world rank outside the token vector is "not applicable" rather than a guess. The disarm is kept as a regression test with the observed values in it: a mechanism whose guard has fired on metal is worth more than one that has only ever been argued. Tests: 1075 passed / 0 failed (registered family).
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 11, 2026
…ency C22 records what item 16's REBALANCE tier can actually steer. The actuator five handoffs called missing exists and works -- the free list is the choice point, and a stable residue-class partition steers every allocation path at once -- but ownership does not decide residency on this architecture, so the tier cannot be funded with it. Laws 11 and 12 generalise the two lessons. s39_steer_report.py judges the mechanism on PLACEMENT, with the free column as a consequence rather than as the proof, and prints the free-list replication check (every promoted count must appear in triples across the three ranks).
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 11, 2026
…PPLICATION was not The confirmation window died at t+18 inside a pp->tp cutover: KvReshardError: PHASE-FLIP payload checksum mismatch from peer 1 -- refusing to scatter and in the SAME SECOND, on all three ranks, the steer's own replication check disarmed it: CORRIDOR-STEER DISARMED: the free list is NOT replicated across ranks (checksums 455859173976 vs 455936170468) Root cause, and the generalisable half: the DECISION was reduced and uniform, but the bias is re-applied on a rank-local 1 s clock, because frees return pages to the head of the list and wash the order out. Three ranks re-sort at three different instants and hold the same members in different orders in between; the reshard plan is built from that state. A pure function applied on a private clock is not a group-uniform mutation of replicated state. The flip's checksum turned that into a clean abort rather than a wrong answer. The mechanism was already going to ship OFF on price: at matched load the live id ceiling goes 343949 -> 512543 (67% -> 99% of the id space), and the KV rung's floor IS that ceiling, so the funder of the fatal pp->tp leg can return almost nothing. A hermetic test predicted the direction before the boot. Also falsified, before anyone built it: the radix-eviction lever this shift priced at ~592 MiB/card mid-shift. That figure joined 'full token usage' to a seam-emitted proposal line -- two instruments, two clocks. Measured at ONE instant by the new split instrument, a resident request holds the same top row the tree does: 'an id-targeted eviction could lower max_live by at most 0 rows', in every sample. Serving restored on the ship config at 22:59:08Z, health 200, 5 ok / 0 err under load, zero CORRIDOR-STEER lines -- the default path is untouched. Register: C22 corrected, laws 11 and 12. Bench row added. Tests: 1076 passed / 0 failed (registered family).
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 13, 2026
…eed, and the checksum guard misreported it The sgl-project#656 acceptance run died at 2026-08-13 13:03:16Z after 320 clean cutovers, reporting a payload checksum mismatch from peer 1 with "sender" fields of 4626949667419791296 on rank 0 and -4450328002521349435 on rank 2. Neither is a checksum. A uint8 sum over N bytes lies in [0, 255N]: the second value is negative, and the first would need an 18-petabyte payload. The receivers' values (30942312421, 17682061978) are ordinary sums. So the DATA was never the thing that was wrong, and the guard killed a healthy instance for a corruption that had not happened. What actually breaks: the per-peer payload length is a product of rank-local terms -- the live slot set (build_flip_live_slots_fn asserts "Replicated" and nothing verifies it) and the wave partition (whose own docstring names _pools_alias and SGLANG_FLIP_SEAM_WAVES as rank-local). Nothing on the wire carries a length, and the receiver's size check compares payload.numel() against incoming_nbytes[peer] -- a buffer it allocated itself, at that size -- so it is vacuous by construction. When the frames diverge, NCCL matches the send against the recv, delivers the shorter count, completes, and the trailer is read out of the unwritten tail of a torch.empty buffer. The hermetic suite could not see it: _MailboxExchange hands the receiver the SENDER's tensor, so a divergence surfaces there as a clean size error. _NcclLikeExchange models the real delivery semantics. Three changes: * the wire frame rides the ballot the round already runs. _frame_digest is a modular fingerprint of the live slot set, the wave partition, the vector and the direction, reduced as the [x, -x] MIN pair the fit verdict already uses -- no extra round trip. Ranks that disagree ABANDON unanimously before a byte moves instead of raising at the seam. This is sgl-project#639's remedy for the prefix-length vector, applied to the premise the seam actually depends on. * checksum_is_representable() splits the two diagnoses the guard used to conflate. Out of range -> FRAMING, named as such. In range -> the data differs, which is what the guard is for. * frame_aborts is counted separately from fit/staging/corridor aborts: a broken replication premise and a pool that is too small want opposite responses from an operator. Also corrected: MERGE-R7 attributes C22 to sgl-project#657's corridor steering. That boot ran corridor_post_sizing_mib=None and SGLANG_CORRIDOR_REBALANCE=0, so the steering path was not enabled. The attribution is falsified; the register is corrected in the handoff. TEST RESULTS (CPU desk, PYTHONPATH=<worktree>/python, pytest --color=no): * test_flip_frame_agreement_656.py: 10 passed. Includes the RED ARM -- with _frame_digest stubbed to a constant, the divergence reaches the wire and a rank raises with a trailer field of -6510615555426900571, reproducing the metal signature on a CPU desk; and the CAN-FAIL -- planted single-byte data corruption with frames agreeing still raises, naming the data. * flip family (test_phase_flip_runtime, _protocol, _plan, _boot, _seam_reserve, _round_cadence_631, _resident_carry, test_kv_reshard, the new file): 231 passed, 0 failed. * two pre-existing tests were pinning the old mechanism (test_can_fail_abort_applied_on_one_rank_mid_flip, test_can_fail_batch_membership_disagreement). Their binding property is "detected, refused, never silently commits"; they now assert the stronger outcome the ballot gives -- no rank raises, every rank books frame_aborts, and NOT ONE BYTE moved on any rank, which the old version did not require. * unit/managers regression baseline: 12 failed / 66 passed / 2 skipped on both the base commit cd71ec3 and this branch, identical. Untouched. Metal proof (flip soak, 0 KvReshardError) is the next stage and is NOT claimed here.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 13, 2026
…nical family list, and correct the register R8 had just fixed the fourth under-collection of this list -- six sgl-project#656 test files added without extending it, so the family total sat green while the seam sizer that replaced the 620000-token quarantine constant was collected by nothing. Adding two files and the list entry in the SAME commit is the cheapest way not to be the fifth. * test_flip_frame_agreement_656.py -- register C22's root cause, with the red arm that reproduces the metal signature on a CPU desk. * test_corridor_threshold_pair_656.py -- the corridor law and the gate's arming floor as ONE declared pair, plus the pin that stops a private 1024 literal creeping back into an instrument that audits the gate. Register corrections, both from this shift's evidence: * C22-b: the PHASE-FLIP checksum mismatch is a MISREPORT, not a data divergence -- the "sender" fields it named cannot be uint8 sums (one is negative). Root cause is an unagreed wire frame. This UNIFIES the two incidents rather than replacing one: sgl-project#657's steering re-sorts the free list on a private clock, which changes a rank's frame, so the steering was a TRIGGER and disabling it removed the trigger and not the defect. * C21-b: the corridor breach is at a C20 entry-margin YIELD on the rank that owns the breaching card, not a steady-state sizing shortfall -- and the acceptance's "give rank0 200-300 MiB back" names the wrong rank, because by C21's own card rule rank0 is the 5090 and never came near the law. TEST RESULTS: scripts/run_631_flip_family.sh -- 1187 passed, 7 skipped (1169 + 18 from the two added files), against R8's 1169 baseline on the same runner. No test changed status.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 13, 2026
…r yield, and two diagnoses Covers the two instance-level failures and the two diagnoses this shift owns, with the numbers already recorded and the empty-completion rate to be appended when its probe run finishes. The four findings a successor should not have to re-derive: * C22's message was a MISREPORT and the log carried its own falsifier -- the "sender" fields cannot be uint8 sums (one is negative). Root cause is an unagreed wire frame, which UNIFIES the sgl-project#657 steering incident (a trigger) with the acceptance's (another trigger). * The corridor breach follows a C20 entry-margin YIELD, 5 of 5, on the rank that owns the breaching card. The acceptance's "give rank0 200-300 MiB back" names the wrong rank -- by register C21's own card rule rank0 is the 5090, minimum free 1941 MiB. * Idle-vacate cannot be fixed by a recipe: --enable-kv-session-offload is refused outright under pp_size>1, so no argv produces vacate lines on a flip boot. * The acceptance's bracket for the empty completion is CONFOUNDED by the radix cache; only its first probe was a cold prefill, and that one failed. And two pieces of arithmetic that change how the next run is read: * a clean flip soak of 180-220 cutovers happens 50-57% of the time even if C22 were untouched, so this shift's soak is a NO-REGRESSION result and the proof of the fix is the desk red arm. The acceptance's own 320 cutovers had 37% power. * the seam cost model is ~3.8x low on the binding rank (484 MiB modelled, ~1830 MiB drawn); this shift raised the resting level rather than fixing the model, and says so. Evidence: /spinning/evidence-631/remediation-656/ -- corridor_yield_correlation.txt, seam_model_vs_measured.txt, c22_soak_power.txt, corridor_breach_profile.txt. TEST RESULTS carried from the commits this documents: family scripts/run_631_flip_family.sh 1201 passed / 7 skipped (R8 baseline 1169); test_flip_frame_agreement_656.py 10 passed including the red arm and the planted-corruption can-fail; test_corridor_threshold_pair_656.py 11 passed; test_seam_margin_selfcal_656.py 11 passed; test_corridor_trace_605.py 8 passed. Metal boot_m1: pool 578390 derived, 0 KvReshardError, 0 corridor samples below the law on three cards.
efschu
added a commit
to efschu/htsglang
that referenced
this pull request
Aug 17, 2026
… stub under the bugs-first order Neither verdict is finished; the absorption mapping both turn on is the undone part. Parked rather than polished so the resume starts from the evidence instead of from scratch. Two findings worth not losing: sgl-project#363's own ACT verdict R3 postdates the sgl-project#656/sgl-project#657/sgl-project#658 successors and still did not close, and the per-rank ms/round ladder floated as its successor scope already exists and already answered NEGATIVE (-3.16 % inside a 4.43 % band). For sgl-project#584, auto-measurement and a mechanically enforced single authority look delivered; dynamic recalculation is the unresolved pillar. Both qwen sweeps were stopped by the same order before returning findings, so this is desk evidence only.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 26, 2026
…s pick the card by fill User 26.09. ~09:40Z/09:45Z: "es muss dynamisch sein ... den kv so zu verteilen wie er optimal schnell ist zur jeweiligen 'fuelle'". Design: DYN_D_RESHARD.md sec. 13. Under weighted uneven DCP a token's owner is a pure function of its global slot id (layers/dcp/owner.py) and attention/LSE merge read each rank's tokens off out_cache_loc, so the allocator picks the card when it picks the id. The installed token vector (pool shape, compact slots, HiCache owner bounds) is untouched and no stored KV moves: only the ORDER of the replicated free list changes -- the weighted generalisation of the sgl-project#656/sgl-project#657 owner bias. weg2/d_token_placement.py (pure): placement_weights (per-rank deficit against the effective-bandwidth share 937/604/604 of used + 2 % look-ahead while every class stays under fill_switch 0.85, else weights proportional to free slots), weighted_interleave (stable sort on (rank-in-class + 1/2)/w: every prefix draws in proportion, capacity fallback by construction), OwnerPlacement (class bounds read from the INSTALLED token vector at every apply), arm_on_allocator (refuses next to SGLANG_CORRIDOR_STEERING / an owner bias and for page_size != 1). allocator base: set_owner_placement/_apply_owner_placement, re-applied by merge_and_sort_free and at once by clear (cutover re-entry); paged/token alloc paths tick (every 32 calls after frees washed the head). model_runner arms it only on the uneven-DCP allocator and only with SGLANG_WEG2_D_TOKEN_PLACEMENT. launcher: --d-token-placement (default capacity: no env), --d-token-shares, --d-token-fill-switch; NF profile refused. Tests (CPU, test27b.sh): test_weg2_d_token_placement_0926.py 18/18 (interleave proportions/permutation/stability/fallback, exact class totals, policy regimes, paged+token allocators follow 0.437 +-1 %, re-apply after frees and clear, never fail what the plain list serves, replicated allocators identical over 60 steps, refusals, DCP LSE merge over ANY slot ownership == full attention 1e-10, launcher default no env / bandwidth env / NF refused); test_weg2_d_reshard_0926.py 26/26. Allocator-affected suites (corridor_steering_657, kv_session_offload, swa, hisparse, prefetch, mamba, idle census, vram dial, ...): 390 passed; red only test_r1_private_constant_gate_584, test_stock_dcp_allocator_reach_487 (draft producers), test_protected_residue_orphaned_938 x2 -- all red on 103712c too.
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.
Motivation
as titled cc @merrymercy @Ying1123 @hnyls2002
I have removed most of the unnecessary features based on the vllm benchmark. I will land the part about TensorRT LLM in another PR.
tested on A100 80G with runpod
Modification
/v1/modelsChecklist
pre-commit run --all-filesor other linting tools are used to fix potential lint issues.