Repository navigation
Conversation
McZyWu
requested review from
hebiao064,
yizhang2077 and
yuan-luo
as code owners
August 29, 2026 04:56
Contributor
Author
|
/tag-and-rerun-ci |
This branch has not been deployed
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.
Summary
Avoid running the CUDA-oriented Triton autotune search for the Kimi-K3 FLA cumsum/KDA kernels on Ascend. The NPU path launches the raw JIT kernels with the A3 configurations validated below; CUDA, ROCm, Intel XPU, and other non-NPU backends keep the existing autotuned wrappers.
This is intentionally limited to the operator layer:
chunk_local_cumsum_vector:BS=64,num_warps=4,num_stages=3BK=64,num_warps=4,num_stages=3num_warps=4,num_stages=3sglang.srt.utils.is_npu()Why
The K3 CI failure has two different Triton Ascend behaviors that should not be conflated:
chunk_kda_scaled_dot_kkt_fwd -> triton.autotuner.do_bench -> torch_npu.synchronize.triton_ascend==3.2.2, the autotuner/JIT can finish. Fresh-cache stack samples progressed through cumsum, KDA, recompute/state kernels, and later operators; the cache file count kept increasing. However, the first request still spent a long time compiling/benchmarking CUDA-style candidates independently on each of the four nodes. While one node was inlinalg_to_bin_enable_npu_compile_A2_A3, peers waited in model forward / DP collectives, the detokenizer heartbeat could become stale, and/healthtemporarily returned 503.The public kernels currently enumerate 18 cumsum configs, 24 KDA inter configs, and 4 KDA intra configs for each new autotune key. This PR preserves that search for non-NPU backends and avoids it only on Ascend.
Four-node validation
Environment:
sgl-project/sglang@5f216fc33f315ade378bc7cd295ee88f5322d4d32d8484740d5e...), #36603 (69a49fede863...)sglwmc-813triton_ascend-3.2.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whlbb02d9eb2181172f783aefdb2b4505fb7c52bf93c506d43290bac58b2b3f4e7eon all four nodestriton.__version__ == 3.2.0, Python 3.12/home/weights/Kimi-K3-w4a8-int-moe, ModelSlim W4A8/home/weights/Kimi-K3-DSpark, DSpark--attention-backend ascend --linear-attn-verify-backend triton --tp-size 64 --enable-dp-attention --dp-size 4 --moe-a2a-backend deepep --speculative-algorithm DSPARK --cuda-graph-bs 11 16Each run used a new per-node
TRITON_CACHE_DIR; no compiled Triton cache was shared across nodes.No-code baseline on Triton Ascend 3.2.2
linalg_to_bin_enable_npu_compile_A2_A3; other nodes were in model forward / DP synchronization. A later sample showed DP ranks entering the twomaybe_prepare_mlp_sync_batchall-gathers from different scheduler sites.This proves that 3.2.2 can compile the operators; changing only the package version did not make the fresh-cache service reliably ready within the observed window.
Patched fresh-cache run
The temporary 503 is a stale-heartbeat symptom while another node is doing first-use JIT; it is not evidence that the 3.2.2 compiler or the patched kernel is permanently stuck. The external request completed once the lagging node finished compilation.
Operator numerical smoke
Single-NPU tests compared the patched operators against Torch references using a new Triton cache:
0.000000000.000000020.00000000Result:
operator_smoke=PASS.GSM8K-200
Command parameters: 5-shot, 200 questions,
max_new_tokens=512, parallel=128, temperature=0.The patched run intentionally started from fresh per-node caches. Its first GSM8K completion took 87.81 s while a lagging node compiled additional input-shape kernels, so this end-to-end throughput is not a hot-cache performance comparison. Correctness did not regress, all 200 requests completed, and the service remained healthy afterward.
Compatibility with #35314
#35314 is an ancestor of this branch. There is no changed-file overlap: #35314 adds K3/DeepSeek SSD expert-pack and GGUF loader/model paths, whereas this PR changes only:
python/sglang/kernels/ops/attention/fla/cumsum.pypython/sglang/kernels/ops/attention/fla/kda.pyNo weight loading, SSD, expert-pack, GGUF, quantization, or model code is modified. The four-node latest-main run successfully loaded the K3 W4A8 target and DSpark draft. The exact SSD/GGUF artifact from #35314 was not part of this hardware run, so that compatibility statement is based on the disjoint code paths plus successful latest-main loading, not a separate SSD throughput benchmark.
Other checks
python -m py_compilefor both modified files: PASS on all four nodesgit diff --check: PASSCI States
Latest PR Test (Base): ❌ Run #33234977390
Latest PR Test (Extra): ❌ Run #33234977218
Latest PR Test (AMD ROCm 7.2): ❌ Run #33234977328