Skip to content

fix: temporary solution for DeepSeek V2 H100 layout conversion issue - #1060

Merged
zhyncs merged 2 commits into
sgl-project:mainfrom
zhyncs:fix
Aug 13, 2024
Merged

zhyncs merged 2 commits into
sgl-project:mainfrom
zhyncs:fix

Conversation

@zhyncs

@zhyncs zhyncs commented Aug 12, 2024 •

Copy link
Copy Markdown
Contributor

Motivation

fix #913

eval with Llama 3.1 8B Instruct gsm8k and it works well

python3 -m sglang.launch_server --model-path meta-llama/Meta-Llama-3.1-8B-Instruct --port 30000 --trust-remote-code --disable-radix-cache --disable-flashinfer
Macro average 0.8468536770280516
Meta Macro average 0.844579226686884
Micro average 0.8468536770280516
Meta Micro average 0.844579226686884

tested with DeepSeek V2 Lite

python3 -m sglang.launch_server --model-path deepseek-ai/DeepSeek-V2-Lite --port 30000 --trust-remote-code --disable-radix-cache --enable-mla
============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Successful requests:                     1000
Benchmark duration (s):                  60.98
Total input tokens:                      236142
Total generated tokens:                  215614
Total generated tokens (retokenized):    215378
Request throughput (req/s):              16.40
Input token throughput (tok/s):          3872.26
Output token throughput (tok/s):         3535.64
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   25694.61
Median E2E Latency (ms):                 22902.73
---------------Time to First Token----------------
Mean TTFT (ms):                          5935.37
Median TTFT (ms):                        5716.50
P99 TTFT (ms):                           10970.98
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          237.18
Median TPOT (ms):                        109.77
P99 TPOT (ms):                           1610.97
---------------Inter-token Latency----------------
Mean ITL (ms):                           94.47
Median ITL (ms):                         70.81
P99 ITL (ms):                            272.62
==================================================

Modification

Briefly describe the changes made in this PR.

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 self-assigned this Aug 12, 2024
@zhyncs zhyncs changed the title fix: tmp resolve deepseek v2 h100 layout issue fix: temporary solution for DeepSeek V2 H100 layout conversion issue Aug 12, 2024
@zhyncs zhyncs changed the title fix: temporary solution for DeepSeek V2 H100 layout conversion issue fix: temporary solution for DeepSeek V2 Lite H100 layout conversion issue Aug 12, 2024
@zhyncs

zhyncs commented Aug 12, 2024

Copy link
Copy Markdown
Contributor Author

DeepSeek V2 H100 TP8

============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Successful requests:                     1000
Benchmark duration (s):                  165.44
Total input tokens:                      236142
Total generated tokens:                  215614
Total generated tokens (retokenized):    215058
Request throughput (req/s):              6.04
Input token throughput (tok/s):          1427.38
Output token throughput (tok/s):         1303.30
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   72001.17
Median E2E Latency (ms):                 72469.93
---------------Time to First Token----------------
Mean TTFT (ms):                          40396.57
Median TTFT (ms):                        28940.14
P99 TTFT (ms):                           99405.52
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          178.97
Median TPOT (ms):                        160.95
P99 TPOT (ms):                           559.55
---------------Inter-token Latency----------------
Mean ITL (ms):                           149.20
Median ITL (ms):                         111.16
P99 ITL (ms):                            398.63
==================================================


============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Successful requests:                     5000
Benchmark duration (s):                  777.04
Total input tokens:                      1187865
Total generated tokens:                  1089941
Total generated tokens (retokenized):    1087011
Request throughput (req/s):              6.43
Input token throughput (tok/s):          1528.70
Output token throughput (tok/s):         1402.68
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   358316.01
Median E2E Latency (ms):                 365857.50
---------------Time to First Token----------------
Mean TTFT (ms):                          320752.33
Median TTFT (ms):                        323528.82
P99 TTFT (ms):                           670386.93
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          176.45
Median TPOT (ms):                        176.47
P99 TPOT (ms):                           272.25
---------------Inter-token Latency----------------
Mean ITL (ms):                           175.99
Median ITL (ms):                         128.65
P99 ITL (ms):                            517.99
==================================================

