Skip to content

[Feat/WIP] add llava-onevision, with support for (1) siglip encoder, (2) qwen2 decoder (3) openai api compatible server. - #1004

Closed
Luodian wants to merge 46 commits into
sgl-project:mainfrom
EvolvingLMMs-Lab:dev/onevision
Closed

Luodian wants to merge 46 commits into
sgl-project:mainfrom
EvolvingLMMs-Lab:dev/onevision

Conversation

@Luodian

@Luodian Luodian commented Aug 9, 2024

Copy link
Copy Markdown
Contributor

This is a working PR and I'm putting here to see the changes and welcome any suggestions.

Motivation

With this PR, we wish to add support for LLaVA-OneVision. A new model that accepts multi-type inputs, including single-image with anyres_max_N and multi-image, and video.

Modification

  1. add support for siglip
  2. add support for qwen2 (nothing change from previous llava-next).
  3. handle single-image with anyres_max_N (at max 729 * (N + 1) tokens) strategy, multi-image with base token strategy (729 tokens per image), video with bilinear interpolation token strategy (196 tokens per frame).
  4. add openai compatible server for launching a backend service for llava-onevision model. for above mentioned multi-type inputs, we all use the same interface as OpenAI's GPT format as the input format (the image-text can also be interleaved).

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.

Luodian and others added 26 commits June 1, 2024 11:46
@Luodian Luodian changed the title [Feat] add llava-onevision, with support for (1) siglip encoder, (2) qwen2 decoder (3) openai api compatible server. [Feat/WIP] add llava-onevision, with support for (1) siglip encoder, (2) qwen2 decoder (3) openai api compatible server. Aug 9, 2024
@zhyncs zhyncs added the wip label Aug 9, 2024

@merrymercy merrymercy left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great work and models! I have a few comments. Could you rebase and address them?

When everything is ready, I can also help test and clean up the examples/docs. Then we can let more people easily try llava-onevision.

image_url = "https://farm4.staticflickr.com/3175/2653711032_804ff86d81_z.jpg"
pil_image, _ = load_image(image_url)
state = image_qa.run(image=pil_image, question="What is this?", max_new_tokens=512)
state = image_qa.run(image=pil_image, question="<image>\nWhat is this?", max_new_tokens=512)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgl.image should add this ?

tp_size=1,
port=8000,
chat_template="chatml-llava",
disable_flashinfer=True,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the problem with flashinfer? With flashinfer 0.1.4, it should be able to support most models.


