Skip to content

Add OLMoE - #1476

Merged
zhyncs merged 1 commit into
sgl-project:mainfrom
Muennighoff:patch-1
Sep 20, 2024
Merged

zhyncs merged 1 commit into
sgl-project:mainfrom
Muennighoff:patch-1

Conversation

@Muennighoff

Copy link
Copy Markdown
Contributor

Really cool to see it merged in #1444 ; Just adding it to the readme

@zhyncs
zhyncs merged commit 014982b into sgl-project:main Sep 20, 2024
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 Sep 17, 2026
…zer send, plus flush_wrapper.check_pending

weg2xsn236 (sgl-project#1475): process_input_requests=1529 ms on every P rank in the
same pass, with vote/post_send/send/absorb 0 and no handle_generate_request
over 200 ms (#1474).  The remaining suspects are another request kind in
that pass, the output send back to the tokenizer, or
flush_wrapper.check_pending -- this line names them.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…anz nicht mehr in die Host-Release-Queue -- TP0 sammelte ~1,26 Mio. Seiten-Eintraege, der Flush-Reset lief sie einzeln ab

Befund (D-Log boot_weg2_dkrnfh91dprsavisnoadopts0bar1dauer09281111_103bfdf29a_0928_111148.D.log):
- TP0 stand 11:22:57 -> 11:23:14 im Flush vor dem Schlaf ('sgl-project#1476 DISPATCH kind=FlushCacheReqInput dispatch_ms=16372'), zwischen 'R12 HOST-VERDICT reset drops' und 'sgl-project#1068 RESET JOIN ... joined_s=0.00'. TP1/TP2 resetteten 11:22:57.
- Das ist kein Warten auf Store-Ops/Backup-Acks, nicht der sgl-project#1068-Join (0,00 s) und nicht die W88-Schleife selbst. Es ist der Reset-Gang ueber die Host-Release-Queue (_weg2_release_queued_refs_before_reset, ein torch-Aufruf je Eintrag). Er gab nichts zurueck und schrieb deshalb keine Zeile.
- Gefuellt hat die Queue der W88-Retry-Sturm von weg2-10-50: 1299x 'sgl-project#915 PREFETCH TRUNCATED need=69952 got=5760 lost=64192' nur auf TP0 (Worker lost=0).
- Der Gruppen-Trim legte den abgeschnittenen Schwanz jedes Mal in die Queue, je 64-Id-Seite ein Eintrag, also ~1000 je Pass. Das sind Lese-Platzhalter aus alloc_read (kein Slot, keine Referenz); der Drain verwirft sie ohnehin (ARENA-QUEUE-REFS placeholders=64 je Aufruf, kumulativ 2,4 Mio.).
- Der Drain einigt sich auf das Gruppen-MIN der Queue-Groessen. Einen Ueberschuss, den nur TP0 hat, erreicht er nie.
- Derselbe Queue-Gang im Zensus-Thread: ARENA-REF-HOLDERS n=7 faellig 11:22:40, gedruckt 11:23:03 (snapshot=torn); HOST-ANON-STACK 11:22:53 zeigt ihn in unified_radix_cache.py:1639 (queue-Summe).

Fix:
- Der Schwanz eines Gruppen-Trims wird nur noch gequeued, wenn host_indices echte Zeilen sind (alloc). Platzhalter aus alloc_read werden gezaehlt (_weg2_trim_placeholders_dropped), nicht gequeued.
- Der Reset-Gang misst sich. '#1424g ARENA-REF RESET-QUEUE' traegt jetzt ms= und erscheint auch ohne Rueckgabe, sobald der Gang >= 100 ms dauert.
- Kein Schalter.

Test test_weg2_trim_placeholder_tail_rc12z17 (4), ueber das echte prefetch_from_storage:
- rc12z17-Form (need 69952, Gruppe 5760): 0 Ids gequeued.
- 64 Retry-Paesse: Queue bleibt leer.
- Staging-Schwanz (alloc): weiter freigegeben.
- Ohne Trim: keine Freigabe.
- Die ersten beiden sind rot auf 1bab093 und gruen mit Fix; die beiden Waechter sind auf beiden Seiten gruen.

Gate: 35 Testdateien, die prefetch_from_storage, _reset_full oder den Reset-Gang beruehren (ohne test_unified_radix_cache_unittest, OOM in der Cgroup).
- Fix: 33 failed / 396 passed.
- Basis 1bab093: 35 failed / 394 passed.
- Die 33 Altlasten sind identisch, 0 neue Rote.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 1, 2026
…NG line per park per rank (z30y13 park RPC 0.36-1.41 s ahead of every D->P flip, one-second log stamps only)

The D park RPC (sgl-project#1476 DISPATCH kind=Weg2ParkRunningReqInput) costs 0.57-1.84 s
on z30y11/y12/y13 before the flip begins, equal on all ranks (the y12 fit:
416 ms + 188 ms per 100k parked pages). Its log carries one-second stamps, so
which step pays was a guess. Second-boundary crossings over the 14 z30y13 parks
(11.9 s dispatch total, TP0) put ~7 crossings inside retract_all, ~4 inside the
sgl-project#248 PARK-MARK chain (TP0 only), ~2 between the retraction and the note loop,
0 in #59b -- an estimate, not a measurement; hence this line.

park_running now laps a monotonic clock, contiguously, and prints once per park
on every rank (same fields, same order):
  land_ms draft_ms retract_ms (forced host write-through) note_ms
  mark_ms mark_chain_ms mark_write_ms mark_keys (sgl-project#248, park_l3.LAST_MARK_STATS)
  probe_ms coll_ms (#59b admission probes / the tp-min reduce, timed by a
  reduce_min wrapper around the default _tp_min -- on TP1/TP2 coll_ms is the
  wait for TP0's mark chain) rest_ms total_ms
  running retracted seq_tokens resumable_tokens pages page_size
  wt_host_slots wt_bytes (host pool slots the retraction's write-through took)
Instrument only: nothing branches on it, every read is guarded.

Tests (CUDA_VISIBLE_DEVICES="", nice/ionice, htsglang-gpu venv):
- new test/registered/unit/weg2/test_27b_park_timing_1001.py: 3 passed --
  the real park_running -> real park_l3.mark_parked -> real park_depths/
  group_depths (tp-min), leaves advance a fake monotonic clock.
- mutants all killed: retract lap folded into draft (1 red), collective not
  timed (2 red), no line (3 red, = base), mark write counted into chain (1 red).
- neighbours (43 files: *park* + importers of d_park_runtime/park_l3/
  weg2_resumable_depth): 483 passed / 4 failed, base 0c4238f the same
  483/4, identical failing set (resumable_depth_59 anthropic carrier,
  form_a_dcp_s3d_239 f13 anchors, parked_abort_w1b_1401 x2).
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
…y tree reset encodes its kept stems once

The 27B P->D layer is ~0.45 s longer than NF's, all on group P before the
legs (N3u 1002_072908 FLIP-TIMELINE p50 quiesce 302 / sleep-kv 339 ms against
NF ~120 / ~70): PP0 sgl-project#1476 DISPATCH FlushCacheReqInput p50 164 ms (NF < 20),
PP1/PP2 WEG2-SLEEP-CHUNK kv release p50 154/165 ms (NF 20/17), D 330-345 ms
(NF 44).

(1) Instrument (behaviour unchanged): flush_sub_timing stamps the segments of
Scheduler.flush_cache (sweep, verdict, store_join, l15 as ONE segment,
anchors, l15_tail, tree_reset, req_pool_clear, alloc_clear, zero_kv,
grammar_metrics, draft, empty_cache, scrub) and of the release's kv block
(pre, flush, ah, kv_pause, swing, to_graph, sync), keeps the last sgl-project#1460
CHAIN-RECV blocked wait, and prints one WEG2-SLEEP-SUB line per sleep and
rank at the kv release. L15 code untouched (marks only between its blocks).

(2) Cause found in the data: the reset's ARENA-REF-HOLDERS at=reset census
(handoff_pending.census) looks up EVERY kept key in the arena on the
scheduler thread. 27B runs page_size=1, so a kept key is a token: P kept
90691 keys at every reset, D 117304-416824; NF (page 64) 3231. Per-sleep
kv-release ms track the kept-key count (D TP0: 0 keys 139 ms, 117k 242-410,
249k 507, 300k 550, 417k 634; P always 90691 -> ~150). CPU benchmark of
census() on a real ShmArena: 90691 keys 78-134 ms, 3231 keys 2 ms.

Fix: the stems of a kept record never change (the record is replaced when
its mark changes), so census encodes each record's ctypes stem array once
(ShmArena.encode_stems) and counts COMPLETE with one C lookup + numpy sum
(find_states_encoded). Same numbers; 90691 keys: first census 65 ms, then
21-23 ms (old 78-87 ms in the same run). An arena without the new methods
takes the old path. flush_verdict.py untouched.

Test (CUDA_VISIBLE_DEVICES="", nice 19, ionice c3, -n 2; 60 files touching
flush_cache / flush_verdict / pp_chain_receiver / handoff_pending /
ShmArena / holder census / release_memory_occupation):
  base d1e5da0: 16 failed, 462 passed (pre-existing failures)
  this commit:     the same 16 failed, 471 passed (+10 new in
                   test_pdflip_sleep_sub_1002.py; RED on the base: 7 errors +
                   1 failed, census test red); test_pp_ring_abort_recovery
                   flaked once under parallel load, passes alone on both trees.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 2, 2026
…y at claimed=0, L3/readable per chunk, cheap #969G cap, hybrid queue_parts

N5m (5576ce0, D->P weg2-8-9, 72786 tokens): PP0 LOAD-DEVICE queue_ms=1270
(read 92, harvest 23) with queue_parts empty. in.process=1297 in the same pass
is the Resume RPC (sgl-project#1476 DISPATCH ResumeMemoryOccupationReqInput 1297), not
the intake. Inside the queue window PP0 printed
'#1028B FETCH CAP n=3 kv=61370 claimed=61343 lost=27' and #969G counted
100k -> 200k key derivations: the #1035b anchors_in_range discriminator
(meant for claimed=0 only) called has_component over all 72779 keys per pool,
which built the whole-span _bulk_l3/_bulk_readable (~61k derivations per pool,
each paying an env read in _969g_trace).

- #1035b anchor probe runs only when the claim is 0; otherwise the line says
  anchors_in_range=skipped(claimed>0).
- has_component answers L3 presence / readability per 512-page chunk on first
  ask (same answers as the bulk, randomised equivalence test); a page past
  kv_pages answers False without a derivation (as the bulk set did).
  SGLANG_HICACHE_PROBE_CHUNKED=0 restores the whole-span bulk and the
  unconditional anchor scan.
- _969g_trace past the cap: one int compare, no env read.
- hybrid_cache_controller.PrefetchOperation carries stage_times and
  _storage_hit_query stamps 'hashed' -> LOAD-DEVICE queue_parts fills on the
  hybrid path.

Gate (test_hicache_probe_chunked_1002 + 14 probe/anchor/store neighbours):
base 24 failed (11 new red + 13 pre-existing), change 13 failed = identical
pre-existing set; new test 11/11 green.
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