@zhyncs zhyncs changed the title fix: temporary solution for DeepSeek V2 Lite H100 layout conversion issue fix: temporary solution for DeepSeek V2 H100 layout conversion issue Aug 13, 2024
@zhyncs
zhyncs merged commit 65915f9 into sgl-project:main Aug 13, 2024
@zhyncs
zhyncs deleted the fix branch August 13, 2024 05:48
@zhyncs

zhyncs commented Aug 13, 2024

Copy link
Copy Markdown
Contributor Author

Potential issues, on the H100 other models if can be 128 128, here it was directly changed to 128 64, there might be performance degradation, need to verify and fix.

@zhyncs

zhyncs commented Aug 13, 2024

Copy link
Copy Markdown
Contributor Author
python -m sglang.launch_server --model-path meta-llama/Meta-Llama-3.1-8B-Instruct --enable-torch-compile --disable-radix-cache --disable-flashinfer
python3 -m sglang.bench_serving --backend sglang --dataset-name random --num-prompts 1000 --random-input 8192 --random-output 8
# latest main
============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Successful requests:                     1000
Benchmark duration (s):                  146.91
Total input tokens:                      4064944
Total generated tokens:                  3930
Total generated tokens (retokenized):    4038
Request throughput (req/s):              6.81
Input token throughput (tok/s):          27670.26
Output token throughput (tok/s):         26.75
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   86202.47
Median E2E Latency (ms):                 84699.32
---------------Time to First Token----------------
Mean TTFT (ms):                          73186.68
Median TTFT (ms):                        72622.70
P99 TTFT (ms):                           144514.07
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          4225.82
Median TPOT (ms):                        4279.84
P99 TPOT (ms):                           9710.69
---------------Inter-token Latency----------------
Mean ITL (ms):                           4277.28
Median ITL (ms):                         4344.91
P99 ITL (ms):                            15263.60
==================================================

# v0.2.12
============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Successful requests:                     1000
Benchmark duration (s):                  156.92
Total input tokens:                      4064944
Total generated tokens:                  3930
Total generated tokens (retokenized):    4038
Request throughput (req/s):              6.37
Input token throughput (tok/s):          25905.22
Output token throughput (tok/s):         25.05
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   93430.57
Median E2E Latency (ms):                 93655.56
---------------Time to First Token----------------
Mean TTFT (ms):                          79686.68
Median TTFT (ms):                        79479.00
P99 TTFT (ms):                           155250.13
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          4289.53
Median TPOT (ms):                        4592.39
P99 TPOT (ms):                           8525.07
---------------Inter-token Latency----------------
Mean ITL (ms):                           4516.55
Median ITL (ms):                         4983.82
P99 ITL (ms):                            13701.18
==================================================

@zhyncs

zhyncs commented Aug 13, 2024

Copy link
Copy Markdown
Contributor Author

env

Python: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
CUDA available: True
GPU 0: NVIDIA H100 80GB HBM3
GPU 0 Compute Capability: 9.0
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 12.1, V12.1.105
CUDA Driver Version: 550.54.15
PyTorch: 2.4.0+cu121
flashinfer: 0.1.4+cu121torch2.4
triton: 3.0.0
transformers: 4.44.0
requests: 2.32.3
tqdm: 4.66.5
numpy: 1.26.3
aiohttp: 3.10.3
fastapi: 0.112.0
hf_transfer: 0.1.8
huggingface_hub: 0.24.5
interegular: 0.3.3
packaging: 23.2
PIL: 10.2.0
psutil: 5.9.8
pydantic: 2.8.2
uvicorn: 0.30.5
uvloop: 0.19.0
zmq: 24.0.1
vllm: 0.5.4
multipart: 0.0.9
openai: 1.40.6
anthropic: 0.33.1
NVIDIA Topology:
        GPU0    NIC0    NIC1    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PXB     PXB     52-103,156-207  1               N/A
NIC0    PXB      X      PIX
NIC1    PXB     PIX      X

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

NIC Legend:

  NIC0: mlx5_0
  NIC1: mlx5_1


ulimit soft: 1048576

timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
hhhh1252023 pushed a commit to hhhh1252023/sglang_public that referenced this pull request Jul 28, 2026
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…asure WHY, with a denominator

