Skip to content

support speculative execution for openai API - #48

Merged
merrymercy merged 12 commits into
mainfrom
speculative-execution
Jan 25, 2024
Merged

merrymercy merged 12 commits into
mainfrom
speculative-execution

Conversation

@parasol-aser

Copy link
Copy Markdown
Contributor

No description provided.

@parasol-aser

parasol-aser commented Jan 18, 2024 •

Copy link
Copy Markdown
Contributor Author

this PR supports online speculative execution. the basic idea is to track what's returned in previous gen calls and match with the prefix text

  • if there is a match, reuse the completion and correct the name mapping

  • in the test openai_example_speculative.py, now OPENAI API is called only once, instead of three times

Construct a character. Here is an example:
Name: Steve Jobs. Birthday: February 24, 1955. Job: Apple CEO.
Please generate new Name, Birthday and Job.
Name:  Maya Rodriguez
Birthday: October 12, 1989
Job: Graphic

@merrymercy merrymercy changed the title support speculative execution support speculative execution for openai API Jan 19, 2024
@Ying1123
Ying1123 force-pushed the speculative-execution branch from d270252 to 6d0f7eb Compare January 24, 2024 21:26
@merrymercy
merrymercy merged commit 2395005 into main Jan 25, 2024
@merrymercy
merrymercy deleted the speculative-execution branch January 25, 2024 09:57
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
chunyuan-w pushed a commit to chunyuan-w/sglang that referenced this pull request Apr 11, 2025
yanbing-j added a commit to yanbing-j/sglang that referenced this pull request May 12, 2025
NorthmanPKU pushed a commit to NorthmanPKU/sglang that referenced this pull request May 16, 2025
…hreadblock levels (sgl-project#48)

* initial support for silu

* support square and srt

* add more forloop accum types

* minor fix for GQASpecDec example

* fix compile errors

* add an example for RMSNorm + Matmul

* add two examples to test fingerprints
yanbing-j added a commit to yanbing-j/sglang that referenced this pull request May 16, 2025
yanbing-j added a commit to yanbing-j/sglang that referenced this pull request May 19, 2025
pi314ever pushed a commit to pi314ever/sglang that referenced this pull request May 27, 2025
- Add SGLANG_ENABLE_TORCH_COMPILE to enable compile mode
  by default, without supplying --enable-torch-compile
  server argument

Signed-off-by: Rahul Vijayaraghavan <[email protected]>
Co-authored-by: Rahul Vijayaraghavan <[email protected]>
intervitens pushed a commit to intervitens/sglang that referenced this pull request Aug 31, 2025
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>
xq25478 pushed a commit to xq25478/sglang that referenced this pull request Apr 3, 2026
* chore: add zmq_communicator check

* fix: zmq_communicator init

* feat: tp for draft end

* chrome: set log only present in rank=0

* feat: tp for target end
wisclmy0611 pushed a commit that referenced this pull request Apr 7, 2026
* docs: simplify Developer Guide nav

* docs: fix sidebar title follow up
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 19, 2026
…ws held fixed (Task sgl-project#48)

The pool route holds a VRAM-sized number of hot rows per layer and rank
(resident slots + LRU rows), and its miss count is strongly non-linear in
the shard width: fn7p (base 312/104/96, hot 138/67/71) measured 2988/461/180
miss rows, i.e. 9.6/4.4/1.9 misses per owned expert. 'link' holds the
resident FRACTION and models every cold expert as fetched; 'time' keeps the
hot rows where they are and solves the widths so that misses_r/link_r is
equal on every rank (bisection on the common streaming time, monotone miss
model owned*(1-hot/owned)^gamma, largest-remainder rounding).

gamma is fitted in log space from SGLANG_MOE_TIME_MISS_ROWS (a prior boot's
per-rank miss rows at the base plan); unset -> 1. With fn7p's rows gamma is
2.11 and the solve moves 312/104/96 -> 242/147/123 (links 13.4/13.4/6.6),
a modelled 2.2x on the transfer clock. The launcher publishes the base
plan so resident_fraction_held_at_base_plan keeps each rank's resident
rows exactly as under 'link'; scratch/staging come from the same env the
pool reads.

Tests: tests/moe_offload/test_time_placement.py (6); suite tests/moe_offload 557 passed / 43 failed (baseline 43); link-solver suite 439: 97 passed, 1 pre-existing source-text failure (layer latch is a lambda since 4ea7958).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 19, 2026
…ero (Task sgl-project#47/sgl-project#48)

The cut solver took every tensor of a layer from the safetensors headers as
device weight. On Next Flash that is 512 INT4 experts (1.27 GB) plus a PLE
table per layer, so rank 0 was capped at 8 layers and every cut was refused
(W40, dry run nfdry4, 19.09.). Experts live in a device pool at a per-stage
resident fraction plus LRU rows; PLE is an mmap on disk and never reaches
the device.

checkpoint_weight_terms now measures '.mlp.experts.' and '.ple.' tensors
apart from the family means (expert_layer_weight_bytes, ple_layer_weight_bytes,
num_experts; zero on a dense checkpoint, whose terms are unchanged).
PhasePoolModel gets an optional per-stage weight_mib_per_layer_by_stage and
layer_mib(stage); the capacity term and rank 0's derived layer cap read it.
The launcher prices a checkpoint with experts per stage as dense mean +
experts * --pp-cut-expert-device-fraction + --pp-cut-expert-lru-rows rows,
and REFUSES by name when the fraction is missing -- no default, the same
discipline as the calibration. Dry run nfdry7: W40 gone, next stop W67
(ordered cut 39,13,12 off the frontier).

Tests: tests/moe_offload/test_pp_cut_expert_pool_term.py (3); suite
tests/moe_offload 564 passed / 43 failed (baseline 43); planner pp_cut unit
tests 169 passed / 6 failed -- the same 6 fail on the untouched snapshot
c5a5d50 (pre-existing, test_pp_cut_gapped_1240 / test_pp_cut_launch_1236).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 20, 2026
…ask sgl-project#48 C)

Two boots died at the VRAM edge on 19.09.: fn8h on TP0 (200 MiB wanted,
187 free, chunk 31 of a 259k prefill) and fn8i on a 3080 (520 MiB partials
buffer wanted, 481 free, 1.07 GiB reserved but fragmented). The KV sizer on
the --rank-gpu-memory-mib path books weights, mamba state, speculative
state and GGUF scratch and leaves ~1.9 GiB of slack; the prefill activation
transient measured by [vram-peak] is 1.69 GiB per rank at 8192-token
chunks, and allocator fragmentation takes the rest. The ledger's
activation reserve never runs on the uneven-DCP path (documented in
ServerArgs.activation_reserve_mb), so the hand-pinned answer was 'four LRU
rows fewer on TP0' -- a pin, not a term.

SGLANG_KV_BUDGET_PREFILL_TRANSIENT_MIB (scalar or one entry per rank) is
now subtracted from the budget's rest and printed as the post 'prefill
transient (measured)' in the KV budget posts line. Default unset = 0 =
byte-identical sizing. Next Flash forms carry 2240 (1.69 GiB measured +
0.5 GiB fragmentation air) and keep their LRU rows.

Tests: tests/moe_offload/test_prefill_transient_post.py (3); suite
tests/moe_offload 567 passed / 43 failed (baseline 43).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 20, 2026
…he per-rank pool from the global context ceiling

fn8am carried --max-total-tokens 90816, chosen as rank 0's physical pool need
(unit 8256 x ratio 11), and refused the needle:

  Input length (259415 tokens) exceeds the maximum allowed length (90810 ...

The POOLS were right -- "KV Cache is allocated ... #tokens: 31229" on the
ratio-11 ranks and 28390 on the ratio-10 one, i.e. C * ratio_r / S. The
CEILING was not.

ROOT, ModelRunnerKVCacheMixin._apply_token_constraints: --max-total-tokens is
applied TWICE to two different quantities. First to P_r, this rank's physical
token capacity. Then thirty lines later, inside the weighted uneven-DCP block,
to C = min_r(P_r // ratio_r) * S -- the GLOBAL context budget, which is what
max_req_input_len is built from (scheduler.py:5051 -> managers/utils.py:202).
90810 is (90816 // 10) * 10, rank 2's reconstructed share of the clamped C.
The block's own comment says C "becomes max_total_num_tokens (what the
scheduler admits and reports)" while "the per-rank pool + allocator are sized
from it separately" -- one scalar was driving both.

SGLANG_KV_POOL_CAP_TOKENS (scalar or per-rank vector) caps ONLY P_r.
--max-total-tokens keeps both of its meanings byte-identically, so no existing
recipe moves; unset, sizing is byte-identical. Refusal by name on an
unparsable value, a non-positive one, or a vector whose length does not match
the rank vector -- a pool cap that silently does nothing costs a GPU window
measuring the configuration it was meant to replace.

Capping P_r reaches the same pools through the unit relation and leaves C at
the projection: caps 90112,90112,81920 -> unit 8192 -> C 262144 -> pools
90112/90112/81920. That is the whole recipe, and the needle fits.

planner/expert_pool_budget.py follows: env() now emits the per-rank
SGLANG_KV_POOL_CAP_TOKENS and MAX_TOTAL_TOKENS as the WORLD number, and each
rank is charged its own share C * ratio_r / S instead of the global figure
(which over-charged rank 2 by a row and, worse, implied the flag was a pool
size).

vram_family_census.py: the [vram-peak] line now also prints
"cache = reserved - allocated", the fragmentation term
(memory_stats inactive_split_bytes.all.current) and num_alloc_retries. fn8am
rank 1 sat at 18.94 reserved against 12.06 allocated with 0.08 GiB free on the
card and expandable_segments:True on; three columns cannot say whether those
~6.9 GiB are CUDA-graph private pools or fragmentation, and the two need
different fixes. The next boot answers it instead of being argued about.

Tests: tests/moe_offload/test_kv_pool_cap_tokens_0920.py (12, fn8am numbers
verbatim, including a reproduction of the two-clamp arithmetic that produced
90810) plus the updated expert_pool_budget suite (35). Hermetic,
CUDA_VISIBLE_DEVICES="". Gate `pytest -q tests/moe_offload`: 43 failed, 622
passed, 41 skipped -- 43 failed is the unchanged baseline. black clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 20, 2026
…ows against the compacted pool

Revert of the length-check work (it was not a bug) plus the correction it
exposed.

WHAT WAS WRONG. This term read "KV pool sizing: available_bytes=4.73 GiB ->
max_total_num_tokens=358784" and "Uneven-DCP token sizing: rank 0 local
capacity 269995" as the pool a rank had ALLOCATED, and concluded that shrinking
it to the DCP need would free ~2.37 GiB per rank. Both numbers are CAPACITY.
Under the weighted owner rule the pool is already compacted to
dcp_compact_pool_rows(C, S, ratio_r) = (C // S + 1) * ratio_r (owner.py:155),
and the boot says so on its own allocation line:

  fn8aj  KV Cache is allocated ... #tokens: 90123 / 81930   (C = 262151)
  fn8am  KV Cache is allocated ... #tokens: 31229 / 28390   (C =  90816)

(262151 // 32 + 1) * 11 = 90123 exactly. fn8aj's pool was ALREADY the 1.19 GiB
its share needs; the credit was zero and the 2.37 GiB never existed -- measured
independently, fn8am had 5.0-5.4 GiB free per 3080 after the pools with the cap
and the same without it.

--max-total-tokens is C by design, and the per-rank pool is compacted from it.
fn8am set it to one rank's physical row count and so cut the context every
request may have (259415-token needle refused at 90810). That is the flag
working on a wrong input, not a defect: SGLANG_KV_POOL_CAP_TOKENS and its test
file are reverted, model_runner_kv_cache_mixin.py is byte-identical to before.

THE TERM NOW:

  transient_r = peak_alloc_deep_r - alloc_at_rest_r - extra_rows_r * row_bytes_r
  credit_r    = (rows_now_r - rows_needed_r) * cell_size     # 0, or NEGATIVE
  headroom_r  = card_free_after_pools_r + credit_r - transient_r - floor

* rows_now comes from the allocation line with the LARGEST K size, so fn8am's
  90816-token 0.02 GB draft pool cannot be mistaken for the 31229-token 0.18 GB
  main one.
* card_free_after_pools is the "[vram-peak] high-water (1 rows)" line -- the
  at-rest state once every pool exists (5.21/5.37/5.00 GiB on fn8am).
* the transient at CHUNK 8192 on a 3080 is ~4.4-4.7 GiB (fn8ak3's deep OOM at
  18.60 allocated, minus 11.85/12.25 at rest, minus the 18 rows that boot
  carried), not the 1.93 the [vram-peak] line calls "transient headroom used".
* the card-side reading (free at rest minus free at the worst moment: 5.37 ->
  0.08 = 5.29 GiB on rank 1) is computed and REPORTED beside it with the delta
  named -- it is stricter and it is the bound the OOM actually hit.

THE ANSWER IT GIVES, and it is a refusal: with the pool restored to the full
262144-token context there is NO headroom for extra rows at CHUNK 8192 on any
rank -- rank 2 short by 16 MiB, rank 1 by 119, rank 0 by 631. Halving CHUNK to
4096 buys +11 rows on rank 1 and +10 on rank 2 (only the non-graph half of the
transient scales; the 1.79 GiB of CUDA-graph private pools does not). The 5090
has no deep-prefill measurement anywhere and is refused rather than guessed.

survey_ranks() prints one line per rank including refusals, because
"rank 0 is short by 0.6 GiB" says nothing about whether the 3080s have room;
verify_scratch_vector() now checks the pool identity BEFORE the budget, so a
rank the budget cannot price still gets a verdict on whether its C is even
representable (which is what fn8ak died on).

Tests: tests/moe_offload/test_expert_pool_budget_0920.py rewritten around
fn8am's instrument lines verbatim, 24 hermetic tests
(CUDA_VISIBLE_DEVICES=""); they pin the compaction rule against both boots and
assert the no-headroom result. Gate `pytest -q tests/moe_offload`: 43 failed,
602 passed, 41 skipped -- 43 failed is the unchanged baseline. black clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 24, 2026
…emessene Transiente (fnFL2 sgl-project#114)

fnFL2x121/x122 (24.09.): die 5090-Stufe bootete mit Residenz 0.45 bzw. 0.40
bei Chunk 16384, passierte jeden Riegel (W120/W122, das KV-Sizing der Runtime)
und starb im ERSTEN Chunk-Forward mit CUDA-OOM (320 bzw. 384 MiB fehlend).
Beide Buecher preisten den 1024-MiB-Aktivierungsposten der Referenzboots
(Chunk 4096) auf einem 16384er Chunk; das eigene [vram-peak]-Instrument des
Boots misst dort 3,58 GiB, linear im Chunk auf jeder Stufe:

    PP0 (5090)  8192 -> 1,79 GiB   16384 -> 3,58 GiB   (x113/x116, x118)
    PP1 (3080)  8192 -> 1,59 GiB   16384 -> 3,19 GiB
    PP2 (3080)  8192 -> 1,21 GiB   16384 -> 2,43 GiB

x118 (0.26) ueberlebte nur, weil 7,5 GiB ungebuchte Luft hinter dem KV-Pool
blieben; x122 (0.40) hatte 2,4 GiB und starb.

Zwei Naehte, eine Messung:

* Pool-Modell (Dry-Run, Cut-Solver mit Pool-Boden Kappe+Chunk):
  activation_reserve_mib = max(1024, gemessene Transiente der bindenden
  Stufe fuer den Chunk, mit dem P bootet). --pp-cut-activation-reserve-mib
  pinnt weiterhin; unter Chunk <= 4096 bleibt die Rechnung byte-identisch
  zu sgl-project#1286. Eigene Provenienzzeile "PP-CUT activation post (sgl-project#114)".
* Rang-Env der Gruppe P: SGLANG_KV_BUDGET_PREFILL_TRANSIENT_MIB (der
  vorhandene Restposten des Sizers, Task sgl-project#48 C, bislang von niemandem
  gesetzt) traegt den gemessenen Vektor je Stufe; der Sizer zieht ihn vor
  dem KV-Pool ab. Operator-Wert gewinnt, andere Gruppen erben ihn nicht.
  In der Bestform x118 halten alle drei Stufen nach der Buchung weiter
  Kappe+Chunk (PP0 6,2 GiB Rest gegen 2,3 GiB KV, PP1 5,1/1,1, PP2 3,8/0,9).

Tests: test_weg2_p_prefill_transient_114.py (Messpunkte, Linearitaet,
Referenz-Floor, Pin, Env-Vektor und Rueckleser der Runtime, Gruppen-
Trennung). Gate der Hebel gruen.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 24, 2026
…ated fixture

Klassifikation (je Datei nur ihr eigener Test, via test27b.sh):

1. test_d_operating_points_1241 (1 rot) -- ECHTER kleiner Defekt, Nebenwirkung
   von d3e9625: launcher.py tippte das NEXTN-Spec-Literal ein zweites Mal
   (SPEC_FORM_DEFAULT / --spec-form choices) statt SPEC_ALGORITHM zu nennen;
   sgl-project#1241 MF-6 verlangt EINEN Schreiber je Spec-Literal. Fix: SPEC_FORM_DEFAULT
   = SPEC_ALGORITHM, choices=[SPEC_ALGORITHM, "DFLASH"]. Werte unveraendert.
   Ergebnis: 34 passed.

2. test_pp_cut_boot_sizing_1286 (1 rot) -- ECHTE Zensus-Luecke aus
   f3f9062 (Task sgl-project#48 C): der Runtime-Posten "prefill transient (measured)"
   (SGLANG_KV_BUDGET_PREFILL_TRANSIENT_MIB) fehlte in RUNTIME_BUDGET_POSTS,
   der Planer-Zensus nannte ihn nicht. Fix: Posten mit Status "not modelled --
   0 unless the group env books ..." eingetragen (auf der 27B-Linie 0).
   Ergebnis: 44 passed.

3. test_coresidence_budget_mapping (5 rot) -- VERALTETE Fixture, kein Defekt:
   _FakeRunner/_FakeServerArgs kannten drei spaeter hinzugekommene Namen
   nicht: _read_corridor_card_free_bytes / _gapped_corridor_holdback
   (7b775eb sgl-project#602, 7ac9673 sgl-project#753; an die echten Mixin-Methoden gebunden),
   _nvml_process_reach_gb (518f9f3 sgl-project#631; None = dokumentierte "NVML sagt
   nichts"-Antwort, Fallback auf die alte Arithmetik) und
   server_args.capture_reserve_mb (153fc05 sgl-project#1025; nur beruehrt, nie
   subtrahiert -> 0.0). Assertions unveraendert. Ergebnis: 8 passed.

pp_family_cut_485 (2 rot) ist vorbestehend und nicht Teil dieses Auftrags.
dayanandav added a commit to dayanandav/sglang that referenced this pull request Nov 13, 2026
Adds --moe-a2a-backend deepep on Intel XPU, using deep_symm.moe_ep from
applications.ai.gpu.deepsymm (DeepSymm). Intranode only: buffers are
exchanged over PCIe P2P, so neither iSHMEM nor an RDMA NIC is needed.
Supports --deepep-mode normal, low_latency and auto.

Runtime
- hardware_backend/xpu/deepsymm.py: import_deepsymm_moe_ep() requires the
  deep-symm distribution and imports deep_symm.moe_ep (DeepSymm sgl-project#48 and
  later); errors name the source and tested revision.
- moe_hook.py: XPU validation at startup (DeepSymm import, --nnodes 1,
  BF16 dispatch, no TBO/SBO, low-latency per-rank token cap vs
  --chunked-prefill-size); decode XPU graph disabled for every mode.
- deepep.py: PCIe buffer sizing for normal and intranode low-latency in
  one shared buffer (num_rdma_bytes=0); 1/2/4/8 ranks for low-latency;
  runtime per-rank token bound check, which deep_symm.moe_ep does not do;
  CUDA-style --deepep-config keys translated; import failures deferred.
- ep_moe/layer.py: XPU experts run in quant_method.apply; quantized
  checkpoints are rejected at startup.
- unquant.py: XPU expert steps. Normal: remote slots keep a valid expert
  id at weight 0, no host sync. Low-latency: gather the valid rows of the
  masked layout and run them token-major. The standard (no a2a backend)
  path does the same for the -1 ids EP marks remote experts with.
  sgl-kernel-xpu fused_experts must never see expert id -1: it reads out
  of bounds (sgl-project/sgl-kernel-xpu#562). XPU fused_experts runs in
  chunks of at most 4096 rows: its workspace grows with rows * top-k, and
  8-rank prefill (DeepEP normal, AG/RS) otherwise ran out of device memory
  (UR_RESULT_ERROR_OUT_OF_RESOURCES).

Tests and docs
- test/registered/e2e/moe/test_deepep_modes_qwen3_30b_a3b.py: one
  device-agnostic test for CUDA and XPU; TP=4 baseline plus normal,
  low_latency and auto; sgl-eval GSM8K and a serving benchmark, each
  printing a DEEPEP_MODES_RESULT JSON line for cross-device comparison.
- test_deepep_intranode.py / test_deepep_utils.py run on XPU.
- docs/docs/hardware-platforms/xpu.mdx: install, modes, limits, and
  --mem-fraction-static 0.70 for normal mode on 8 x 24 GB cards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
yangxin-mx pushed a commit to MetaX-MACA/sglang that referenced this pull request Dec 2, 2026
将 mx/dev-0.5.19 中与 GLM5Next 相关的迁移及必要修复合并到一个提交,
基于 mx/dev-0.5.21 的 9b491a645e,保留 target 新 CP/API 架构。
按原迁移表顺序核对62条:35条迁移/适配/必要依赖,27条已有覆盖或按表跳过。

迁移/适配明细(编号为原表序号;Source 为真实 source commit):

- #1 Source: 90fc47afb93b52ee2e17db94ff81c70ca355c510
  内容:为 DSA/MHA 分支补 idle 守卫,避免 DP idle batch 误入 MHA 路径。

- #7 Source: ede708204940def467c753ab97f22b098104c8d8
  内容:移植 prefill attention 的 FA2 在线 softmax 归一化和 MACA 非因果128x32调度;按实测
    将大 head_dim 的 MACA tile 缩为32x32,保留非MACA调度。

- #8 Source: 251667008296ead929e477c3d31acfcaaea3822d
  内容:MACA 非因果 attention 的 num_stages 从2降为1,与 FA2 tile 调度配套,降低共享内存需
    求。

- #9 Source: 04827865d580a1bb9b64815fab861e03f2eb2666
  内容:迁移 Hadamard/INT8 GEMM 自定义算子注册;修正 fake out_shape、C 写入声明及 Optional
    bias,保留平台守卫。

- #13 Source: f9d0b9622970734bba00fd3a44aff1a0394bb060
  内容:为 GLM5Next CUDA/XPU 路径补默认模型 dtype;使用 target config view 读取 hf_config
    ,保留用户显式 dtype。

- sgl-project#26 Source: 8a6ae864a3cebad6e272fd2541459a8510eb12f4
  内容:补齐 INT8 MQA 的 triton/tilelang/maca_c 后端选择器及校验,接入 paged、ragged、
    chunked prefill 和 CP 调用;补 GEMM_BF16 开关。

- sgl-project#27 Source: 7b58f8233d38e5469ae211cbf1176e4721817c47
  内容:迁移 W8A8 fused RMSNorm tuple 输入兼容,按 tuple 首项区分旧元数据;保留三维输入支
    持及 MQA 后端校验。

- sgl-project#28 Source: 74505cf936776c09f0786d4b301e1467b031a3d6
  内容:修正 MLA/q_lora 的 fused tuple 元数据识别,补 BF16 passthrough 解包,避免 tuple 进
    入 Tensor 投影路径。

- sgl-project#30 Source: 150bc2fdd022abf7684fc848043f2f0c7d4d45da
  内容:适配 GLM5Next W8A8 ignore mapper 与主模型/vision/NextN prefix;移植 KDA CP×
    attention-TP head 分片和 Mooncake 状态范围/stride/PP-layer 映射。修复新版 KPool
    full-key/local-query 接线、padding、FP8 dtype 及未初始化变量,保留复制状态 CP0 去重。

- sgl-project#31 Source: daf920081d8f65ca1925ccbefc39b6708fcdae02
  内容:迁移 GLM5Next/NextN fused RMSNorm、packed quant 与 mHC input 守卫;packed mHC 无
    residual 时补零并保留返回契约。

- sgl-project#32 Source: 3b81f1f4bc7ae595076ac31c777838ceaa14fc65
  内容:迁移 C500/C550 SplitKV、MACA smem 调度、mcoplib DSA/KDA、CPU token count、ln/log2
    转换、grouped_topk/fake 与 varlen SiLU;适配新增 track_state/inplace_update,修复
    SplitKV 三参数调用兼容。

- sgl-project#33 Source: e24ab0bb93eac50f134466c309b18a76108e8efb
  内容:迁移 FP8 fused norm/activation quant;修复 column_major_scales 传递与 TMA 对齐守卫
    、MLP 融合资格门控和 FP8 consumer tuple 选择,保留目标回退。

- sgl-project#35 Source: 126685db6e84f81eb337df29a06ae47efcb4ab0c
  内容:核验 KPool mcoplib 特性使用模块级 torch 导入,不引入 source 的局部 import 作用域错
    误。

- sgl-project#37 Source: c47a8a23daa1e5779a81ca5172021e582450f7f6
  内容:迁移 logits 显存预算刷新和 empty_cache;补 CUDA graph capture 守卫,避免捕获期间执
    行主机同步/缓存清理,保留 HIP 上限。

- sgl-project#38 Source: 891b2eda664e3a4dbae0f81ffa028087caf0be29
  内容:迁移 mcoplib AOT KPool 路径到 target kernels 目录,完整保留参数;用 EnvBool 处理开
    关,避免值0仍启用。

- sgl-project#39 Source: 9e74fa0504e402507671b703ec6e365728ee3f41
  内容:迁移 MTP metadata glue/seed merge,缺失行补零;保留 DSA/KPool/page/topk 等资格限制
    、静态图输入、eager fallback 及 target future_indices 接口。

- sgl-project#40 Source: 049fc02d18940d4c021281b1b54d4843b3ea0d57
  内容:迁移 MoE sum-add 从 shared_output 到 dispatch/runner/kernel 的接线及 INT8
    quant-once;保留 EP/TP/LoRA/no_combine/graph 回退,修正 shared_experts 属性守卫。

- sgl-project#41 Source: 8f5580f02634c1e6536e6925559f8a2a8f7b9b75
  内容:迁移 KDA BF16 投影融合资格、local N 对齐、加载后 padding 清零及 forward slice;初
    始化非融合分支属性,避免权重加载崩溃。

- sgl-project#43 Source: 1297d124af95d1df6f8c28ee20ee8b7c40177a26
  内容:迁移 optimized FP8 KV QDQ 及 STORE 开关;对 INT8、NoPE、非标准行宽和 rope=None 保
    留通用算子回退,避免全局别名误路由。

- sgl-project#45 Source: b48329742ca890d6d00692d4ea03160db56b661e
  内容:补齐 ragged/prefix-hit selected dequant:新增 GPU mark_selected_kv_rows 和 helper
    ;非法索引置-1,保持静态 shape、row mask、INT8/FP8 支持且无 host sync。

- sgl-project#46 Source: 033598e00ca324e084cdff89a4107f4d3e8e009e
  内容:迁移 TileLang FP8 KV 的 selected-dequant→BF16-kernel 路径,以 pool dtype 判断并保
    留 INT8/TopK 对齐;补显式 MACA FP8 反量化参数例外,保留 NVIDIA/HIP/sink 限制。

- sgl-project#47 Source: 78d6a6d53bf52d938bea469f658be8c561addc6b
  内容:补齐 optimized QDQ 必需的 NoPE 依赖:rope=None/空 rope、528B/656B 行宽派生及
    DIM_ROPE 条件;保留 INT8/其他布局通用回退。

- sgl-project#49 Source: bcca3bc2a68e0e7fab28f826652d14be0118ffd7
  内容:补迁 MX_USE_INDEXER_LOGITS_OPT(默认True)及 MACA FP8 logits 的 maca_c/triton 路由
    ,覆盖 paged、ragged、chunked prefill/CP,保留 INT8 和非MACA行为。

- sgl-project#50 Source: e15a1dd543c0d724b5af3221bde8465d95dfacf1
  内容:迁移 alt-stream 开关、MLA norm consumer 门控和 BF16 passthrough;补齐
    _weights_proj/x_for_gate 旁路,避免多余 FP8 反量化。

- sgl-project#51 Source: 24824a0a86f8e0036ea770377a4a4068b9dbf23e
  内容:按原表移植上游5733bcaad32的 HiCache host-pool 声明,保留 target
    StackStrategy/unified 扩展;补实际 index buffer dtype/宽度探测,修正 BF16 元素/字节
    stride。

- sgl-project#52 Source: caa3b73f5fbd061f19db5d01b422fe727299413e
  内容:迁移 hybrid KV+INDEXER+MAMBA host 栈、owned-layer/PP stage-local 映射、packed draft/sidecar 登记和声明覆盖校验,适配 target controller API。

- sgl-project#53 Source: 69b77095f7141e60070bfe7e53180ab82163574c
  内容:迁移六个 C500 KDA/conv kernel 及包装器;对 target 新
    track_state/inplace_update/beta 语义设置资格守卫与回退,保留 mcoplib 互斥。

- sgl-project#54 Source: 30bedf83aaa4c7127a6caa454cc859bf14d7805e
  内容:迁移 request-shared selected dequant;修正同请求所有 query 共用相同槽的假设,相同
    槽复用、不同 KPool tail 保留独立行,以静态容量/row mask 保证正确性。

- sgl-project#55 Source: eaf4cf1ab6e050e57b1601ba9c81b83ddaede089
  内容:延迟导入 KDA,仅在 Kimi 非NPU或 GLM5Next 路径加载,保留 Ascend 及其他
    linear-attention 后端。

- sgl-project#56 Source: 3687cf0cca0dcb84e031b3ab9565eb71eacaa6c0
  内容:抽出 C500 KDA 轻量配置和延迟导入开关;配套 optional-import 验证材料独立保存在仓库外。

- sgl-project#57 Source: fc708361eee03357f665bc09836a5477d218e2e8
  内容:迁移 mcoplib per_token_cast AOT 注册和 MLP SiLU 列主序 FP8 scale;与#33合并修复列
    主序/TMA 守卫,保留动态/融合/UE8M0 回退。

- sgl-project#58 Source: 9a8d3013dbfce88b219661d8798c7486a8a03a3a
  内容:迁移 MACA 3.10 的 FP8-MMA 能力判定(sm87/88/89 与80/86区分);非原生设备使用
    selected dequant 并补齐 page64,限制在 MACA FlashMLA 路径。

- sgl-project#59 Source: 49b8de76fbdc929bda5c03869c29bdfe37f97cdc
  内容:补迁 config-driven W4A8 QuaRot:主干末端/NextN shared_head 先完成 residual stream
    归约与清理,再 rotation→norm;登记两套 NextN rotation 权重,复用已有算子。

- sgl-project#61 Source: 039732e9a01ad42eba7c04c06c731d344708da1d
  内容:迁移 masked SiLU FP8 mcoplib 算子、FP32 scales 和列主序选项;保留特殊 activation、
    UE8M0 及目标 JIT 回退。

- sgl-project#62 Source: cada5f0f72e860376168544b3ce33ea660317147
  内容:迁移两个 GLM/KPool alt-stream kill-switch;旧 draft handoff wait 已无落点,保留
    target verify plan-stream 的正确性等待,不删除有效同步。

已核验但不重复迁移的条目(不计为新增移植):

- #2 Source: 22cf8d913ac1483bf6fa4b422b4a324b8aacc27a
  处理:target 已有 INT8/FP8/BF16 index cache dtype 配置、存储映射和环境变量,不重复移植。

- #3 Source: 24fd61059835d20f9e0dcd9d1a1cd454c76fe726
  处理:target 新 CP 的 world_group 广播统一解包已覆盖旧 scheduler 修复。

- #4 Source: 18771c6405169ba6a7d0b25f28c467bb47b1321b
  处理:target 通过 extend_seq_lens/input_ids 构建 CP metadata,不恢复旧 global
    token-count 逻辑。

- #5 Source: 2a209dffdd6d19466fb01428c541ab5fff513576
  处理:保留 target GDN chunk-H num_stages 默认2;C550 部署脚本设置为1,避免共享内存超限。

- #6 Source: c54a1a09ebe3f6e025f665a22e1ab6a78053bc05
  处理:target 已有 DSA update_verify_buffers_to_fill_after_draft 钩子。

- #10 Source: 68bfa76e0edbaf39b095e4271ba5d92faa2fe0e7
  处理:target 已有正规 MACA/mcoplib AOT 注册,跳过 source 的临时 sampling 导入注释。

- #11 Source: 385411126ba4a03c28a4c543184374b817fa5bc9
  处理:原表禁止迁移的 bring-up hack 不迁入;保留真实量化、layernorm 和正规 MACA 支持。

- #12 Source: 19061bd747bdb716f750b7fcf293decc915a30bf
  处理:target 已重放 W8A8/KPool dtype 及模型 prefix 基础支持;后续 mapper 兼容修复计入sgl-project#30
    。

- #14 Source: 6e5cf1875bbba5f7bc37118a990f6d60a9ab6146
  处理:target 已有 GLM5.3 主模型/NextN 架构识别、层名与 prefix 适配。

- #15 Source: bb18010c11efdc38c52f14030d1bdd3a11e5592f
  处理:target 已有 INT8 ragged KPool logits 和 dtype 分派,保留新版 CP 实现。

- #16 Source: 0bbba0f8d9261f83f56e901b67be5a0fa9906aa9
  处理:target 已覆盖 MACA head_tile=16 及 INT8/FP8 CP/paged/ragged 分派。

- sgl-project#17 Source: 3ff8eca05fb3830e3fafa7c49ae9a63c03b1dd49
  处理:target 已完成相关 API 重构、KPool dtype 修复与 grouped_topk fallback,不迁回旧接口
    。

- sgl-project#18 Source: 97bac43d8cb9f21f660ea8eb89f5a63edbe597c4
  处理:target 已直接读取 enable_dp_lm_head,消除旧 get_parallel().config 访问。

- sgl-project#19 Source: d5833f123353343c2204d8c0f9953859906c2392
  处理:target 已有 mamba_chunk_size 懒读取,并去除重复 initial_state_indices 参数。

- sgl-project#20 Source: a59e91e76a4207566de6ecf4594de1139364e920
  处理:按原表明确不迁移图像预处理提交;本次 CP 多模态边界修复独立列在适配说明中。

- sgl-project#21 Source: ec70e92a479ea8f1f2ce4bfc32c7f31bf045fd5a
  处理:target 已有 norm_weight=None 时的 mhc_pre_vllm 回退。

- sgl-project#22 Source: 4deb87b34229438f0382687e2ed22f6f8c875227
  处理:target 已覆盖 layernorm AOT bytes、残差别名和 fake 注册,保留其 MACA metadata 守卫
    。

- sgl-project#23 Source: 5feccf7f43420e3db9c40599b8eabc7fed3f0e38
  处理:target W8A8 已支持三维 VLM 输入展平及输出形状恢复。

- sgl-project#24 Source: fb8a2c30228735ce68ba8a90feaefddddad96ee0
  处理:target 已有 INT8 KV 量化/反量化、packed layout、memory pool 及 rope0/64 全栈支持。

- sgl-project#25 Source: 705896cb9e098ecf4778b5d5d2850a9e5e7442fe
  处理:保留 target 更精细的 MACA flashmla_kv 默认选择及 GLM5.3 INT8 例外。

- sgl-project#29 Source: b2bc0c0a198bd7b4eaac14b1d3071a305986f0ac
  处理:target 已有 INT8 属性保护,旧 mamba_branching_seqlen 清理落点已删除。

- sgl-project#34 Source: e9ce0de76ecacb6c3d867b90f9bf1120d2c3d974
  处理:target 不再向只读 logical_size/logical_page_size 赋值,已覆盖 source 修复。

- sgl-project#36 Source: 9e2d4fa7b9657dc8c5bb24e0bfbd302456885d10
  处理:target 已在访问 dtype 前判断 tuple,覆盖 FP8 MoE 崩溃;原表 full hash 有误,本列表
    使用唯一前缀解析后的真实 source commit。

- sgl-project#42 Source: a1a845df4b8f281b243d542ab39b46e754463cc2
  处理:保留 target 新 CP/prefix-cache 框架,不恢复旧 CP-V2/radix bypass;缺口随#30修复并
    验证前缀命中。

- sgl-project#44 Source: 2b20e9a0312dadc751b14ffe4bba7736750bd5b1
  处理:target 新 CP 仅在 context-parallel extend 生效,verify/draft 不进入 CP;保留现有
    padding 框架。

- sgl-project#48 Source: 18b3a7260ed85c95c1a6be87f652b7f89a75c91b
  处理:target 已由 hybrid_kda_config 和 cache_params.is_kda 覆盖模型识别、state
    ring/intermediate_ssm,保留 ReplaySSM。

- sgl-project#60 Source: 7c37c8ed18e9cea67e4a3f7eb564571226d0583b
  处理:target 已重放 GLM5.3 INT8 架构、528B/rope0/64、ragged/paged 和 selected-dequant 支
    持,保留新 metadata/HiCache 接口。

0.5.21 接口适配补充:
- 补 GLM prepare_cp_inputs:CP分片前复用完整多模态embedding,
  runner使用hook返回的positions并保留kwargs,后续PP stage消费proxy。

Change-Id: I5bda468525cc09d9f74598fcdd69d07764b6ecf3
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