Skip to content

docs: update README - #692

Merged
zhyncs merged 1 commit into
sgl-project:mainfrom
zhyncs:doc
Jul 21, 2024
Merged

zhyncs merged 1 commit into
sgl-project:mainfrom
zhyncs:doc

Conversation

@zhyncs

@zhyncs zhyncs commented Jul 21, 2024

Copy link
Copy Markdown
Contributor

Motivation

ref #691

Modification

as titled

Checklist

  1. Ensure pre-commit pre-commit run --all-files or other linting tools are used to fix potential lint issues.
  2. Confirm that modifications are covered by complete unit tests. If not, please add more unit tests for correctness.
  3. Modify documentation as needed, such as docstrings or example tutorials.

@zhyncs
zhyncs merged commit 7b59747 into sgl-project:main Jul 21, 2024
@zhyncs
zhyncs deleted the doc branch July 21, 2024 17:41
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
cherryblo added a commit to cherryblo/sglang-project that referenced this pull request Jul 2, 2026
Update test_ascend_qwen3_next_80b_w8a8_2p_in6k_out1k5_bs16.py
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…mall flip and unmeasured

THE MEASUREMENT, from 291 same-regime PHASE-FLIP DONE lines (and 3955 unique
across all logs). The part NOT covered by read+exchange+write is:

    123 live slots     total 2453 ms   unaccounted 1999 ms   81 %
    440095 live slots  total 4290 ms   unaccounted 2287 ms   53 %

FLAT at 2.0-2.35 s across a 3600x range of occupancy (123 -> 440095 live slots,
708 -> 3.4M cells). Regressed: unaccounted ~ live slots has slope 0.0005 ms/slot
and R2 0.255 -- i.e. it barely correlates with size at all, which is what makes
it a fixed cost rather than a small-flip artefact. Total ~ live slots gives
intercept 2754 ms, R2 0.871.

So the fixed cost, not the movement, is what floors every window sgl-project#677's
economics can solve, and it is the term sgl-project#692 must price depth against.

WHERE IT WAS HIDING, and I had it wrong first. My initial reading blamed the
per-wave backing swap (release_wave/restore_wave). It is NOT the residual:
`t_write0` is taken BEFORE those calls and `write_ms` accumulates after them,
so the backing swap has been inside `write_ms` all along. Reading the timer
placement rather than the call order is what corrected it.

The three timers cover the WAVE LOOP ONLY. What fell outside is the tail:

    _pool_census("pre-cutover")                    phase_flip_runtime.py:6538
    for fn in self._pre_cutover_fns: fn(...)       :6539-6544  EXTRA MOVERS --
                                                   the weights arena refill and
                                                   the GDN state leg
    _cutover_fn(direction)                         :6545       the group step
    _pool_census("post-cutover")                   :6547

THE MOVERS ARE OCCUPANCY-INDEPENDENT BY CONSTRUCTION -- the weights arena
refill is the same bytes whatever the KV live set holds -- which is the leading
explanation for a residual that does not move with occupancy. That is a
hypothesis this commit makes MEASURABLE rather than one it asserts.

SO THE TAIL IS TIMED, split movers vs cutover because they have different
fixes, and both are reported on the DONE line and in `last_stats`. A residual
that has to be regressed across boots cannot be priced per flip; a reported
number can, and sgl-project#677/sgl-project#692 both need it per flip.

WHAT THIS COMMIT DOES NOT DO. It does not reduce the cost. The reduction
candidate is the wave count -- `_flip_waves` (:4024) is "A PURE FUNCTION OF THE
REPLICATED LAYER MAP AND THE DIRECTION", so W=16 is paid at 123 live slots
exactly as at 440095, even though the staging transient waves exist to bound is
trivial there. The module's own docstring already pre-authorises the landing
spot: "each extra wave costs one more exchange round trip. If a measurement
ever shows the round trips dominating, W=8 is the place to stand, not W=1"
(:4083-4089).

That A/B needs NO code: `SGLANG_FLIP_SEAM_WAVES` (:2568) already overrides W.
It is left unshipped deliberately -- lowering W trades ms for staging MiB,
which lands on the arming floor and the corridor, and sgl-project#602 showed that budget
is regime-dependent. Hard-coding a policy from one regime's numbers is the
mistake that ticket already made once.

HONEST LIMIT ON THE PER-WAVE TERM. Fitting unaccounted = a + b*W across the
W=4 and W=16 populations gives b ~ 66 ms/wave, a ~ 997 ms. That fit is
CONFOUNDED: the W=4 samples are release-first and the W=16 samples
restore-first, so it mixes wave count with regime and must not be quoted as a
per-wave price. The clean number will come from the env A/B above, within one
regime -- which is exactly what the new movers/cutover fields will report.