self.chat_template = get_chat_template_by_model_path(
self.model_info["model_path"])
self.chat_template = get_chat_template_by_model_path(self.model_info["model_path"]) if "chat_template" not in kwargs else get_chat_template(kwargs["chat_template"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do one of the following

  1. Fix get_chat_template_by_model_path
  2. Put chat_template: Optional[str] = None

Comment thread python/sglang/lang/chat_template.py Outdated
Comment on lines +341 to +343
or "llavanext-google_siglip-so400m-patch14-384-Qwen_Qwen2-7B-Instruct-mid_to_final_next_2p4m_am9_continual_ov" in model_path
):
print("######################## Matched chatml-llava ########################")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up this after we can specify the chat template in RuntimeEndpoint?

Comment thread assets/jobs.mp4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us use only one video in the whole codebase

  1. This one is good. Can we delete the old one https://github.com/sgl-project/sglang/tree/9e55ef15c52fc44277fb84f250b3f3ca47667c54/examples/usage/llava_video/videos
  2. Or we can use wget, curl to download it from the internet.

Comment thread python/sglang/srt/models/llava.py Outdated
from sglang.srt.models.mistral import MistralForCausalLM
from sglang.srt.models.qwen2 import Qwen2ForCausalLM

import math

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread python/sglang/srt/server.py Outdated
Comment on lines +368 to +369
server_args_dict = dataclasses.asdict(self.server_args)
self.endpoint = RuntimeEndpoint(self.url, **server_args_dict)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only extract the needed things (i.e. chat template)

Comment thread python/sglang/srt/utils.py Outdated
repeat_count += 1
if repeat_count == 20:
raise RuntimeError(f"Connect rpyc error: {e}")
repeat_count += 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these rpyc things are not needed anymore after our recent refactors.

Comment thread script.sh Outdated
@@ -0,0 +1,17 @@
/home/peiyuan_zhang_ntu_edu_sg/miniconda3/envs/sglang/bin/python -m sglang.launch_server \
--model-path lmms-lab/llama3-llava-next-8b \
--tokenizer-path lmms-lab/llama3-llava-next-8b-tokenizer \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to merge the tokenizer files lmms-lab/llama3-llava-next-8b-tokenizer into lmms-lab/llama3-llava-next-8b?
For typically text-only models, users only need to specify a --model-path. Now it is error-prone to specify both.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try it, but my experience is this would affect the normal pipeline inference. So there may involve more code changes in llava side.

@@ -0,0 +1,95 @@
import openai

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we also updated our unit test framework. Can you replace the old llava-1.5 with your new models?
https://github.com/sgl-project/sglang/blob/main/test/srt/test_vision_openai_server.py#L15-L31

This test is in CI so we will run it for every commit to make sure there is no regression.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I modified it to lmms-lab/llava-onevision-qwen2-0.5b-ov.

@Ying1123 Ying1123 mentioned this pull request Aug 14, 2024
15 of 29 tasks
@Luodian Luodian closed this Aug 17, 2024
shun8686 pushed a commit to shun8686/sglang that referenced this pull request Jul 15, 2026
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 29, 2026
…it was written for

User decision of 29.08.: the proxy/readiness/expectation layer of the HiCache
reimplementation era goes, and the sgl-project#631 guard goes with it -- it polices
cross-slot expectations across a cutover, and under the full-reset design the
mb ring starts EMPTY after every cutover, so the guard has no object. With one
layout there is no cutover at all.

So both halves are gated on enable_phase_flip: the WIDTH check in model_runner
and the IDENTITY refusal in _pp_recv_proxy_tensors. Gated, not deleted, and
each bypass emits a counted line -- a guard that stops being visible is how a
mispairing becomes silent, which is the state this family was built to end.

THE FALSIFIER IS THE POINT. Flip-free PP3 must now survive. Boots 46, 47 and 48
each died here exactly once (WIDTH, IDENTITY, WIDTH) with enable_phase_flip
off, on a path where the thing being guarded cannot occur -- and the same
config served 11 prefill batches and ~2092 decode steps before each death. If
that config still dies after this gate, the mispairing is upstream PP's and
not this fork's; if it survives, it was ours. One boot decides it, and the
bisect control arm is no longer needed.

Evidence: desk, executed. py_compile on both files; exactly one gated bypass
per half, each with its own named line. Belegstufe: DESK-BEWIESEN -- the metal
proof is the flip-free boot.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 24, 2026
…aht), sgl-project#1004 haelt mit Namen statt None (fnFL2 H42c)

