Skip to content

Fix benchmark latency - #1007

Merged
merrymercy merged 1 commit into
mainfrom
fix-bench-latency
Aug 9, 2024
Merged

merrymercy merged 1 commit into
mainfrom
fix-bench-latency

Conversation

@wisclmy0611

Copy link
Copy Markdown
Collaborator

No description provided.

@merrymercy
merrymercy merged commit 6172888 into main Aug 9, 2024
@merrymercy
merrymercy deleted the fix-bench-latency branch August 9, 2024 20:19
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 29, 2026
Boot 66's forensics: rid 6f9d8c6e, prefix_lens=0 fill_lens=3 out_lens=0, one
ADMIT, no retraction, no chunk -- a 3-token first-pass prefill, which is
literally the "Say OK." hand probe. It reached the DECODE graph runner with
raw_bs=1, was accepted, and died one frame later as
`input_ids: dst(1,) <- src(3,)`. Every short prompt does this, health checks
included, which is why every boot of this window died on its first real
request.

The predicate is the reason. Every verdict in can_run_graph reasons about
BATCH SIZE -- `cuda_graph_bs = forward_batch.batch_size`, then
`cuda_graph_bs <= self.max_bs` -- and none asks how many tokens each sequence
carries. The captured graph fixes that separately as num_tokens_per_bs, and
load_batch derives every buffer width from it. Right bs, wrong tokens per
sequence: accepted here, fatal there. The same axis confusion the runner has,
one level up.

So the guard rejects on the axis that was never read, and the batch runs eager
instead of failing in a copy.

WHAT THIS DELIBERATELY DOES NOT CLAIM: it is not the whole root. is_cuda_graph()
admits DECODE, TARGET_VERIFY, IDLE and DLLM_EXTEND, and which of those this
3-token prefill claims to be cannot be settled from the boot-66 log -- the mode
is not printed anywhere near the crash. Guessing it would be the half-chain fix
I stopped short of last round. The guard prints forward_mode, so the next boot
names it: DECODE means the classification is wrong upstream; an EXTEND mode
means is_cuda_graph() admits a mode this runner cannot serve. Then the root
gets cut on a reading instead of a hunch.

