Skip to content

Fix qwen config - #261

Merged
merrymercy merged 2 commits into
mainfrom
fix-qwen-config
Mar 11, 2024
Merged

merrymercy merged 2 commits into
mainfrom
fix-qwen-config

Conversation

@hnyls2002

Copy link
Copy Markdown
Collaborator

No description provided.

@hnyls2002

hnyls2002 commented Mar 5, 2024 •

Copy link
Copy Markdown
Collaborator Author

Also make vllm>=0.3.3

@hnyls2002
hnyls2002 requested a review from merrymercy March 5, 2024 11:24
@merrymercy
merrymercy merged commit a7ace9c into main Mar 11, 2024
@merrymercy
merrymercy deleted the fix-qwen-config branch March 11, 2024 01:54
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
vschandramourya pushed a commit to vschandramourya/sglang that referenced this pull request Feb 3, 2026
IzacharyI pushed a commit to IzacharyI/sglang that referenced this pull request May 7, 2026
* CI: fix request rate benchmark port defaults

Rewrite request rate benchmark runtime configs to use the matrix-assigned port and patch Python argparse defaults in the copied benchmark workspace so the wrapper no longer falls back to 8080.

* CI: cover request rate and 27B benchmark defaults

Extend the request rate runtime rewrite to patch Python port defaults and add the legacy 397B alias for non-397B jobs so the nightly matrix benchmarks stop falling back to the wrong port and tokenizer path.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
Both were invisible to the hermetic suite and fatal on a real boot.

1. Hybrid-GDN detection keyed on `mamba_archive_transfers`, which exists
   only on HiMambaRadixCache. `--enable-hierarchical-cache` on a hybrid SSM
   model builds a UnifiedRadixCache instead, so the attribute was absent,
   `hybrid_gdn` came out False, and the sgl-project#212 gate was disabled on BOTH
   sides: the manifest named no GDN blob, the source completeness check
   skipped its GDN clause, verify_import skipped its own, and the
   destination silently re-prefilled without the recurrent state. Keyed on
   `BasePrefixCache.supports_mamba()` now -- the capability every tree
   implements, so there is one source and nothing to drift.

   The test fake grew the same non-existent attribute, which is why the
   planted-omission falsifier passed while doing nothing on a real tree; it
   now implements `supports_mamba()` like the real trees. Verified as a
   falsifier: with the old detector restored, test_planted_gdn_omission_-
   fails_and_unparks and test_happy_path_export_commit FAIL; with the fix
   they pass. 51/51 hermetic tests pass.

2. `_snapshot` built its `RadixKey` from the plain JSON list that arrives
   over the control plane. `RadixKey.match` asserts both sides carry the
   same sequence type and every key already in the tree came from the
   scheduler's `array("q")` fill ids, so every live export aborted with a
   bare `AssertionError: (<class 'array.array'>, <class 'list'>)` before
   matching anything.

Card window (Qwen3.5-2B, GDN hybrid, two servers live throughout, one per
physical GPU): A-vs-A floor identical; export parks 1152 KV pages WITH the
GDN blob; source refuses the parked prefix while both servers keep serving
unrelated traffic; manifest-scoped umsharder byte-exact; verify_import
reports "GDN state present"; resume on the destination reports
cached_tokens=1152 (a real import, not a re-prefill) and the continuation
is byte-identical to the never-moved reference.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
…actually flyable

Four defects found by flying it; each one stopped the gate dead.

* A refused export raised an uncaught HTTPError, so the NAMED refusal in
  the 400 body -- the thing the negative arms exist to read -- was lost
  behind a traceback.

* On a hybrid-GDN model the resumable prefix ends at the deepest GDN
  checkpoint, not at the last generated token, so exporting the whole
  session is refused for almost any session length. The probe now asks
  once and re-exports at the boundary the server names (`--no-gdn-align`
  keeps the refusal for the negative arms, `--export-len` pins it by hand).

* The destination only prefetches a prefix from storage once it is at
  least UnifiedRadixCache.prefetch_threshold (256) tokens. The old seed
  produced 135 tokens, clamped to 128 by the GDN boundary, so
  --expect-cached could never pass -- for a reason with nothing to do with
  the handover. `--seed-prompt-tokens` pads the prompt with deterministic,
  content-stable filler; the gate defaults to 1200.