Boot 29 re-admitted the same four requests nine to thirteen times each and 714 of
771 `#969B READMIT-MATCH` lines carried ` host_hit=0`, so every lap re-prefilled
~33k tokens to buy one output token. The standing user design
(Cutover-Full-Reset-Re-Entry, 2026-08-28) is "flip = zero everything, re-admit by
HiCache READ" -- which PRESUPPOSES the host/storage copy survives the flip. It
does not, and three candidates look identical downstream (an empty
prefix_indices): the device tree was dropped and nothing re-read; the host pool
was cleared (`sgl-project#905 HOST-POOL CLEAR`, 63 times against 51 flips, emitted one line
BEFORE the RESIDENTS RELEASED line that promises the read-through); or the
storage tier was never consulted.

THE DISCRIMINATOR IS THE CLEAR EPOCH ACROSS TWO CONSULTS OF THE SAME RID, not
the tier states at one instant. `clear_between > 0` on an empty match says a
host-pool clear fell between that rid's previous consult and this one;
`no_clear_between` REFUTES the clear for that observation. The counter-evidence
that makes this a measurement rather than a confirmation is already in boot 29:
54 re-admissions DID recover (host_hit=28297) and prefetch_registration does not
correlate with recovery (HIT/False=40, HIT/True=17, MISS/False=666, MISS/True=48).

DENOMINATOR LAW IN THE SHAPE, not in the memory: every observation increments
`seen` and EXACTLY ONE outcome bucket; the tier flags are counted independently
beside them so overlapping causes stay visible instead of a decision tree eating
them; an unreadable probe increments `probe_unreadable` rather than silently
scoring a tier absent. Emission inherits #1058b's lesson rather than re-learning
it: wall-clock cadence plus unconditional emission at teardown and on the
scheduler's death path, so `seen=0` is a printed measurement ("the consult was
never reached on this rank") and not a missing line.

REACHABILITY IS NOT ASSUMED: the census sits behind the same SEAM_READMIT_ATTR
guard as `#969B READMIT-MATCH`, which emitted 771 lines on boot 29. Present AND
populated, argued from a measured line count rather than from the code shape --
the check sgl-project#1059 did not make.

MATCHED CHECK for this edit's failure class (an instrument that is wired and
never executes, or an emitter gated on an observation count -- both invisible to
py_compile and to an import smoke): the census arithmetic is driven directly,
asserting one-bucket-per-observation, the clear-epoch discriminator on all three
of its states, the unreadable-probe path, the seen=0 print, and a
DANGER-DIRECTION MUTANT (drop the per-rid epoch stamp -> every empty match scores
clear_unknown and both real buckets stay 0). 6/6 green, and it demonstrated it
can fail (first run red on a real assertion bug). ruff clean on the added lines.

MEASURE ONLY. Nothing is gated, refused or repaired on this boot.

Evidence: /spinning/evidence-665-f1/specimen_1059uw_boot29_prefill_loop/
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
… the epoch, not to a rank's span

Boot 30 died 1 minute into load. `#1059c` gave the row a sender for the first
time, a told prefix of 12288 arrived, and it was applied to a request the cutover
had just re-admitted -- whose pinned span was legitimately 0, because that same
cutover dropped the tree one line earlier (`RESIDENTS RELEASED ... the prefix
tree dropped returning 15943 row(s)`). `uniform_pass_geometry` raised
`UniformWidthPromiseBroken` and crashed the group.

The told value was not wrong. It was STALE ACROSS A CUTOVER, and the guard's
premise -- "told <= pinned holds by construction" -- is true only WITHIN one
cutover epoch, which nothing enforced.

THE TRIGGER IS THE EPOCH AND NOT THE LOCAL SPAN, and that is the whole design.
The obvious formulation -- "void when told exceeds MY pinned span" -- reads a
RANK-LOCAL quantity and is therefore the 26th divergent input into the one
replicated decision. The guard's own message already forbids exactly that:
"compensating locally here would move the batch and reappear as sgl-project#631 on a peer."
`PhaseFlipRuntime._epoch` advances once per COMPLETED cutover on every rank and
the runtime's consensus reduction raises DESYNC if two ranks disagree, so
`row.decided_epoch != current epoch` yields the SAME verdict everywhere without
any rank consulting its own state.

  * PP0 stamps `decided_epoch` at PUBLICATION (the instant the row becomes a
    promise to the group). A relaying rank re-sends the raw row verbatim, so the
    epoch that travels the chain is PP0's.
  * The column rides at the END of the wire row under the same index-and-width
    discipline as sgl-project#987's pair and sgl-project#968's `load_back_len`. Per ENTRY, not per
    decision, because the outer payload is unpacked as a FIXED 2-arity tuple --
    growing THAT is the fixed-arity crash the row's width tolerance exists to
    avoid.
  * The apply compares against the LIVE epoch through a registered read-through
    accessor, not a cached int: boot 30's apply ran INSIDE
    `_release_residents_for_cutover`, so a value refreshed per pass would have
    been one generation stale precisely where the staleness had to be seen.
  * A mismatch (or an unverifiable half-absent pair) routes into the contract's
    OWN already-proven no-adopt path -- boot 29 ran it for its whole life without
    a divergence. That is a way ONWARD, never the boot-15 per-rank refusal that
    re-fired 1448 times and wedged the ring.
  * `UniformWidthPromiseBroken` is NOT softened. It stays as the in-epoch
    invariant's backstop and is now unreachable: if it ever fires again the pin
    itself has failed, which is a group crash by `raenge-nie-uneins`, as written.