TESTS. 9 cases, source-level because the alternative is driving a full flip:
the movers clock opening before the pre-cutover census and closing after the
mover loop; the cutover clock wrapping the cutover; the three original timers
untouched; both fields in `last_stats` and in the DONE line. Plus an AST arity
guard on the DONE line -- specifiers counted against arguments -- because a
%-format mismatch raises at the moment the flip completes, the worst possible
place to learn it. Falsified: dropping one argument makes it report "17 format
specifiers and 16 arguments".

managers 2093 passed, 0 failed (2084 before, +9). Hermetic. NO DEPLOY.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…mall flip and unmeasured

THE MEASUREMENT, from 291 same-regime PHASE-FLIP DONE lines (and 3955 unique
across all logs). The part NOT covered by read+exchange+write is:

    123 live slots     total 2453 ms   unaccounted 1999 ms   81 %
    440095 live slots  total 4290 ms   unaccounted 2287 ms   53 %

FLAT at 2.0-2.35 s across a 3600x range of occupancy (123 -> 440095 live slots,
708 -> 3.4M cells). Regressed: unaccounted ~ live slots has slope 0.0005 ms/slot
and R2 0.255 -- i.e. it barely correlates with size at all, which is what makes
it a fixed cost rather than a small-flip artefact. Total ~ live slots gives
intercept 2754 ms, R2 0.871.

So the fixed cost, not the movement, is what floors every window sgl-project#677's
economics can solve, and it is the term sgl-project#692 must price depth against.

WHERE IT WAS HIDING, and I had it wrong first. My initial reading blamed the
per-wave backing swap (release_wave/restore_wave). It is NOT the residual:
`t_write0` is taken BEFORE those calls and `write_ms` accumulates after them,
so the backing swap has been inside `write_ms` all along. Reading the timer
placement rather than the call order is what corrected it.

The three timers cover the WAVE LOOP ONLY. What fell outside is the tail:

    _pool_census("pre-cutover")                    phase_flip_runtime.py:6538
    for fn in self._pre_cutover_fns: fn(...)       :6539-6544  EXTRA MOVERS --
                                                   the weights arena refill and
                                                   the GDN state leg
    _cutover_fn(direction)                         :6545       the group step
    _pool_census("post-cutover")                   :6547

THE MOVERS ARE OCCUPANCY-INDEPENDENT BY CONSTRUCTION -- the weights arena
refill is the same bytes whatever the KV live set holds -- which is the leading
explanation for a residual that does not move with occupancy. That is a
hypothesis this commit makes MEASURABLE rather than one it asserts.

SO THE TAIL IS TIMED, split movers vs cutover because they have different
fixes, and both are reported on the DONE line and in `last_stats`. A residual
that has to be regressed across boots cannot be priced per flip; a reported
number can, and sgl-project#677/sgl-project#692 both need it per flip.

WHAT THIS COMMIT DOES NOT DO. It does not reduce the cost. The reduction
candidate is the wave count -- `_flip_waves` (:4024) is "A PURE FUNCTION OF THE
REPLICATED LAYER MAP AND THE DIRECTION", so W=16 is paid at 123 live slots
exactly as at 440095, even though the staging transient waves exist to bound is
trivial there. The module's own docstring already pre-authorises the landing
spot: "each extra wave costs one more exchange round trip. If a measurement
ever shows the round trips dominating, W=8 is the place to stand, not W=1"
(:4083-4089).

That A/B needs NO code: `SGLANG_FLIP_SEAM_WAVES` (:2568) already overrides W.
It is left unshipped deliberately -- lowering W trades ms for staging MiB,
which lands on the arming floor and the corridor, and sgl-project#602 showed that budget
is regime-dependent. Hard-coding a policy from one regime's numbers is the
mistake that ticket already made once.

HONEST LIMIT ON THE PER-WAVE TERM. Fitting unaccounted = a + b*W across the
W=4 and W=16 populations gives b ~ 66 ms/wave, a ~ 997 ms. That fit is
CONFOUNDED: the W=4 samples are release-first and the W=16 samples
restore-first, so it mixes wave count with regime and must not be quoted as a
per-wave price. The clean number will come from the env A/B above, within one
regime -- which is exactly what the new movers/cutover fields will report.

TESTS. 9 cases, source-level because the alternative is driving a full flip:
the movers clock opening before the pre-cutover census and closing after the
mover loop; the cutover clock wrapping the cutover; the three original timers
untouched; both fields in `last_stats` and in the DONE line. Plus an AST arity
guard on the DONE line -- specifiers counted against arguments -- because a
%-format mismatch raises at the moment the flip completes, the worst possible
place to learn it. Falsified: dropping one argument makes it report "17 format
specifiers and 16 arguments".