* The umsharder invocation was missing two flags that are wrong by
  default here: `--temporal-itemsize 4` (a bf16 Qwen3.5 checkpoint keeps
  the temporal SSM state in fp32 while conv stays bf16 -- the default 2
  aborts naming both numbers) and `--no-dcp-owner-mode` (a plain
  destination boot reads per-rank KV names; migrating under rank-shared
  names lets verify_import pass and step 6 silently re-prefill).

The gate script also fails loudly now when a hybrid manifest names no GDN
blob, rather than migrating on and reporting a vacuous byte match, and
documents why --expect-cached is load-bearing: without it a destination
that re-prefilled everything reproduces the same greedy tokens and the
comparison "passes" while proving nothing. Observed exactly that before
the fixes landed.

Flown end to end in one invocation: LIVE HANDOVER GATE PASSED.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 2, 2026
…gate-passed

FEATURE_CATALOG.md said "BRANCH-ONLY, NOT on the integration tip" -- update
to reflect the merge of feat/live-handover-261 (6a84806): GPU gate
passed with a real cached-tokens import (cached_tokens=1152 on resume,
byte-identical to a never-moved reference) and the hard GDN gate now keyed
on BasePrefixCache.supports_mamba(). The declared v1 limit (booted TP>1
destination still needs the offline manifest-scoped umsharder, page_size
== 1 inherited from dcp_owner_mode) is kept named, unchanged.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 5, 2026
Design only, no code. Records the mandate plus all three addenda as
requirements with falsifiers, and fixes the authority model: the planner
decides, the ledger is the denominator, every existing mechanism becomes a
sensor or an actuator. A slice that reimplements a carrier instead of driving
it has failed the mandate.

Addendum 3 becomes R6 and R7, both stated as error classes the design must be
structurally unable to commit rather than behaviours it should prefer:

R6 -- a state change re-SOLVES the cut (layer/TP split, draft placement,
KV/token vectors, phase layouts) under the new usage profile. Pool-only
squeezing is one candidate, not the search space. The planner may still choose
pool-only, but that must be its cost calculation under R5, never a structural
inability. F6 asserts on the CANDIDATE SET as well as the choice, because a
planner that picked correctly from a set of one is not implementing this; F6b
is the mirror, where pool-only wins on horizon and the planner must record
which re-cut it rejected and why.

R7 -- evacuation heat is PHASE-DEPENDENT, not static per item class. During
prefill everything decode-owned is cold and goes first; during decode the
ranking inverts. F7 is deliberately a PAIR (prefill-burst ranks decode graphs
below KV, decode-burst inverts) because a static ranking passes either case
alone. F7b adds imminence: at a prefill burst whose successor is decode, decode
graphs must NOT be evacuated -- separating 'phase-dependent' from 'reacts to
the instantaneous phase', which is a different and worse thing.

Carriers verified present in code before being built on: sgl-project#297 kv_ladder_auto,
sgl-project#485 uneven_perf, sgl-project#363 regime_act/regime_stages, sgl-project#261 scheduler:5063. Notably
regime_stages ALREADY classifies REGIME_PREFILL_HEAVY/REGIME_DECODE_HEAVY, so
R7 consumes that signal rather than adding a second phase detector -- a second
detector would be a new source of disagreement about what phase it is, the same
defect class as a second VRAM constant.

Slices 2-4 (enumeration, objective+movement cost, phase-dependent ranking) are
desk-provable in full; only slice 5 needs a card.

Open and named, not glossed: sgl-project#551 elastic co-residency has NO marker in
python/sglang/srt (only ANALYSE_553) and must be resolved before slice 5 plans
to drive it; R4's objective is marked CONFIRM because throughput and latency
can disagree and the design must not pick for the user; re-cut cost is not
measurable today and slice 3 must measure it or make it a fingerprinted
calibrated term, never a literal; the pressure ladder's autonomy overlaps the
planner's authority and slice 5 must resolve it or the two will fight over the
same pool under load.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…riant, refuse both guard flips