SECOND HALF -- #1060b: THE TOLD COUNTER MOVES TO THE APPLY SITE. Boot 30 proved
the row arrives by DYING on it, while `sgl-project#1058 TOLD-VS-LOCAL CENSUS` read
`evaluated=13 absent=13` on PP0 and `evaluated=0` on the two ranks that crashed.
The census sat at the CONSULT -- and PP0 makes the offer and never receives one.
A fact's arrival must be counted where it takes EFFECT. `apply_reached` is the
denominator; `adopted>0` is the only positive proof that a row travelled AND was
applied. Emitted unconditionally at teardown and on the death path, like #1058b.

MATCHED CHECK -- red-first at the boot-30 specimen plus the mandatory
danger-direction mutant. The replay reproduces the raise with the log's own
numbers (told=12288, pin=0), so the gate is proven to be what prevents it; the
mutant asserts that the LOCAL-SPAN rule produces a SPLIT verdict across three
ranks differing only in their span while the epoch rule produces one identical
verdict -- if a future edit swaps the trigger, it goes red. Plus a wiring proof
that drives `apply_uniform_pass_geometry_1059` itself with a live epoch source,
because the pure-function tests prove the RULE and not that the apply consults
it, which is the present-wired-never-populated shape that cost boot 29 a window.
11/11 green, plus 47/47 on the existing sgl-project#1059/sgl-project#791 suites (no regression) and
6/6 on sgl-project#1060. ruff clean on the added lines, py_compile green.

Evidence: /spinning/evidence-665-f1/specimen_1060cens_boot30_uniformwidth_crash/
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…SIDE one epoch

Boot 31 ran sgl-project#1061's epoch gate and died anyway, at the same site with the same
numbers (`told prefix 12288 exceeds this rank's pinned span 0`). The census I
added in the same commit is what named the reason instead of leaving it to a
guess: `refused_epoch=0`, `epoch_ok=1` on the raising rank. The gate WAS
consulted, it AGREED, and the raise came after it.

ROOT: `PhaseFlipRuntime._epoch` advances at cutover COMPLETION, while the
destructive act -- `_release_residents_for_cutover` dropping the tree and
re-admitting the residents -- runs BEFORE completion, inside the SAME epoch. So
a row decided at epoch N is applied at epoch N during the cutover from N to N+1:
same generation, gate vacuously passes, pin legitimately 0. The staleness window
is not BETWEEN epochs, it is INSIDE one, and an epoch test cannot see it by
construction. The epoch-keying design was answerable at the desk and I did not
ask when the counter moves relative to the act it is meant to fence.

THE RETRACT IS THE EVENT. `_969ad_note_retract` is the chokepoint every
retraction passes and is called immediately before `_add_request_to_queue`, i.e.
before the apply that raised. A told row describes a prefix the request HELD; a
retraction is precisely the statement that it no longer holds it, so the row is
not stale-by-suspicion there, it is stale by definition.

STILL GROUP-UNIFORM, and measured rather than assumed: boot 31 logs
`#969AD RETRACT site=readmit_seam_residents` exactly ONCE on each of PP0, PP1 and
PP2 -- one per rank, same cutover, same rid. No rank consults its own span. Same
shape as sgl-project#946's mark, which "invalidates ITSELF on a retract or cutover".

The epoch gate STAYS. It is not wrong, it is not sufficient: it fences the
cross-cutover case that outlives a completed flip, and the retract clear fences
the in-cutover case. Both refuse into the contract's own no-adopt path, which
boot 29 ran for its whole life without a divergence.