Befund x161 (7370b10, 24.09. 15:41:43, rid weg2-2-6, 12672 Token nach
dem Flip D->P, width 4): PP0 fuehrte den Koerper [0, 12668) in Slot 0
(fwd_ct 7), PP1 liess ihn in Slot 2 zu (fwd_ct 7); PP0s Proxy mit Stempel
Slot 0 kam in PP1s Slot 2 an ('sgl-project#1004 IDENTITY REFUSAL BYPASSED ... stamp
mb_id=0 seq=8 rows=12668 while on mb_id=2'), der Bypass gab None zurueck,
das Modell starb namenlos ('entered the forward without pp_proxy_tensors').
Der 97k-Request davor (7 Forwards, 6 Chunks + 1-Token-Schwanz) lief auf
allen Stufen in denselben Slots.

Wurzel: der Slot ist KEIN Zaehler und kommt nicht aus dem Stempel -- er ist
das mb_id des Passes, in dem eine Stufe den Batch bildet
(_event_loop_pp_body, mb_id-Schleife; '#969N ADMIT slot=mb_id'). Auf der
traegerlosen P-Form ('sgl-project#631 ROW AUTHORITY DISABLED') plant jede Stufe selbst,
im Pass m ihrer Liste m (blockierender Ketten-Empfang); die Passe sind
deshalb logisch gleich. _pp_scheduled_extents ist dort auf den Folgern None,
rank_local_count_veto_applies also True, und JEDE Stufe nahm H42bs
Sammel-Urteil (_weg2_burst_assembly_hold) -- jede mit ihrem eigenen
time.monotonic() zu ihrer eigenen Wandzeit. PP1 fand die Queue im Pass mit
Slot 2 ruhig ('release reason=quiet held_ms=53'), PP0 hatte diesen Pass
(auf dem async Ketten-Send voraus) noch gehalten und gab einen Pass spaeter
in Slot 0 frei ('held_ms=55'). H42bs 'Folgeraenge warten nie' setzte einen
weitergereichten Plan voraus, den es auf dieser Form nicht gibt.

Fix: PP0 legt seine Pass-Uhr auf die Liste, die es SENDET
(anchor_tails.stamp_burst_clock, Konvention von pp0_publish), und
entscheidet selbst auf demselben Wert; ein Folger reicht sie unveraendert
weiter und nimmt sie vor dem Dispatch ab (absorb_burst_clock, pass-scoped).
Das Urteil liest die Uhr ueber anchor_tails.burst_pass_now: ohne PP die
lokale Uhr (byte-gleich), mit PP die von PP0, fehlt sie: BurstClockAbsent
mit Namen. Alle anderen Eingaben (Queue, sgl-project#1400 told/held, Budget, Sitze)
sind bereits Funktionen der empfangenen Listen. REQ-TRACE zaehlt die Uhr
nicht als Request. Scharf nur mit SGLANG_WEG2_P_BURST_ASSEMBLY_MS > 0 und
pp_size > 1. Rest-Luecke (benannt): TP-Peers von PP0 bei tp > 1 lesen ihre
eigene Uhr (die P-Form ist tp 1).

sgl-project#1004: ein Stempel fuer einen anderen Slot ist auf einem Ein-Layout-
Prozess kein Ueberbleibsel, sondern Stufen, die uneins sind. Statt None
jetzt RuntimeError 'sgl-project#1004 SLOT DISAGREEMENT' mit beiden Seiten
(pp_slot_disagreement_message: eigener Slot, fwd_ct, rids, extend; Slot,
seq, rows, Sender-fwd_ct, Extent des Stempels). Der Zaehler bleibt.

Tests: test_weg2_p_burst_clock_h42c.py -- Draht-Hop durch das echte
_pp_forward_and_process_input_requests (Uhr gesendet/weitergereicht, nicht
dispatcht), die x161-Sequenz auf PP0+PP1 (97841 = 5x16384+15920+1, dann
12672 = 12668+4, width 4, PP1-Wandzeit driftet) -> gleicher Slot und
fwd_ct 7 fuer Koerper und Schwanz; Mutant (jede Stufe eigene Uhr = H42b)
reproduziert den x161-Split (PP1 einen Slot frueher); fehlende Uhr ->
Stopp; sgl-project#1004-Meldung und Quellpin. test_weg2_s0_unweave_1233: der Drop-
Test erwartet jetzt den benannten Stopp statt None (weiter: nie
angenommen, gezaehlt). Betroffene Tests (33 Dateien, Auswahl: Importeure
von scheduler_pp_mixin/anchor_tails + Tests von _pp_recv_proxy_tensors /
_pp_forward_and_process_input_requests / _weg2_burst_assembly_hold):
Fehlmenge identisch zur Basis 7370b10 (75 vorbestehend).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…assungsfaehige Arbeit zurueck (sgl-project#1004 V1)

V1 dkrnfh91visbar1dauer09270822 (rc12j 3e97ef0) starb 08:29:10Z auf P an
"sgl-project#1004 SLOT DISAGREEMENT": PP1 startete slot 1 (fwd_ct=10, rids=[weg2-1-9,
weg2-2-12]), der Proxy von PP0 nannte slot 0. P-Log: PP0 fwd9 slot 0
08:28:57; im slot-1-Pass war ein Bild (weg2-2-11) unkodiert und PP0 nicht
leer (fwd8/fwd9 in Flug), also hielt vision_rank_pass JEDEN wartenden
Request zurueck (held = list(wq), "PP0 drains for the stage"). PP0 lief allein
durch slot 1, 2, 0 (Ausgaben von fwd8/fwd9 einsammeln), fuhr in slot 0 die
Stufe (W102 run=1 08:29:06, build 43 / load 467 / encode 1669 / teardown 494
ms) und liess fwd10 in slot 0 zu. PP1, frueher leer, parkte idle auf slot 1
und nahm PP0s Zeile dort an. Row authority haelt die rids gleich, nicht den
Slot, sobald PP0 zulassungsfaehige Arbeit ueber seinen eigenen Drain schiebt.

Fix: vision_rank_pass fuehrt die Stufe in dem Pass aus, der die Bilder findet
(ein Turm-Load fuer alle wartenden Bilder), auch mit Mikrobatches in Flug;
zurueckgehalten werden nur verweigerte Requests bis zu ihrem benannten
Abort. PP0 rechnet waehrend der Stufe nichts parallel (eigene Forwards sind
in frueheren Passes synchron gestartet); der Turm nimmt nur freie Tail-Seiten
(reserve_tail_pages liest die Freiliste, Seiten laufender Batches sind nie
darin) und gibt sie vor der Zulassung zurueck. pp0_idle ist ohne Leser und
entfaellt. Kein Schalter.

Folger-Schranken >= Stufendauer (~2,7 s am Metall): Belegungs-Horizont
SGLANG_PP_OCCUPANT_HORIZON_S 90 s, Ring-Commit 120 s, Objekt-Recv-Schritt
30 s, Chain-Recv-Stall 0 (aus), Scheduler-Watchdog 300 s; in V1 liefen die
Folger 2,6 s Stufe ohne Timeout (Tod erst am Slotversatz).

Tests test_weg2_vision_rank_runner.py: der Drain-Test ist ersetzt durch
"busy PP0 stages in this pass and holds nothing", "chunked request in flight
defers nothing", "only a refused image is held" (3 rot auf 01d37e7, gruen
mit Fix) und zwei VRAM-Tests (Stufe mit Batch in Flug: Tail disjunkt zu den
Seiten des Batches, dessen Bytes unberuehrt; Batch im Tail -> W105, keine
geteilte Seite); Datei 24/24 gruen. test_weg2_vision_rank_wiring.py: der
Alt-Test "busy PP0 -> Admission sieht nichts" pinnte den Drain und ist
auf "verweigertes Bild bleibt draussen" umgestellt, dazu "busy PP0 laesst im
Stufen-Pass alles zu"; 6/6 gruen.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…can pay; an under-delivering peel repairs the frontier once and names the rest

Metal rc12o b1 (dkr27breleasedraftbar1w109271344, 732d629), P log 54255-54280, PP0 13:56:43Z,
weg2-8-62: MAMBA-HOST-RESUME anchor 45238 -> sgl-project#988 LOADBACK 45238 -> WEG2-ARENA-LOAD rows=42216 (the
SF same-pass room evicted exactly the load's shortfall; its line n=9 is not printed by the sampler),
then the 512-token extend: "Available full tokens: 149167 (full_available_size=46 +
full_evictable_size_=149121)", "EVICTION UNDER-DELIVERED: asked for 512 tokens, the pool received 0".
PP0 prints no sgl-project#1421 BACKUP-REFUSED in the whole boot: no leaf was tried and refused -- the peel found
none it could pay.

Why the two numbers disagree: component_evictable_size_[FULL] counts every device node whose FULL
lock_ref is 0; the frontier (evictable_device_leaves, _is_device_leaf) admits a node only when EVERY
component's lock_ref is 0 and no child holds FULL rows. A MAMBA lock pins its node alone
(MambaComponent.acquire_component_lock), so an anchor node with FULL 0 / MAMBA >0 is counted and never
peeled, and every FULL-unlocked ancestor above it keeps a device child and never becomes a leaf.
NF's (b) -- the freshly loaded 42216 rows -- is not it: the load-back's inc_lock_ref moves them to
protected. The admission (PrefillAdder.rem_total_tokens, re-read after the load-back inside
add_one_req; common.fundable_extend_tokens -> chunk_tokens_the_pool_can_fund) read the reported
count and let the chunk through with 46 free.

ED (SGLANG_EVICTABLE_DELIVERABLE, default on; 0 = the reported count): MambaComponent records the
0->1 / 1->0 transitions of a node's device mamba lock (mem_cache/evict_frontier_census.note_aux_lock);
UnifiedRadixCache.deliverable_evictable_size() = reported FULL-evictable minus blocked_tokens (every
aux-locked node with FULL lock 0 and its FULL-unlocked ancestors up to the first FULL-locked one, each
once). rem_total_tokens (hybrid-SSM branch) and fundable_extend_tokens read it, so an unfundable chunk
answers NO_TOKEN / parks instead of OOM-ing in alloc_for_extend. The reported count, pool statistics
and every other reader are unchanged.

EF (SGLANG_EVICT_FRONTIER_REPAIR, default on; 0 = the old peel): FullComponent.drive_eviction, when the
peel ends short while the tree still reports evictable tokens, scans the tree once
(_collect_all_nodes), re-derives every node's leaf membership, retries the peel and logs
EVICT-FRONTIER-CENSUS (request, delivered before/after, reported, FULL-unlocked tokens, on the
frontier, aux-locked per component, behind a device child, leaves before/after, stale_added, ids).

Not changed: SF local_pp_room still evicts only the load's own shortfall (the extend is then priced by
ED and parks if the pool cannot pay it).