(a) ROOT, at file:line. transfer_item_warp moves bytes with 64-bit PTX --
ld.global.nc.b64 / st.global.cg.b64 (transfer.cu:29-30) -- which faults on a
misaligned address. The only alignment guard in the path is
TORCH_CHECK(item_size % 8 == 0) at transfer.cu:285.

That guard is sufficient for the lf_pf sibling and NOT for lf_ph, and the
difference is entirely in the offset arithmetic. I compared the two launcher
calls line by line (:496-513 against :532-551): identical empty tensors,
identical tables in identical slots, identical layout dims. But
get_global_offset_pf builds offsets only as multiples of item_size and
layout_dim, so alignment is inherited from the checked guard, while
get_global_offset_ph (transfer.cu:106-119) SUBDIVIDES by head_num in three of
its four terms and the page-head kernel copies head_size_bytes =
item_size / head_num (transfer.cu:145). Nothing requires that quotient to be
8-byte aligned.

MISSING INVARIANT: item_size % (8 * head_num) == 0. Smallest faulting shape
head_num=2 head_dim=2 fp16 -- item_size=8 passes the guard, head_size=4 does
not, 24 enumerated offsets misalign.

SCOPE, STATED RATHER THAN STRETCHED: this does NOT explain the reported
segfault. test_minimax_sparse_pool_host_unit's shapes (page_size=4, float32,
head_num=1, head_dim=2) give head_size=8 and zero misaligned offsets, and so
do this rig's serving shapes (head_num=4, head_dim=256, fp8 -> head_size=256).
The defect is real and latent; no production shape here is exposed. Both facts
are PINNED so the attribution cannot quietly widen.

Three hypotheses checked and closed on the way: the layer pointer table is
correctly a device uint64 tensor (mha.py:135-144); layout_dim is the right
per-token all-layer stride for the ph formula (mha.py:182); the k-only pool
cannot reach lf_ph, it raises for any non-page_first layout under the kernel
backend (mha.py:1113-1118).

Attribution needs metal, so the falsifier is FILED NOT RUN:
tools/441/falsify_lf_ph_441.py, three arms (repro / alignment / bisect), one
arm per invocation because each is expected to kill the process, to be run
under a gpu-arb claim.

(b) BOTH GUARDS: DO NOT FLIP. The brief's premise was that the sgl-project#436 rebuild
made them obsolete. Checking them at the code says otherwise, for two reasons,
neither of which is the ABI issue.

  test_kvcacheio.py:20-24 module skip claims "segfaults on CUDA 13.x". But the
  lf_ph segfault reproduces on BOTH wheels -- that is this ticket's own premise
  and why it is not sgl-project#436. So the reason is wrong or incomplete, and flipping
  would expose a live cu12 crash. It must stay until (a) is fixed; what should
  change now is the REASON STRING, because a wrong reason sends the next reader
  to the wrong wheel.

  _DIRECT_PF_BATCHCOPY_BROKEN_CUDA13 never guarded a wheel issue at all. Per
  the measured matrix above it, it guards a TEST-SHAPE violation of the
  cudaMemcpyBatchAsync contract: pageable+default stream fails, pinned+side
  stream is OK, and production pins (mha.py:97) and uses a side stream
  (cache_controller.py:276,:742-749). The file's own comment already says
  unskipping alone leaves it red. The rebuild landing does not change a
  contract the test violates by construction; the fix is a test-shape change,
  and verifying it is GPU work.

  PIN TESTS NOT WRITTEN, deliberately: a pin that "goes red if the breakage
  returns" presupposes the breakage is gone, and for both guards it is not.
  Writing them now would encode a green state that does not exist.

NOT DELIVERED: the sgl-project#261-Gate short-run script. Preparing it turnkey needs the
gate's shim details verified at the code, which I have not done, and shipping a
script I cannot stand behind would be worse than saying so.