The line is not optional (sgl-project#967): a silent return False would leave it
unmeasurable whether this ever fires, and this one carries the measurement the
root still needs.

Evidence: desk, executed. py_compile; the guard is the first verdict in the
function, ahead of every existing branch, and emits once per refusal.
Belegstufe: DESK-BEWIESEN -- the metal proof is the probe returning tokens.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 29, 2026
…fill has not returned

Three boots of forensics land on one invariant. A request that has never
produced an output token has nothing to decode from, and decoding it anyway is
what has been killing this window's boots on their first short prompt.

The chain, measured end to end: get_next_batch_to_run makes a freshly built
PREFILL batch the running batch in the same breath. Upstream that holds --
without PP the prefill runs in the same round, so output_ids is non-empty by
the time update_running_batch sees it. The seam is stock, every commit
touching it is an upstream PR (sgl-project#29408, sgl-project#22131, sgl-project#20343, sgl-project#14320, sgl-project#17484,
sgl-project#14883), none of ours, so there is nothing to revert. PP=3 widens it: the
result comes back several passes later while membership was granted
immediately, and with one short request and no other traffic the next round
has nothing else to do and decodes it first. prepare_for_decode then leaves
the prefill input_ids in place -- there is no last token to embed -- and the
batch travels on labelled DECODE while carrying extend tokens.

Boot 67 read every link: rid e463acc5, prefix_lens=0 fill_lens=3 out_lens=0,
one ADMIT, no retraction, and no void at all (797_void=0, 798_void=0, so the
void explanation is excluded). It surfaced first as forward_mode=2 with
batch_size=1 and input_ids=3 through the sgl-project#1007 probe, then as
"causal_conv1d_update: conv_state_indices has 1 entr(ies) for a batch of 3".
Every short prompt does this, health checks included; long chunked prompts
under continuous load never reach the state, which is exactly why it stayed
latent behind every other defect this window.

So the hold sits where decode eligibility is decided, not on a consumer. The
requests are neither dropped nor reset: they stay in the running batch and
become eligible the moment their prefill result lands, and filter_batch's
keep_indices keeps the parallel tensors consistent rather than reseating reqs
by hand.

The counter is cumulative on purpose (INDIKATOR-GESETZ): a held_total that
never grows means the class no longer occurs, one that grows without bound
means results are not landing at all. Those are different diagnoses and a
per-call line could not tell them apart.

Evidence: desk, executed. py_compile; the condition sits inside
update_running_batch ahead of prepare_for_decode, and the counter is written
once and read twice. Belegstufe: DESK-BEWIESEN -- BOOT-BEWIESEN only once the
3-token probe returns tokens.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…eport-only-Vorstufe)

== BEFUND, DER DIESEN SCHNITT AUSLOESTE ==
`initialize_decoupled_kv_group` (parallel_state.py:3676) hatte NULL Aufrufer im
ganzen Baum -- praesent-aber-unverdrahtet. Zwei Quellen: devindex symbol_profile
meldet 0 aufgeloeste Caller UND 0 textuelle Reads; die Volltext-Gegenprobe ueber
python/ findet ausserhalb von parallel_state.py nur einen Doku-String in
mem_ledger/engine.py:678.

Gleichzeitig gated `SGLANG_DECOUPLED_KV` bereits die POOL-Haelfte
(model_runner_kv_cache_mixin.py:3352). Genau diese Asymmetrie IST die
sgl-project#1007-Booby-Trap: die Pool-Haelfte zu armen dimensionierte einen Plan fuer eine
Gruppe, die nie gebaut wurde.

`refuse_pp_dcp_combination` (:3653) benennt diese Gruppe im eigenen
Refusal-Text als den designierten Weg ("For token-sharded KV under PP use the
#704b decoupled-KV group"). Die Sperre bleibt unberuehrt: sie verweigert das
stille Vehikel (dcp_size ueberladen), nicht die Faehigkeit.

== WAS DIESER SCHNITT TUT ==
(a) Aufrufer in ModelRunner.init_torch_distributed, an derselben Stelle und aus
    demselben Grund wie der sgl-project#631-Flip-Block darueber: der Create ist ein
    KOLLEKTIV, also muss das Erreichen rang-uniform sein -- ein Server-Arg ist
    das per Konstruktion. Vor der sgl-project#605-Flight-Recorder-Marke, damit die
    NCCL-Bilanz diese Kommunikatoren mitzaehlt.
(c) `--enable-decoupled-kv`, DEFAULT AUS.

Er baut die Gruppe und SONST NICHTS. `set_decoupled_kv_active` wird bewusst
NICHT gerufen, `_DECOUPLED_KV_ACTIVE` bleibt False, die B1-Verzweigung in
`get_dcp_group` (:2854) bleibt tot, die Pool-Haelfte ist nicht angefasst.
Report-only-Vorstufe: die Gruppe existiert, liest sie aber niemand.

== EIN PASSENDER DESK-CHECK (Fehlerklasse: Flag-Registrierung + Rangplan) ==
py_compile waere hier blind gewesen. Geprueft wurde stattdessen:
  1. Flagge als dataclass-Feld registriert, Default False          -> True/False
  2. plan_decoupled_kv_ranks(w=3,tp=1,pp=3) = [[0,1,2]]  (Flip-Form)
  3. plan_decoupled_kv_ranks(w=3,tp=3,pp=1) = [[0],[1],[2]] (pure TP, degeneriert
     korrekt: B1 ist ein PP-Mechanismus)
  4. CLI akzeptiert --enable-decoupled-kv                          -> ACCEPTED

== BOOT-BEWEIS (boot_855_704bgroup2_0840f82601_0830_165321) ==
  * "#704b decoupled-KV group built over pipeline ranks [[0, 1, 2]]" auf ALLEN
    DREI Raengen (PP0/PP1/PP2) -- Manifest-Gleichheit hielt
  * "manifest DIVERGES"-Refusal: 0
  * "initialize_decoupled_kv_group was never called"-Assert: 0
  * `set_decoupled_kv_active` trapsafe bare 0 / genuine 0 -> Routing nie gearmt
  * Serving liefert: "capital of France is" -> " Paris. Paris is the largest"

ERSTER BOOT-VERSUCH SCHEITERTE EHRLICH und ist Teil des Befunds:
Bar1WindowRefused -- die neue Gruppe 'decoupled_kv:0' erbte das
24-MiB-Default-Fenster, waehrend nur 12 MiB BAR1 frei waren (world 23 + pp 95 +
flip_tp 47 + flip_dcp 31 bereits gehalten). Das Refusal ist KORREKT ("an
explicit window is an instruction ... silently serving a smaller one would make
every later size decision rest on a number nobody chose"). Behoben durch ein
eigenes Fenster DECOUPLED_KV_0=8, nicht durch Abschalten von barlink.
Merkposten fuer jeden weiteren Gruppenbau auf dieser Form: BAR1 ist mit ~196
MiB in vier Gruppen nahezu erschoepft.

BELEG-STUFE: BOOT-BEWIESEN, dass die Gruppe auf allen Raengen entsteht und das
Serving unveraendert laeuft. NICHT behauptet: dass token-gesharde KV unter PP
damit funktioniert -- die Pool-Haelfte liest weiterhin dcp_size/attn_dcp_rank
(unter PP 1 und 0) und ist der naechste, separate Schnitt (b), der ohne GO
nicht gebaut wird.
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