INSTRUMENTED SO THE NEXT BOOT CANNOT REPEAT THE GUESS: the TOLD-APPLY census
gains `retract_seen` and `told_cleared_at_retract`, so "the clear fired" is a
printed number rather than an inference from an absent crash.

MATCHED CHECK, red-first at boot 31: the test drives `_969ad_note_retract`
itself, asserts the told row is gone and the counters moved, and asserts the
apply that raised on boot 31 is now a no-fact pass. 12/12 on this file, 65/65
across sgl-project#1059/sgl-project#1060/sgl-project#1061/sgl-project#791. ruff clean on added lines, py_compile green.

Evidence: /spinning/evidence-665-f1/boot_855_1061epoch_0840f82601_0831_182301.log
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…nswer their own question

sgl-project#1063 -- THE FENCE DECIDER, three states printed side by side rather than one
saldo. Both candidate roots for the 92 % empty read-through (714/771 on boot 29)
were refuted at the desk, so the next observation must separate what is left
instead of summing it:

  * present_and_readable   -- persisted at the fence and still readable now
  * complete_marker_absent -- a .part706/.slots706 with no .bin: the blob whose
    writer group never covered the last byte. `_set_canonical_slice` says it
    itself -- "a writer acting alone leaves nothing readable behind" -- and a
    cutover tearing an in-flight assembly apart is exactly that shape, forever
    invisible to every reader.
  * evicted_since_flip     -- was readable at the fence, gone at re-admission.

TWO OBSERVATION POINTS, NOT ONE, and that is the whole design: "gone now" and
"never there" are the SAME stat() and have opposite fixes. The fence snapshot is
what makes the eviction countable at all. Recorded at the fence before staging
changes anything; re-read on the sgl-project#1060 cadence, which is the only place on the
re-admission path holding a tree_cache.

sgl-project#1062 -- THE KEY TRACE MOVES TO THE FUNNEL THAT IS ACTUALLY SYMMETRIC. The #969G
probe sat on `_get_component_key`, whose comment claimed "The ONE funnel every
store key goes through, read and write alike (6 call sites)". Statically there
are FIVE sites and not one of them writes -- `_get_component_path`,
`_collect_existing_component_keys` (x2), `batch_exists_v2` (x2), all lookup or
existence. Confirmed on metal: across boot 30 the only callers it ever observed
were `_collect_existing_component_keys`, `has_component` and a `<genexpr>`.

So the instrument built to compare the re-admission's key against the retention's
key COULD NEVER SEE A WRITE KEY. Its never-observed difference was a property of
its placement. Indicator law, verbatim -- and the lying comment is replaced
rather than amended, because it is the next reader's trap.

The probe now lives on `_log_key`, which `_write_page` AND `_read_page` both
call. The rate limit is gone: the old `_n <= 60 or _n % 1024` printed 602 lines
against a population of 235520 on boot 30 (0.3 %), and an absence in that is
worth nothing. What remains is an explicit LINE CAP with its own printed
suppressed-count, so the trace stays bounded and always names its denominator.

MATCHED CHECKS for both failure classes -- a census that collapses its states,
and an instrument that never observes the direction it compares. sgl-project#1063 is driven
through a real transition (a .bin removed between the two observation points must
score evicted_since_flip=1 and NOT still_absent), and the torn-assembly case is
asserted as its own state. sgl-project#1062 is asserted at the placement level, because
placement is precisely what a behavioural call on one direction cannot show.
7/7 green. py_compile green, ruff clean on the added lines.

MEASURE ONLY. Nothing is gated, refused or repaired by either.

Order: coordinator (0a)+(0b). Evidence: boots 29/30, specimen
/spinning/evidence-665-f1/specimen_1060cens_boot30_uniformwidth_crash/
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 31, 2026
…ompensation layer, and its bugs were not the finding

Coordinator order (2), after boots 30 and 31 killed the same mechanism twice at
the same site with the same numbers (`told prefix 12288 exceeds this rank's
pinned span 0`). Upstream-minimal law: a defect found in a compensation layer is
a DELETION candidate, never a repair order for that layer. Two repairs were
already spent on it -- sgl-project#1061's epoch gate and #1061b's retract clear -- and the
second only existed because the first was built on a clock whose tick was never
checked against the act it fenced.