Tests: test_evictable_deliverable_rc12o_0927.py 10 (b1 shape: a mamba-locked tail blocks its 149121-
token chain, deliverable = the free leaf only, switch off = reported, lock gone = nothing blocked; walk
stops at a FULL-locked ancestor, shared ancestors once; FULL-locked aux node blocks nothing; the real
MambaComponent lock/unlock transitions feed the set; fundable_extend_tokens 46 instead of 149167;
adder wiring; EF: stale frontier repaired and paid with the census line, switch off = old peel, a
paying peel scans nothing, the census names the aux-locked chain).

Review (NF), amended:
  * Rank uniformity. Form A (NF-D): the host's vote decides (H105); a worker's tree is marked
    _ef_deliverable_exempt at every adder build and keeps the reported count, so its local extend
    arithmetic is the pre-ED one (test_nf_form_a_admission_follow_h105 + every *form_a* suite: 135
    passed with the ED file). Classic TP (27B-D): the published floor (fundable_extend_floor, sgl-project#681)
    reads fundable_extend_tokens, i.e. the deliverable count; the aux lock set is replicated with the
    tree (the same requests lock the same nodes), as the reported count was. P (carrierless PP): every
    stage plans for itself (pp_row_carrier_present False); the deliverable count is exactly as
    rank-local as the reported count and the free rows it is added to were -- no PP0 verdict is
    adopted on this form; sgl-project#1004 / sgl-project#1233 W27 remain the named stops.
  * Cost: blocked_tokens is memoised per cache on (aux-lock version, FULL evictable, FULL protected)
    -- recomputed only when one moved; timed, one ED-DELIVERABLE line per 60 s (calls, scans,
    scan_us_mean/max, blocked, aux_locked_nodes).

Operator fix: deliverable count read from the tree CLASS via common.deliverable_evictable_or (a duck-typed getattr on a MagicMock tree returned a mock and broke 681/971/prefill_adder/959/656); non-int answers fall back.
Tests: 255 suites vs base 732d629: after the fix the five admission suites are green again; ED file 15 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…roup P execute its row -- counters + sgl-project#1180 chain receiver re-built, carrier split per PP0 term, told stays armed

WHY IT WAS OFF. fb3631c (sgl-project#1233 S0, 07.09.) un-wove the phase flip and pinned pp_flip_counters /
pp_chain_receiver to None, the value they had with the flip flag off ("Every value this commit pins
is the value the expression already produced with the flag off") -- not a crash, leak or crawl
finding. On group P the followers since plan from their own pool (rc12o P log 1807/1811 "sgl-project#631 ROW
AUTHORITY DISABLED"): the class W27, sgl-project#1004, TF and SF closed term by term. 5c97a22 (sgl-project#973) then
disabled the PP0 carrier terms on purpose (sgl-project#973 RING COMMIT TIMEOUT: PP0 withheld, followers
admitted). What re-arming must address, read off the code: (a) the frame probe
_pp_proxy_frame_pending needs the counters, and the loop's pacemaker _pp_row_chain_pending needs the
chain receiver too -- without it the follower blocks in the chain recv each iteration, visits slot k
before frame k exists and falls a slot behind (631row5 crawl class); (b) pp_row_carrier_present=True
would DISARM the told carrier P runs on (weg2_store_told.armed) and re-arm every PP0 term at once.

weg2/p_row_authority.py (SGLANG_WEG2_P_ROW_AUTHORITY, DEFAULT OFF by operator order -- activated per
profile / --env-p in the proof boot; off = both stay None, every image byte for byte):
  * init_request_receiver: PhaseFlipCounters (all PP ranks, attn rank 0, swept at boot) BEFORE the
    PpChainReceiver (followers; consumed count published through the counters) -- the flip-era
    builders minus the flip gate -- and the receiver is handed to SchedulerRequestReceiver;
  * the chain receive is bounded: SGLANG_WEG2_P_ROW_CHAIN_STALL_S (default 120 s; 0 or unset -> 120,
    never unbounded); expiry raises the named PpChainRecvStalled (no stall service wired: a stop, not
    a local decision);
  * START CHECK: switch on on a PP group but counters (any rank) or the receiver (a follower) missing
    -> "W-P-ROW Weg2RowAuthorityIncomplete" at startup; armed -> "P-ROW-AUTHORITY armed" line;
  * pp_row_carrier_present(scheduler, term=None) split: on the row form every PP0 term answers its
    own switch, DEFAULT OFF -- SGLANG_WEG2_P_ROW_WITHHOLD (sgl-project#1066/sgl-project#1175), _FLOOR_CLAMP (sgl-project#1039),
    _CORRIDOR (sgl-project#794); no term -> False, so weg2_store_told stays armed and the sgl-project#1245 drop keeps its
    answer; off the row form the counter-based answer is unchanged;
  * P-ROW-COST (followers, 60 s): plan ms of row-executed passes p50/p90, frames, probe calls/
    drained/delivered/vanish/quiet/head_other.
Existing protections are the executor's own: frame without a row -> "sgl-project#631 ROW AUTHORITY" stop;
frame before its requests -> left in the inbox (631row14); no frame -> nothing planned (#969J);
sgl-project#1004 / sgl-project#1233 W27 / sgl-project#791 FORWARDED SCHEDULE UNEXECUTABLE STOP.

Tests: test_weg2_p_row_authority_0927.py 15 (default off incl. terms; stall bound finite; counters
built/swept only when on; receiver gets the stall bound and the consumed hook, none on PP0;
half-armed follower / PP0 refused by name; complete arms, off silent; init wiring order and the
receiver handed on; carrier split per term, no term False, old form unchanged; told armed on the
row form; the three PP0 sites pass their term; pacemaker model: counter-gated follower executes
every frame at its slot, the blocking-chain mutant falls behind; P-ROW-COST line and hook).

Profile switch (operator 27.09.): ModelProfile.p_row_authority (default False, both registry rows) feeds
switch_defaults()[SGLANG_WEG2_P_ROW_AUTHORITY]; p_row_authority.enabled(): an explicit env wins, unset
follows the published form's profile default (off everywhere). The proof boot switches it on per docker
profile gpu-arb/docker/profiles/27b-row-authority.env (27b-release-draft.env + _form
SGLANG_WEG2_P_ROW_AUTHORITY 1; K0-K3 criteria in the file). Rebased onto unified 2494e7e.
Test: + registry rows all off, profile default followed, explicit env wins (16 total).

Rebased 28.09. from b16128a onto unified 7055ec7 (cherry-pick, no conflict). Targeted
suites on 7055ec7+Fix B: p_row_authority 16, unify_s2 16, unify_s3 35, told (27b_fidelity 11,
array_key_rc12z2 4, store_told_1400 24, hold_tk 8), pp_chain (abort_check_824 4, receiver 8,
row_defer_cap_1180 20) all passed; pp_chain_flush_deadlock_788 3 failed -- identical 3 on
7055ec7 without Fix B (stub lacks _weg2_vote_pass_hook/_pp_post_send), pre-existing.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 4, 2026
…ct#1427 rows, host-backed END anchor), pp0 mode, log names rank and end_anchors, corrected rank-congruence text

A1: the leaf and every descendant are kept (old behaviour) when write_through_pending_id is set (split node: the key stays the OLD node id), the node id is in _weg2_direct_mamba_rows (sgl-project#1427), or it is a END anchor with a mamba host value (the reset path holds it one D phase on purpose). A2: the docstring said "named stop on one request" for the follower case; sgl-project#1004 SLOT DISAGREEMENT and Weg2StoreToldMismatch are raises without a catch = named group death. SGLANG_WEG2_DUAL_UD_HOST_CHILDREN is now 1 (all P ranks, default) / pp0 (tree.pp_rank == 0 only) / 0. The _weg2_store_told_satisfied window is documented as a named residual (the tree does not know the scheduler's satisfied rids). A3: EVICT-UNBACKED-DROP SUBTREE names end_anchors and rank=pp<n>.

Tests: 20 in mem_cache/test_dual_p_ud_host_children_1004.py (new: pending id, direct rows, END anchor, pp0, log, M4 mamba pool/LRU return, M15 EF retry off), flip_unchanged_1003 88 passed, neighbour suites of the changed modules 217 passed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 12, 2026
…GT (marked so); the vote-to-peel window is tested and named by the stop text

Review findings of round 1 (both major):
1. The commit/FIXES/test claimed the over-count root "proven by the log". It is
   not. What the log proves: agreed 140416 - avail_after 19968 = 120448 = node 181
   (vote counted all reported, the peel paid all but 181); 181 un-backed +
   l3_present, claim refused x2, no UD drop; 194/195 were backed by the peel
   itself (WRITE-BACK DRAIN -> EVICT backuped=True) and carried a MAMBA host lock.
   What it does not prove: why 181 could not drop (H1 host lock of the demoted
   children, timing vs the pass-top vote unknown -- load_back takes its own
   inc_host_lock_ref at unified_radix_cache.py:6781 before local_pp_room 6905;
   H2 181 in flight, PUBLISH-SWEEP unbacked=3 issued=3 in the same pass; H3 host
   room spent). Comments in pp_slot_fidelity / pp_room_vote / unified_radix_cache,
   the test docstring and FIXES Nr. 32 now say so. The shared check guarantees
   vote == peel for the state the vote SEES (pass top); a lock or write that
   appears between vote and peel is NOT closed -- AgreedRoomShort stays the stop
   (no reserve, no threshold, no switch; refusing on PP0 alone would be the sgl-project#1004
   skew).
   - tests: VoteToPeelWindow (6): unbacked children, nothing late -> walk == peel;
     host lock after the vote -> AgreedRoomShort; write in flight after the vote ->
     AgreedRoomShort (both documented as the open window); diagnostic names the
     locked demoted child; diagnostic never breaks the stop; trace does not change
     the walk.
   - instrument (stop text only, no behaviour): AgreedRoomShort prints
     vote_payable (pass-top vote, noted by follower_fact) next to walk_now (fresh
     walk) and unpaid=[id:tokens:reason] (pp_room_vote.vote_diagnostic,
     estimate_payable(trace=), pp_slot_fidelity.route_refusal): the next death
     names H1/H2/H3 instead of guessing.
2. Earlier instances of the class named and checked (FIXES Nr. 32): PP-ROOM-VOTE
   24ed9b5 + UD-H bff5913 (int19), PR-ARENA c593533 (int22) covered
   (suites green); Room-Short 1008 (desk/nf-room-short-1008, stale FOLLOWER fact,
   PR AGREED-ABOVE-LOCAL where=pass, FACT_MAX_AGE_PASSES=8) is a different
   mechanism and NOT covered by this fix; it was also not the 092933 death
   (agreed equals PP0's own avail+reported to the token; the 5 where=pass hits in
   the boot are 64-128 tokens on PP1/PP2, none fatal).

Tests (pytest_gedeckelt.sh, PYTEST_MEMMAX=4G, CUDA_VISIBLE_DEVICES empty, one run):
- 193 vote/room/evict/hicache/spill/park/arena/w3/l3 test files (weg2 + mem_cache,
  without unified_radix_cache_unittest/bench) + the 7 core files incl. the NF
  goldens (test_nf_n3_unchanged_1005, test_planer_referenz_n3_1006; fixtures
  untouched, diff 0): 1913 passed, 19 failed, 19 skipped. test_weg2_room_vote_one_check_1011.py
  (23 tests, was 17) all green. The 19 red: 18 are in the red list of 6c53a95
  (base run of the earlier round, same test names), the 19th
  (test_weg2_arena_find_np_xsn309::test_arena_get_uses_the_numpy_path) is a
  source-text assert on managers/cache_controller.py, which this branch does not
  change (git diff 6c53a95 -- that file: empty) -> pre-existing.
- unified_radix_cache.py: comment-only change this round.

Metal: not measured (CPU only, no boot). Whether the fix prevents the 092933 death
at the metal is UNBELEGT.
efschu pushed a commit to efschu/htsglang that referenced this pull request Oct 20, 2026
…ites 757/787/788/791 off API drift

A1 (review done/nf-review-p-pp3-overlap-1020.md): test_w2c_three_rank_gloo_1020.py
spawns 3 gloo ranks (S95b form) with the real chain send
(_pp_send_pyobj_to_next_stage), PpChainReceiver, shared PhaseFlipCounters,
the counter gate _pp_row_chain_pending, the frame probe
_pp_proxy_frame_pending (C3), the real pp0_publish (V1), proxy_extra and
note_frame. PP0 pass order: slot-0 launch pass (slot 1 receive empty),
announced pass k (chain k: told + K14-shaped abort of a row-s rid), park
pass s+2. Cases: green (chain k before the older row on PP1 and PP2, abort
absorbed before the row and the row still runs, admit on acks > 0.5 s before
the older output, no park call in pass k), other slot in flight (no
announcement, serial), PP0 silent after announcing (named sgl-project#789 stop on all
three ranks), late PP1 chain hop (relay covers PP2). 4 passed.
Mutants red: PP1 without relay (2 failed), announcement with a slot in
flight (1 failed; the adapter no longer pre-filters, the pure verdict is the
single place), park in pass k (2 failed).

A2: the five protocol files were red on rc27 by API drift, not by a defect.
  757/787: holder lacked the sgl-project#1057 stale guard + stamp helpers; refusal is
    the sgl-project#1004 named stop now. 3/3 and 4/4 passed; mutants (output eaten, no
    slot refusal, no settle window) red.
  788: holder lacked the sgl-project#1268/PR/lane pass hooks, flush_wrapper and the
    #1015e lap-late send helpers. 3/3 passed; mutant blocking chain send red,
    mutant no end-of-iteration flush survives (top-of-pass commit takes over).
  791 wiring + forwarded schedule: sgl-project#1015 removed the admission arc, the row
    rides the proxy frame (sgl-project#631); sgl-project#1072 removed retraction, sgl-project#1071 the void.
    Ported to the frame row; 3/3 and 29/29 passed; mutants (retract again,
    reconcile skipped, no forwarded geometry, local order, row not relayed)
    red; 'relay dropped' on the wiring file survives (the test relays the
    amended row itself).
  631: retired by design (sgl-project#1233, module-level skip), unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants