Repository navigation
Allow more flexible assistant and system response - #1256
Merged
Merged
Conversation
zhyncs
requested review from
Ying1123,
hnyls2002,
merrymercy,
yichuan-w and
zhyncs
August 29, 2024 05:43
Contributor
|
BabyChouSr
marked this pull request as draft
August 29, 2024 05:55
merrymercy
marked this pull request as ready for review
August 29, 2024 06:05
merrymercy
previously approved these changes
Aug 29, 2024
Contributor
Author
Contributor
|
Does this PR fix #1265? |
Contributor
Author
Contributor
|
Hi @BabyChouSr May you add a unit test for this and run a benchmark? Thanks. |
Collaborator
|
These are good fixes! For your issue, see my comments #1265 (comment). Your fixes are still useful for other cases so we would like to merge this. Is this fully ready to be merged? |
Contributor
Author
Yes, I just added a unit test and after the tests pass, this is ready to be merged. |
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 11, 2026
…r acted upon A bug in my own S2 wiring, of the exact class this slice exists to remove. `_weg2_xchg_inject_from_peer` computed `wx.inject_mode()` and IGNORED `kw`, while one of its two callers passes the mode explicitly: `_weg2_xchg_shadow_compare` -- the step-6c grader -- calls `_weg2_xchg_inject_weights(mode=wx.INJECT_SHADOW)`. WHY IT WOULD HAVE STAYED INVISIBLE: on the S6I order's own argv the flag and the call site AGREE (`inject=shadow`), so the dropped argument produced the right answer. An argument published by a caller, read into `**kw`, and never consulted -- sgl-project#1256's shape, one level in from where I had just removed four instances of it. It would have surfaced only when the flag and the grader disagree, which is exactly when a grade matters. `mode = str(kw.get("mode") or "") or wx.inject_mode()`: the caller wins, the flag is the fallback, resolved once and passed down. AND THE CHAIN THAT MAKES ITEMS (a)/(c) REACHABLE IS NOW PINNED, because it is the answer to "why did four boots grade nothing": `_weg2_xchg_shadow_compare` fires under `exchange_armed() and inject_mode() == INJECT_SHADOW` -- the S6I argv -- and is itself called from this file. With S2's delegation in place it reaches `run_bounce_leg`, where `comparing = mode == INJECT_SHADOW` produces the `InjectVerdict` whose line IS grading item (a), and writes `bounce.bin` for item (c). MUTANT M10 (drop the caller's mode) fails `test_an_explicit_mode_from_the_caller_wins` by name. The test arms `authoritative` so the flag and the caller DISAGREE -- the only configuration that can tell "honoured the caller" from "recomputed and got lucky". Recorded because the first M10 attempt had a quote-escaping error in its own mutation script and reported SURVIVED against unmutated source: a mutant whose application is not verified is not a mutant. Same shape caught earlier on M4.
gjsheu
pushed a commit
to gjsheu/sglang
that referenced
this pull request
Sep 24, 2026
* support k3 on a5 Signed-off-by: zhaozx-cn <[email protected]> * refractor Signed-off-by: zhaozx-cn <[email protected]> * Run the shared-expert MLP on the alternate stream while keeping attention-TP all-gather and reduce-scatter on the current stream. * run fused_qkvg_proj with Kimi-K3-W4A8 quanted with modelslim * fix(npu): skip KDA autotune during first request (#2) * skip qkv_proj (#4) * fix spec acc Signed-off-by: zhaozx-cn <[email protected]> * k3 use fias v2 (sgl-project#6) * feat: support Kimi-K3 DSPARK PD decode radix cache (sgl-project#7) Co-authored-by: qyb233 <{"message":"Not Found","documentation_url":"https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user","status":"404"}> * fix(npu): use DeepEP MXFP8 dispatch for W4A8 MXFP MoE (sgl-project#11) * A5 k3 fp8 fused (sgl-project#13) * fix(npu): use DeepEP MXFP8 dispatch for W4A8 MXFP MoE * feat(npu): fuse K3 SiTU MXFP8 quantization --------- Co-authored-by: zhaozx-cn <[email protected]> * perf(npu): reuse graph update worker * fix(npu): use NPU chain rejection sampling for DSPARK * feat(npu): add fine-grained Kimi-K3 shared expert overlap * [NPU] Skip DSpark Mamba tracking when no boundary can be crossed * feat(npu): switch Ascend KDA extend to fused chunk_kda_fwd (sgl-project#30) Replace the multi-kernel Ascend KDA extend path (chunk_local_cumsum, chunk_kda_scaled_dot_kkt_fwd, solve_tril_npu, recompute_w_u_fwd_npu, chunk_gated_delta_rule_fwd_h_npu, chunk_gla_fwd_o_gk_npu) with a single torch.ops.npu.chunk_kda_fwd call. The fused op takes one initial state per logical sequence in contiguous [N, H, V, K] layout, while SGLang owns a slot-indexed persistent pool, so the wrapper gathers the active slots before the call and scatters final_state back afterwards. chunk_states comes back in the layout the tracker already expects, which drops the transpose on the intermediate-state path. Forward metadata uses -1 in cache_indices for a padded request. The gather would turn that into a read of the last cache slot, and index_copy_ would then write the padded row's final_state back over that same slot, corrupting the state of whichever live sequence owned it. Clamp the gather indices to 0 so a padded row reads a harmless placeholder, and filter padded rows out of the writeback entirely. Drop the speculative-decoding-only NPU transpose of temporal_state in MambaPool. It presented the pool as a transposed view so the stride-aware verify kernel and state movers saw the canonical [pool, HV, V, K] logical shape; the fused extend path consumes the pool directly in that layout, so every consumer now agrees on one contiguous representation. The adjacent shape comment described the swapped layout and is corrected with it. Also rewrite the conv_states copy for non-tracked entries as a no-op self-copy, so it no longer runs bool-mask indexing (aten::nonzero) or a host numel check on every step. * nz Signed-off-by: zhaozx-cn <[email protected]> * fix(npu): restore logical MLA prefix pages from NZ cache Unpack PA-NZ latent and RoPE cache pages before prefix projection and attention concatenation. Ordinary MLA writes can use NZ independently of MLAPO, so raw page gathers otherwise mix token and feature dimensions. Add CPU regression coverage for ND/NZ layouts, latent/RoPE dimensions, reordered and repeated pages, empty selections, and partial-page writes. Validated test bodies and forward_extend inputs in an isolated CPU PyTorch harness, including a legacy-path negative control; syntax and targeted Ruff checks passed. A5 GSM8K and NPU execution remain to be validated. * [Kimi-K3] Allow shared-expert TP subgroups below attention TP * revert kda triton kernel modification Signed-off-by: zhaozx-cn <[email protected]> * Revert "feat: support Kimi-K3 DSPARK PD decode radix cache (sgl-project#7)" This reverts commit e83efb3. * fix Signed-off-by: zhaozx-cn <[email protected]> * fix lint Signed-off-by: zhaozx-cn <[email protected]> * fix shares expert tp Signed-off-by: zhaozx-cn <[email protected]> * fix lint Signed-off-by: zhaozx-cn <[email protected]> * fix dispatch Signed-off-by: zhaozx-cn <[email protected]> * fix lint Signed-off-by: zhaozx-cn <[email protected]> * remove unused code Signed-off-by: zhaozx-cn <[email protected]> * fia v2 for mtp Signed-off-by: zhaozx-cn <[email protected]> * fia v2 Signed-off-by: zhaozx-cn <[email protected]> * fix kimi k3 pd acc on npu Signed-off-by: zhaozx-cn <[email protected]> * fix pd kimi k3 acc on npu Signed-off-by: zhaozx-cn <[email protected]> * fix ci Signed-off-by: zhaozx-cn <[email protected]> * fix Signed-off-by: zhaozx-cn <[email protected]> * fix ci Signed-off-by: zhaozx-cn <[email protected]> * fix Signed-off-by: zhaozx-cn <[email protected]> --------- Signed-off-by: zhaozx-cn <[email protected]> Co-authored-by: hanwlax <[email protected]> Co-authored-by: McZyWu <[email protected]> Co-authored-by: qyb233 <[email protected]> Co-authored-by: Hexq0210 <[email protected]> Co-authored-by: sherdavincl9 <[email protected]> Co-authored-by: sglang-npu-bot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
Right now system and assistant response are required to be in this format:
where
textis an instance of a string. We seek to add the additional flexibility of this format:Additionally, this PR also closes #1265.
Modifications
Checklist
CI States
Latest PR Test (Base): ❌ Missing
run-cilabel -- add it to run CI tests.Latest PR Test (Extra): ❌ Blocked --
run-ciis required first.