Skip to content

[WIP] Add Qwen-VL - #244

Closed
BabyChouSr wants to merge 1 commit into
mainfrom
qwen-vl
Closed

BabyChouSr wants to merge 1 commit into
mainfrom
qwen-vl

Conversation

@BabyChouSr

Copy link
Copy Markdown
Contributor

Add Qwen-VL model to SGLang.

Rough roadmap:

  • Write out classes and test model loading
  • Test out CLIPVisionModel forward and Cross attention forward
  • Test entire LVM output

@merrymercy

Copy link
Copy Markdown
Collaborator

@BabyChouSr Any progress on this? Is the model ready?

@zhyncs

zhyncs commented Jul 28, 2024

Copy link
Copy Markdown
Contributor

@BabyChouSr Hi may you update the latest status? When is this PR expected to be ready?

@zhyncs

zhyncs commented Aug 1, 2024

Copy link
Copy Markdown
Contributor

Due to the lack of response, I'm closing this work-in-progress PR for now. It can be reopened later if needed. Thank you!

@zhyncs zhyncs closed this Aug 1, 2024
@zhyncs
zhyncs deleted the qwen-vl branch August 14, 2024 12:15
vschandramourya pushed a commit to vschandramourya/sglang that referenced this pull request Feb 3, 2026
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
efschu added a commit to efschu/htsglang that referenced this pull request Jul 27, 2026
…e the runbook

The threshold was declared in environ.py under its MiB name only, so the
rank-uniformity block documented a default the transport no longer uses. The
KiB spelling is now the registered one with the measured default; the MiB
spelling stays registered as deprecated and still wins when set.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…he bound take the seats of the youngest parked; seat_wait_s in D-ADMIT

NF rc12r (dkrnfh91dprbar1dauer09271632, 16:52-17:04; finding befund_244_d_sitz_warten.md): WAIT-BOUND
fired and PARK-RUNNING parked the running (status 200 every time: 16:52:21 ep12 ... 17:09:19 ep24),
but HANDOFF-N / PARK-RESUME ("the wait-bound-parked ones D resumes first") gave the seats back to the
same 5 long runs at every wake (weg2-0-5 18685 tokens 1375 s, weg2-1-12 21405 tokens 1618 s, 5-21,
10-34, 13-41 in every park list); all 20 D-REFILL freed_by=leg2_finished; waiters with leg 1 done
waited 255 -> 658 s, queued_d 4 -> 13; 12 of 17 client losses in 37 min were this seat wait.

Front (SGLANG_WEG2_SEAT_ROTATE, default on; 0 = parked resume first as before):
  * _seat_rotate_plan at the P->D wake (_wake_handoff_fields): waiters = leg-1-done requests in
    _ready_for_d waiting (since t_ready) past --d-wait-bound-s, oldest first; each takes the seat of
    the YOUNGEST parked (last admitted to a D seat, _d_admit_t). Not rotated out: a rid resumed in
    this or the previous phase (park-cycle dwell) or one deferred >= 2 phases (fairness: priority over
    new ones). Per pair "WEG2 SEAT-ROTATE rid_in rid_out reason=wait-bound waited_s bound_s epoch"; the
    deferred one's front seat is released ("D-REFILL freed_by=rotate") so d_admitter seats the waiter.
    The wake carries park_defer_rids and parked_n minus the deferred.
  * _seat_rotate_note_resume at PARK-RESUME: resumed rids (dwell epoch) / deferred count (fairness);
    "WEG2 PARK-RESUME-DEFERRED epoch n rids".
  * D-ADMIT carries seat_wait_s (now - t_ready for a leg-1-done request, t_arrive otherwise).
D (replicated: the wake object reaches every rank): io_struct ResumeMemoryOccupationReqInput.
park_defer_rids; d_park_runtime.note_wake_seats keeps it as weg2_park_defer; _apply_park_defer (in
admission, before order_waiting) clears the park site of each deferred rid where it is found (queue
or dormant hold) and moves it behind the queue -- ordinary waiting work, no barrier, not resumed
first; each rid once; logged "WEG2-D-PARK seat-rotate". The deferred requests' spans were secured by
PARK-RUNNING (forced host write-through, ref hold) -- the sgl-project#243 holder is not needed for them.
Kept apart from the handoff_pending seam (HS): this commit touches only seat assignment / PARK-RESUME.

Tests: test_weg2_seat_rotate_244_0927.py 10 (the NF shape: waiters 255/190 s take weg2-13-41 then
weg2-10-34, SEAT-ROTATE line, D-REFILL freed_by=rotate; wake fields park_defer_rids + parked_n 4;
no waiter past the bound -> nothing; dwell + fairness exclude the resumed / twice-deferred; switch
off; six phases of the 5-long-run sequence: every waiter seated within one phase, no rid rotated out
twice; D: deferred parked -> ordinary work at the tail, each rid once; the wake object sets the defer
set (27B n capped by d_bs, NF n = hand-offs + resumed parked); io_struct field; seat_wait_s wiring).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 27, 2026
…ont arrival -- seats by age with KV backfill, the next older moves in and displaces the youngest running one, every park victim is the youngest