Tests, hermetic (CUDA_VISIBLE_DEVICES="", no CUDA context, no launch, no GPU):
  test_page_head_offset_alignment_441.py  6 passed + 6 subtests in 0.07 s
    pure arithmetic transcription of get_global_offset_ph; states the proposed
    guard positively and fails if that predicate is not the right one
  test/registered/unit/mem_cache/  940 failed / 796 passed -- the 940 are
    PRE-EXISTING ON THIS BASE (b786858 lacks the sgl-project#585 conftest that turns
    no-accelerator errors into skips). Proven by re-running with my file
    ignored: 940 failed / 790 passed, i.e. identical failures and exactly my
    6 passes added.
  ruff clean; falsifier byte-compiles without executing.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…ason strings, file the host-tier gate

1. THE GUARD. check_page_head_alignment in csrc/kvcacheio/transfer.cu,
requiring item_size % (8 * head_num) == 0, called from BOTH page-head entries:
transfer_kv_all_layer_lf_ph and transfer_kv_per_layer_ph_lf. Guarding only the
reported one would have left the same asymmetry sgl-project#717 was reverted for -- a
defect that looks fixed from one side.

The message names the two facts that EXPLAIN the rule, not just the rule: the
.b64 PTX width (ld.global.nc.b64 / st.global.cg.b64 fault on a misaligned
address) and the subdividing offset formula (get_global_offset_ph divides three
of its four terms by head_num). A reader who learns only the rule works around
it by changing head_num.

Pinned: the predicate refuses the faulting shape (head_num=2 head_dim=2 fp16,
item_size=8 passes the OLD guard, head_size=4 does not), does NOT falsely
refuse the reported-crash shapes or this rig's shapes, and AGREES WITH ACTUAL
OFFSET ALIGNMENT on every shape -- so a future edit cannot keep the tests green
by tuning the constant. A source pin holds it wired at both entries.
MUTATION PROOF: unguarding one entry and weakening the predicate back to % 8
turns 2 pins red.

2. BOTH REASON STRINGS. test_kvcacheio.py's skip said "segfaults on CUDA 13.x".
It now states the evidence: reproduces on BOTH wheels, root NOT yet attributed,
the alignment defect found here is real but is NOT this crash's cause (these
shapes are aligned), and the metal falsifier is at tools/441/. The >= 13
condition is deliberately left as-is with the reason recorded -- widening it
would hide the cu12 signal the falsifier needs, removing it would hand CI a
known segfault.

test_minimax_sparse_pool_host_unit.py's batchcopy comment now LEADS with the
reading it previously only implied: the flag guards a CONTRACT VIOLATION
COMMITTED BY THE TEST, not a wheel, ABI or CUDA-13 bug, and the measured matrix
proves it because pinned+side-stream passes on the same wheel that fails the
other three. It says explicitly that the sgl-project#436 rebuild cannot make it obsolete,
since a rebuild cannot change a contract the test breaks by construction.

3. sgl-project#261 GATE: THE "SHIM" IS LOAD-BEARING. Verified at the code, which is what
was owed. Step 4 is `python -m sglang.srt.mem_cache.hicache_migrate` with
--target-tp-size / --target-ratios / GDN layout arguments. The live gate runs
source A at TP=1 and destination B at TP=N (live_handover_gate.sh:37), and
stored KV pages and GDN state blobs carry the SOURCE's shard geometry. Without
the conversion B is not reading the host tier the hard way -- it is handed
bytes in a layout it cannot interpret, and the run fails for a reason unrelated
to the host tier. So a no-shim 1->N run is structurally meaningless, which is
the stop condition the brief named; the cross-geometry handover IS the
umsharder.

What IS meaningful is holding the geometry EQUAL and dropping the migration:
no conversion is needed by construction and the host tier is what remains
under test -- write-through, park/export, prefetch, resume from cache,
byte-identical continuation. Weaker than the 1->N gate, and real.