DELETED: `pp_uniform_width.py` whole (`uniform_pass_geometry`,
`UniformWidthPromiseBroken`, `report_local_coverage`, `min_told`, `PassGeometry`,
`epoch_admits_row`, `set_epoch_source`, `current_epoch`);
`Req.apply_uniform_pass_geometry_1059` and its call site; the
`_1059_told_prefix/_extend/_epoch` stamps; `PPAdmissionEntry.decided_epoch` and
its wire column; the publication-time epoch stamp; the epoch-source
registration; the told clearing at the retract chokepoint; the
`SGLANG_PP_UNIFORM_WIDTH` gate; three test files.

WHAT DELIBERATELY STAYED, and each for a named reason:

* THE EVICTION FLOOR in `pp_stamp_observed_coverage`. `report_local_coverage`
  was `max(0, int(x))`, but the same line ALSO raises `cache_protected_len`,
  which `mem_cache/common.py:82` honours as an eviction floor. Deleting a
  promise must not silently lower a protection, so the arithmetic is inlined and
  the floor is byte-identical. Only the promise semantics die.
* THE CARRIER COUNTER, renamed to what survives. The #1060b ledger counted the
  told row at the apply site; that apply is gone, but the question underneath it
  is not. Boot 29 shipped a carrier whose send gate had been dead since sgl-project#1046
  and reported `sgl-project#631=0` while nothing executed -- it cost a window and a census
  to notice. `sgl-project#1064 CARRIER CENSUS` counts `rows_received` on every rank, so
  that regression can never be silent again. PP0 never receives, so only a
  downstream zero is a finding, and the line says so.
* `sgl-project#1060`/`sgl-project#1063` untouched: they measure, they never gated anything.

WHAT THIS RETURNS TO: the pre-sgl-project#1059 behaviour, in which every rank derives its
geometry from its own match. That is not a guess about safety -- boot 29 ran it
for its ENTIRE life (`evaluated=87 absent=87`, the row never arrived) across 51
flips with no `sgl-project#631`, no divergence death and no crash. The two boots that DID
die at this seam are the two that ran the promise layer.