User, verbatim (27.09.): "der request der zuletzt ankam wird zuletzt bedient, außer er passt zufällig in
einen sitz, weil er wenig kv verbraucht, ein anderer sitz der mehr kv brauchen würde aber nicht rechnen
kann und eigentlich vorher dran wäre, aber wegen des vrams nicht kann würde ja die leistung unnötig
verschwenden. sobald dann der älteste request fertig ist, rückt der zweitälteste nach, falls er vorher
parken musste und würde ggf. jüngere aktuell noch laufende requests verdrängen ganz oder teilweise".
e1eb275's selection (waiters past the bound take the seats of the LAST ADMITTED parked, dwell,
fairness counter) violated it and is replaced; its transport (wake field park_defer_rids, D-side
deferral, SEAT-ROTATE line, seat_wait_s) is kept.

weg2/seat_age.py (SGLANG_WEG2_SEAT_ROTATE, this semantics default on; 0 = parked resume first):
  * THE ORDER: the front's rid is weg2-<epoch>-<seq>, seq its arrival counter, kept by every re-route
    -- rid_age() reads the first arrival identically on the front and every D rank (no new field, no
    collective); plan_seats (oldest first, KV backfill), displace_victim (never a younger over an older).
Front:
  * _seat_rotate_plan at the P->D wake: seats (--d-bs) by age over the parked and the leg-1-done
    waiters; a parked one without a seat is deferred (front seat released, freed_by=rotate), "WEG2
    SEAT-ROTATE rid_in rid_out reason=age waited_s epoch" per pair;
  * d_admitter: _ready_for_d in age order; when the older head does not fit D's free KV
    (_d_token_budget_blocks), the first younger one that fits runs ("WEG2 SEAT-AGE BACKFILL rid_in
    older_blocked"); the older keeps the head for the next seat.
D (replicated inputs: rids, queue, running set, seat cap):
  * d_seats._arrival = the front arrival: park order, admission gate and retraction_order (the park
    victim is the YOUNGEST by arrival, never the last admitted);
  * _apply_park_defer places each deferred request before the first younger waiting one (the rest keeps
    the group's order) -- it moves in as soon as the older ones leave;
  * displace_for_age (every admission pass, both forms, before the nothing-parked early return): the
    oldest waiting request older than the youngest running one while every seat is held -> the youngest
    is parked WHOLE (release_req retain, pressure park, H91d draft save) -- "SEAT-AGE DISPLACE rid_out
    older_waiting"; under speculative decoding only the back of the batch may leave ("SEAT-AGE
    DISPLACE-WAIT");
  * the admission gate's barrier holds back only newcomers younger than the oldest parked one still
    waiting (an older one -- the one a displacement made room for -- goes first).
NOT BUILT, named follow-up: partial parking ("teilweise": only part of a request's KV out) does not
exist in this tree -- a displacement parks the whole request. Displacement is seat-triggered; a
KV-only shortfall with a free seat is covered by backfill + the stock pressure retraction (whose victim
is now the youngest by arrival).
Re-read of the NF finding under the new rule: the five long runs (weg2-0-5 ... 13-41) are OLDER than
the waiters, so they keep their seats; the waiters move in as each finishes -- the user's rule, pinned.

Tests: test_weg2_seat_age_244_0927.py 19 (rid age; plan oldest-first + backfill; never younger over
older; wake: 3 and 7 take the seats of 9 and 10, freed_by=rotate; the long-run shape keeps the old
seats; switch off; D: oldest done -> the parked second-oldest moves in and displaces the youngest
(released retained, pressure park, line); a younger waiter never displaces; free seat -> no
displacement; spec back-only; the barrier lets an older newcomer pass; park victim = youngest by
arrival; deferred placed by age; NF phase seat cap; kept sgl-project#244 transport (wake object 27B/NF, io_struct
field, seat_wait_s); wiring). test_weg2_seat_rotate_244_0927.py (the replaced selection) removed.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…ts aufgenommen hat

Metall: rc12z29b D 20:18:13, Wake 3, 5 WAKE-READ. Pass 0 nahm die zwei
flip-geparkten Resumes (bs=2, weg2-4-19/4-20), die drei Hold-Ankuenfte
desselben Wakes wurden bei freien Sitzen als Neue uebersprungen
(admit_partial left=3 weg2_d_park_first=3); Pass 1 kam 1895 ms spaeter.

Wurzel: d_seats.AdmissionGate.skip -- die Sperre wird einmal je Pass aus
den WARTENDEN Geparkten gebaut und stand noch, als diese schon im Batch
dieses Passes lagen.

Fix (Form aus 27Bs LS-Sitz, /root/.claude/jobs/1ab4cd30/tmp/
ap_park_barrier_admitted.diff): das Gate traegt parked_in_queue und
parked_outside; skip(req, admitted=<rids aus adder.can_run_list>) hebt die
Sperre, sobald jeder geparkte Queue-Request in diesem Pass aufgenommen ist.
Geparkte ausserhalb der Queue (Post-Wake-Settle), blockierte
Druck-Parks und ein nicht aufgenommener Geparkter halten sie weiter --
kein Neuer ueberholt einen Geparkten, der dann keinen Sitz bekaeme
(Ankunftsregel sgl-project#244/sgl-project#246). SGLANG_WEG2_D_PARK_BARRIER_ADMITTED, Default an;
0 = statische Sperre.

Tests test_weg2_d_park_barrier_admitted_ap_0928 (5): auf cfa8567 alle
rot (Verhalten: der Metallfall; die drei Waechter-Faelle scheitern dort an
der neuen Signatur, sie verriegeln die Ankunftsregel). Wiring-Pin in
test_weg2_d_park_scheduler_h91b nachgezogen.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 28, 2026
…ts aufgenommen hat

Metall: rc12z29b D 20:18:13, Wake 3, 5 WAKE-READ. Pass 0 nahm die zwei
flip-geparkten Resumes (bs=2, weg2-4-19/4-20), die drei Hold-Ankuenfte
desselben Wakes wurden bei freien Sitzen als Neue uebersprungen
(admit_partial left=3 weg2_d_park_first=3); Pass 1 kam 1895 ms spaeter.

Wurzel: d_seats.AdmissionGate.skip -- die Sperre wird einmal je Pass aus
den WARTENDEN Geparkten gebaut und stand noch, als diese schon im Batch
dieses Passes lagen.

Fix (Form aus 27Bs LS-Sitz, /root/.claude/jobs/1ab4cd30/tmp/
ap_park_barrier_admitted.diff): das Gate traegt parked_in_queue und
parked_outside; skip(req, admitted=<rids aus adder.can_run_list>) hebt die
Sperre, sobald jeder geparkte Queue-Request in diesem Pass aufgenommen ist.
Geparkte ausserhalb der Queue (Post-Wake-Settle), blockierte
Druck-Parks und ein nicht aufgenommener Geparkter halten sie weiter --
kein Neuer ueberholt einen Geparkten, der dann keinen Sitz bekaeme
(Ankunftsregel sgl-project#244/sgl-project#246). SGLANG_WEG2_D_PARK_BARRIER_ADMITTED, Default an;
0 = statische Sperre.

Tests test_weg2_d_park_barrier_admitted_ap_0928 (5): auf cfa8567 alle
rot (Verhalten: der Metallfall; die drei Waechter-Faelle scheitern dort an
der neuen Signatur, sie verriegeln die Ankunftsregel). Wiring-Pin in
test_weg2_d_park_scheduler_h91b nachgezogen.
WhiteCmile added a commit to WhiteCmile/sglang that referenced this pull request Dec 1, 2026
…ssue sgl-project#436, sgl-project#416 PR-8)

DT_PUBLISH_WORKER=1 (the default, owner Q17 of issue sgl-project#244) makes every
candidate push's stream work — copies, publish words, the cross-host post,
the completion record — run on the native publish worker thread instead of
the Draft scheduler thread. =0 issued it inline on the scheduler thread.
Nothing in sglang, dt-runtime, ci/ or the current analysis/ scripts ever
sets it to 0 (the only reference was a launcher env-forwarding assertion),
so the inline path is dead code.

Deletes the env read and the constant, the None alternative in
DraftCandidatePushTransport.__init__, submit()'s inline else-branch,
_publish_batch_memops (its only caller), the worker-absent half of
publish_cancelled()'s via_worker condition, enable_send_loop()'s
None return, the DT_DRAFT_SEND_LOOP mutual-exclusion raise in
dt_draft_engine._ensure_ring_worker, and the now-unreachable
CandidatePost.launch() plus the Python-side cuLaunchHostFunc binding
(_host_post() now resolves only the CUhostFn the worker launches).

Kept deliberately:
- _PublishWorker, csrc/dt_publish_worker.cpp and every dt_publish_worker_*
  symbol: this is the live path, not the switch.
- publish_cancelled()'s via_worker=False branch (the inline stream writes):
  selected by worker.batches_enabled, so it still serves methods without a
  send loop (sgl-project#416 PR-8 note), not by the deleted switch.
- _RemotePushEvent: still constructed by publish_cancelled()'s
  cross-host tombstone path.
- CandidatePost.post()/host_call(): live for tombstones and worker jobs.

No behaviour change on the default path: the worker was always created, so
submit() always took the _submit_to_worker branch and every guard I removed
was already true.

Tests: TestPublishMemopSequence exercised the publish-edge word sequence
through the deleted _publish_batch_memops; it becomes
TestPublishWordSequence and pins the same (address, value) sequence through
_publication_words, the generator the worker job is built from (the native
worker issues those words with cuStreamWriteValue32,
csrc/dt_publish_worker.cpp:300). FakeRuntime existed only to capture those
memops and is deleted with it. test_dt_publish_worker_gate.py's docstring
mentioned the switch; the gate contract it pins is unchanged.
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.

3 participants