Filed as scripts/handover/hostier_gate_noshim.sh, syntax-checked and refusing
cleanly on missing env, NOT RUN. Its preflight REFUSES when the two servers'
geometry/checkpoint differ rather than producing a red a reader could mistake
for a host-tier finding -- that refusal is the script's safety property. It
keeps the original gate's two load-bearing pieces: the A-vs-A floor FIRST (a
cross-server byte claim on a rig whose own repeat is not byte-identical is not
a claim about handover) and --expect-cached (without it a destination that
re-prefilled reproduces the same greedy tokens and the comparison passes while
proving nothing -- observed for real on the sgl-project#261 gate before it was added).

Tests, hermetic (CUDA_VISIBLE_DEVICES="", no CUDA context, no launch, no GPU,
no server contacted):
  test_page_head_offset_alignment_441.py  13 passed + 14 subtests in 0.07 s
  test/registered/unit/mem_cache/  940 failed / 803 passed -- the 940 are the
    unchanged PRE-EXISTING baseline on this base (b786858 lacks the sgl-project#585
    conftest); passes moved 796 -> 803, exactly the 7 new pins.
  ruff + codespell clean; the shell script passes bash -n; edited Python files
  byte-compile.

The C++ guard is NOT compiled here (no CUDA build in a hermetic run). Its
predicate is pinned arithmetically and its wiring by source inspection; a
compile rides the next kernel build.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…-- do not build, do not fork a third lineage

No code, by design. The slice was to build per-session KV export/import; the
prior-art gate says it is already built, so the deliverable is the
determination plus the catalog line.

WHAT EXISTS. session_handover.export_session_snapshot (:415 on
train/0818-desk-410-reconcile) -- "flush one session's KV pages AND its GDN
blob to the store, then emit the manifest that names every blob ... the whole
of sgl-project#261's SNAPSHOT phase, callable by anything that needs a session on stable
storage" -- with verify_import (:253) as its other half. session_checkpoint.py
states the rule that settles it: "There is exactly ONE session serialization
in this fork ... a second one would be a second thing to keep byte-correct."
Two consumers already ride it: sgl-project#410 checkpoints (tier, branch/rewind) and sgl-project#411
portable sessions (the same manifest as a manifest-first tar).

IT ALREADY ANSWERS THE CONCERNS RAISED AGAINST THE SLICE, none of which would
have needed adding:
  * owner rules / uneven-DCP -- GEOMETRY_FIELDS = ("tp_size", "page_size",
    "dcp_owner_mode"), page_size == 1 inherited FROM dcp_owner_mode, mismatch
    refused by name in verify_geometry, REFUSED_HOST_LAYOUTS = ("page_head",);
  * sgl-project#212 -- the GDN blob is named in the manifest and a hybrid-GDN export
    without it is refused;
  * it is not a duplicate of kv_session_offload, which is
    spill-to-keep-computing (resume flag default OFF) rather than the at-rest
    counterpart.

WHY THIS BRANCH STOPS. export_session_snapshot exists ONLY on the sgl-project#410/sgl-project#411
lineage; none of 682578f, 22ef67c, 35a68b2, 03adbf8 is in this
branch's ancestry. This branch has only the private method it was lifted from
(SessionHandoverRuntime._export, :446). Building here would create the second
serialization that module forbids, on top of a reconciliation another lane
owns and is mid-flight. Stopping and reporting, as instructed.

A CORRECTION OF MY OWN PHASE MAP, made in both places that carried it.
ANALYSE_329_cut2_phase_map.md listed per-session KV export AND import as
MISSING. Wrong the same way twice: I searched this branch's tree and read
absence-from-my-lineage as absence-from-the-fork -- the precise error the
prior-art gate's "grep the module name across git log --all + tree" clause
exists to catch, which I ran for session_checkpoint.py and then under-weighted
when it came back on other branches. Both rows now read EXISTS-other-lineage
with the file:line.

The correction SHRINKS what sgl-project#329 cut 2 still needs: not a mover, only the
per-session orchestration across the session table. world_roundtrip._Seams'
write_snapshot / read_snapshot are already exactly that seam, so no code in
world_roundtrip.py changes -- which is the cheapest possible confirmation that
the seam was cut in the right place.

LEFT, with its blocker named: wiring those two seams to
export_session_snapshot / verify_import per session, AFTER the A+B
reconciliation lands. The byte movement itself is a window item, under the
standing limit that GDN prefill is non-reproducible above ~109 tokens, so
identity is asserted on the STATE BLOB and never on generated output.

Also closes the catalog debt from 7d70249 (previous commit e962812) by
recording the determination where a future lane will hit it first.

Suite unchanged: test_world_roundtrip_329.py 29 passed, 8 subtests.
codespell clean on all three documents.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…eds a collective this runtime must not issue

Asked to implement per-rank manifest merging if desk-fundable, else leave a
named refusal and a filed residue. It is not desk-fundable, and the reason is
structural rather than a missing function.

The refusal already exists and already names the cause: session_checkpoint.py:654
and session_handover.py:608 refuse tp_size != 1 or pp_size != 1, the first
pointing at per-rank manifest merging as sgl-project#261's follow-up.

A TP>1 export must collect every rank's manifest, because each rank holds a
different KV shard under its own suffixed stems, and collecting them is a group
collective. SessionCheckpointRuntime is built to issue none:
session_checkpoint.py:548-552 states that it runs entirely on the scheduler
thread between scheduling iterations and that no group collective is issued
anywhere, which is the whole reason none of this needs a lock. Adding a
merge collective would put a rank-to-rank wait inside a control request handled
between scheduling iterations -- a scheduler stall on the slowest rank, and a
deadlock if a peer is mid-drain.

So the merge belongs with sgl-project#261's drain coordination, where that contract is
already being negotiated, not bolted onto a runtime whose safety depends on the
opposite property. Residue filed with its order: drain coordination first, then
a merged manifest keyed by shard, then import-side placement (the geometry gate
refuses a differing tp_size outright today, so a TP>1 bundle needs an identical
geometry or the umsharder, which inherits page_size == 1).

Also verified rather than assumed: the compat gate from Cuts 1-2 is a
COMPOSITION of verify_import + verify_geometry, not a second implementation --
Cut 2 had already removed Cut 1's hand-rolled duplicate -- and
IDENTITY_LAYOUT_GAP is quoted into identity refusals so a reader learns the gate
covers the kv-dtype NAME and not its byte layout.

Docs only. Cross-rig import remains the filed window item. No boots.
WhiteCmile added a commit to WhiteCmile/sglang that referenced this pull request Nov 8, 2026
…gl-project#261)

The five Draft-side read_done relay stamps (draft_source_done_queued/_held/
_batch_built/_batch_sent, draft_outbox_send_blocked) were measure-first
instrumentation for the relay-leg decomposition; the traced runs are done and
the per-leg numbers are in the issue report.  They built their arguments
(monotonic_ns, min/max over batch entries, the transfer_ids tuple) on every
ack batch even with profiling off, i.e. unconditional work on the default hot
path, and their presence in the round-0 A/B baseline left the default-path
cost versus main unvalidated (CI review p2).  Remove them; the branch is now
main plus only the mid-turn confirmation poll.
WhiteCmile added a commit to WhiteCmile/sglang that referenced this pull request Nov 8, 2026
CI full on PR sgl-project#262 (A/B vs dt-v3, xiaoyuan 3T2D, tracing off) measured the
mid-turn _poll_messages as a TPOT p90 regression at both rates and in both
interleaved rounds: r20 11.7 -> 12.2 ms (+3.8%, limit +3%), r24 +2.6%; the
whole distribution shifted (p50 +0.25 ms). Draft loop stats show why: at
r20 ~93% of loop turns idle-sleep, so in the base the Coordinator dispatch
copy is processed in idle-turn slack, while the fix moves that receive +
confirm + source-done flush work into the busy stretch right after
host_submit (~67k busy turns/run: poll_messages total +4.3 s, ~9.3 s of
idle_sleep displaced -> ~190 us longer busy turns) and the Target sees each
proposal round that much later. The 7T2D sweep (r52-r60) showed no TPOT win
for the mechanism either (hold p50 6.9 -> 4.8 ms only), so the change has no
regime where it pays for its critical-path cost. Reverting makes the branch
tree-identical to dt-v3; the measurement and the per-leg evidence stay in
REPORT.md, and the remaining elimination path (Coordinator parks acks that
arrive before their task record; Draft acks at ring take, no hold, no extra
busy-turn work) is documented there as follow-up.
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