c1 (downstream takes the geometry as a VERDICT) is NOT in this commit, and the
reason is a desk finding that inverts its safety argument: `truncate_prefix_to`
is MIN, NEVER ASSIGN (schedule_batch.py, sgl-project#930/sgl-project#958) -- so "verbatim" cannot be
expressed through the one helper both admission sites use, and a rank holding
less than it was told silently keeps its own value, which is the divergence the
verbatim form exists to remove. Reported to the coordinator with the file:line
rather than worked around.

38/38 green across sgl-project#791/sgl-project#1060/sgl-project#1063/sgl-project#677, codec round-trip verified after the
column removal, import smoke of every touched module, ruff clean, py_compile
green.

Order: coordinator (2). Evidence: boots 30/31, specimens
specimen_1060cens_boot30_uniformwidth_crash/ and
specimen_1061b_boot32_int8_triton_wedge/
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 20, 2026
…cess (void ABI), and the wake then zeroed the unmapped pool (xsn408, xsn406)

BOOT weg2xsn408 (2026-09-20 17:57:21Z). TP0 and TP1 of D died during the
wake with NO Python traceback at all. TP2 -- whose card DID fund its pool --
lived long enough to report them gone, and its own visible death
(`monitored_barrier` -> gloo "Connection closed by peer", then
`c10::AcceleratorError` in `MemPool::~MemPool` at interpreter shutdown) is a
CONSEQUENCE, not the root. Boot weg2xsn406 is the same failure 68 minutes
earlier, wearing the barlink poll as its crash site; with b646c68 in the
tree that reporter is gone (xsn408: zero barlink poll events in the whole D
log) and the fault surfaces where it actually lives.

THE ROOT, in the wake's own two lines.

    TP0  WEG2-WAKE-KV-FIRST LATE free=13355 MiB floor=767 MiB need=13024 MiB
    TP1  WEG2-WAKE-KV-FIRST LATE free=5974  MiB floor=700 MiB need=6904  MiB
                                 (... free - floor - margin < kv)

`_weg2_wake_kv_first_ok` computes EXACTLY the physical-fit arithmetic and
uses the answer ONLY to choose EARLY vs LATE ordering. It then resumes LATE
anyway, into a card the same arithmetic just called short:

    [core.cpp] WEG2-TMS-RESUME REFUSED tag=kv_cache rc=2 (out of memory)
               failed_alloc=30/41 rolled_back_bytes=5442109440
               tag_bytes=7239368704 -- every allocation of the tag is PAUSED again
    [torch_memory_saver.cpp] tms_resume failed rc=2 tag=kv_cache (void ABI: exiting)

A VOID ABI: Python is handed a normal return. `_weg2_kv_resume_part` marks
the epoch resumed and `_weg2_kv_clear_part` zeroes req_to_token, the mamba
maps and the KV buffers -- into unmapped memory. That write is the death.

NOT THE VISION STAGE, and the falsification is in the logs. The image request
did reach P end-to-end for the first time (`W102 Weg2VisionStage card=0
rows=1024 ... total_ms=4259`), but the shortfall is identical in xsn406,
which had no vision stage: TP0 need=13024 both boots, free 13353/13355; TP1
need=6904, free 5096/5974. What differs is the FLIP NUMBER, not the request:
the FIRST wake of each boot had free=14276 (TP0) / 8387 (TP1) and succeeded;
the SECOND finds ~900 MiB less on TP0 and ~2.4 GiB less on TP1. The re-admit
path was never reached on any rank (`sgl-project#1060 READMIT-RECOVERY CENSUS seen=0`),
so nothing about precomputed_embeddings or mm_items can be concluded from
this boot -- that question is still open and needs a boot that gets past the
wake. The `HICACHE-INDEX REFUSED` at 17:54:32 is three minutes earlier, on
all three ranks, and is the sgl-project#718 class already named and counted there.

THE FIX, in three one-sided layers.

* `wake_kv.kv_resume_fit_refusal` -- names a PHYSICAL impossibility
  (free < need) before the hook is called. The corridor floor is printed and
  NEVER subtracted: "keine Korridor-Reserve, nie" -- a reserve may shape a
  plan, it may never be the reason a wake is refused. TP1 of xsn408 is
  refused by this; TP0 fits by 331 MiB and is not, which is why the next
  layer exists.
* `wake_kv.resume_landed` + `torch_memory_saver_adapter.resume` -- VERIFY BY
  MEASUREMENT what the ABI cannot return. A resume that maps a tag's bytes
  takes them out of device free memory; a rolled-back one takes nothing. On a
  miss the adapter raises `Weg2TmsResumeRefused` (W114) with both readings
  and the tag's own byte count. Undecidable (no probe, tag too small, a
  `tag_bytes` symbol that raises) is reported as an ABSENCE and never as a
  refusal.
* `weight_updater` -- on either refusal the kv_cache tag stays PAUSED and the
  rank stays DORMANT: the CLEAR half is skipped, `_weg2_kv_resumed_epoch` and
  `_weg2_kv_epoch_done` are NOT set, and the early/mid sites no longer record
  a refused resume as an early one. The late site therefore RETRIES once the
  remaining legs have freed memory, and the front's `W4 Weg2WakeRefused`
  states a fact instead of marking a grave.

`resume_stats`'s docstring still carried the assumption this replaces --
"every CUDA_ERROR_CHECK / SIMPLE_CHECK in tms_csrc exits the process, so a
failed resume kills the rank instead of leaving a stale record behind". The
hook has since learned to roll back and return, which is better behaviour and
strictly worse news for a caller relying on the crash.

TESTS tests/moe_offload/test_kv_resume_refusal_0920.py, 22 hermetic cases (no
CUDA, no scheduler): both ranks' measured numbers refuse or pass as measured,
the floor is never subtracted, an exact fit is not a refusal, an absent probe
is never a refusal, a rolled-back and a partial resume both read as not
landed while concurrent slack does not flip a landed one, undecidable is None
and never False, and the adapter raises by name, returns the saver's value on
success, and stays silent on every shape it cannot measure.

MUTANT disabling the adapter's verification (`if landed is False:` ->
`if False:`): test_adapter_raises_by_name_when_the_resume_did_not_land fails
(1 failed, 21 passed).

GATE CUDA_VISIBLE_DEVICES="" pytest -q tests/moe_offload:
43 failed, 948 passed, 41 skipped in 59.58s against a baseline of 43 failed,
926 passed at 9eb70fa -- identical failure NAME set (comm -13 and comm -23
both empty).
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.

[Bug] DeepSeek V2 H100 x8 Triton failure

2 participants