managers 2093 passed, 0 failed (2084 before, +9). Hermetic. NO DEPLOY.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…eite, nicht Abwesenheit von Warten

NUTZER-FANG 2026-08-30, woertlich: "aber wenn die 5090 12,035.0ms computed
und die 3080er 30, dann sollte da doch ein wait von 18 sein und nicht 0?"
Die Frage ist richtig, meine Meldung war falsch gerahmt. Das korrigiert
acac781 (dieser Strang, heute) UND die §2-Rahmung des Handovers.

WAS DAS FELD WIRKLICH MISST -- am Produzenten gelesen, nicht interpretiert:
scheduler_components/metrics_reporter.py:466-472
    args += [max(gpu_s - wait_s, 0.0) * 1000.0, wait_s * 1000.0]
mit dem Kommentar darueber (:468-470): "the collective spans are measured
INSIDE THE FORWARD WINDOW". Also:
  gpu_s   = das Forward-Fenster dieses Rangs
  wait_s  = Summe der KOLLEKTIV-Spannen INNERHALB dieses Fensters
  compute = gpu_s - wait_s
`wait` ist damit NCCL-Zeit INNERHALB eines Forwards -- NICHT Leerlauf
zwischen Forwards. Ein PP0, der seine Layer-Scheibe frueh fertig hat und auf
den naechsten Microbatch wartet, ist ausserhalb des Forward-Fensters: die
Zeit ist nie in gpu_s, kann also strukturell nie in wait erscheinen. Eine
Null dort ist eine Eigenschaft der Fenstergrenze, keine Aussage ueber
Pipeline-Leerlauf. Klasse `instrument-text-luegt` (A: der Text beschreibt
nicht, was das Instrument tut) -- dritter Fall an einem Tag.

WAS ICH ZU BREIT BEHAUPTET HABE: "wait 0,0 auf 105/105 Samples -> die
Kollektiv-Boden-These ist falsifiziert". Zulaessig ist nur die schmale
Fassung: INNERHALB der Forward-Fenster liegt keine messbare Kollektivzeit.
Ueber den Bubble sagt das nichts, und ich habe es so praesentiert, als
warteten die Raenge ueberhaupt nicht.

WO DIE ~18 s TATSAECHLICH LIEGEN -- unabhaengig gemessen, Chunk-Grenz-
Zerlegung desselben Logs (Queue-Posten 3, Desk-Haelfte), 39 Chunks/Rang,
Intra-Request-Grenzen (Request-Grenzen > 5 s ausgeschlossen und gezaehlt):

  Rang   compute    Intra-Req-Gap        compute+gap
  PP0    13.96 s    23.18 s  (n=29)      37.14 s
  PP1    35.63 s     6.62 s  (n=14)      42.25 s
  PP2    32.60 s     9.23 s  (n=16)      41.83 s

Genau die vom Nutzer vorhergesagte Groesse, nur unter anderem Namen
verbucht: PP0 hat den GROESSTEN Gap und die kleinste Compute-Zeit. Die
Compute-Differenz PP1-PP0 = 21.67 s steht der Gap-Differenz PP0-PP1 =
16.56 s gegenueber -- gleiche Groessenordnung, umgekehrtes Vorzeichen. Und
compute+gap ist ueber die Raenge fast gleich (37.1/42.3/41.8) gegenueber
compute allein (14.0/35.6/32.6). Das ist die Lockstep-Signatur: der
Ueberschuss des schnellen Rangs erscheint als Chunk-Gap.

SCHRANKE DER ZAHLEN, benannt statt geglaettet: von 38 Grenzen je Rang
fielen bei PP1 16 und bei PP2 14 auf einen NEGATIVEN Gap (Compute laenger
als der Wanduhr-Abstand der Log-Zeilen = ueberlappende Forwards) und sind
ausgeschlossen. Der Gap ist damit fuer die Pacer-Raenge UNTERSCHAETZT und
fuer PP0 (0 negative Grenzen) vollstaendig. Die Richtung des Befunds wird
dadurch nur staerker, nicht schwaecher.

FOLGE FUER sgl-project#769: die "44 % unattributed" sind zu einem grossen Teil KEIN
mysterioeser Overhead, sondern der PP-Bubble -- und er ist messbar, nur
nicht ueber das wait-Feld. Damit ist Queue-Posten 3 desk-seitig beantwortet
und der sgl-project#692-Arm (pp_async_batch_depth) hat eine Zielgroesse.

BELEG-STUFE: DESK-BEWIESEN am Produzenten-Code (file:line oben) +
BOOT-GEMESSEN an der Gap-Zerlegung
(boot_855_makespan_0840f82601_0830_093650.log, n=39 Chunks/Rang).
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.

1 participant