Skip to content

[Fix] [NPU] kimi-k3: Skip the CuTe DSL TGV tactic registration on NPU - #50107

Merged
iforgetmyname merged 1 commit into
sgl-project:mainfrom
MatsueYu:bugfix/k3-npu-no-cutlass
Nov 13, 2026
Merged

iforgetmyname merged 1 commit into
sgl-project:mainfrom
MatsueYu:bugfix/k3-npu-no-cutlass

Conversation

@MatsueYu

@MatsueYu MatsueYu commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Guard the per-M TGV tactic registration in KimiK3LinearForCausalLM.__init__ with if not (_is_hip or _is_npu), so Ascend NPU no longer imports the CuTe DSL BF16 GEMM module.

Why

#49478 added an unconditional from sglang.kernels.ops.gemm.cutedsl_bf16_gemm import register_tgv_m_ranges to the model constructor. #49929 later skipped it on ROCm, but the guard only covers HIP. That module imports cuda.bindings and cutlass at module level, and neither exists in the Ascend NPU environment, so every Kimi-K3/K3.1 server exits during model init with:

File "/home/zhm/ref/sglang/python/sglang/srt/models/kimi_k3.py", line 3477, in __init__
    from sglang.kernels.ops.gemm.cutedsl_bf16_gemm import (
File "/home/zhm/ref/sglang/python/sglang/kernels/ops/gemm/cutedsl_bf16_gemm.py", line 32, in <module>
    import cuda.bindings.driver as cuda
ModuleNotFoundError: No module named 'cuda'

followed by Received sigquit from a child process on all TP ranks (TP0-TP7). The registered tactics are only read by the CuTe DSL GEMM path, which NPU never selects; the other import sites of this module in kimi_k3.py are already behind the cutedsl backend or SM103 checks.

Test plan

  • python -m py_compile on python/sglang/srt/models/kimi_k3.py: pass.
  • CUDA and ROCm behavior is unchanged: the guarded block still runs exactly as before on CUDA, and NPU is added to the existing skip.
  • Ascend NPU (TP8): server starts, Kimi-K3 model init no longer raises ModuleNotFoundError: No module named 'cuda', and the VLM startup warmup runs.
  • No NPU CI job currently covers this case; verification was done on an in-house Ascend NPU host.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #43217228115
Latest PR Test (Extra): ❌ Run #43217227724
Latest PR Test (AMD ROCm 10): ❌ Run #43217227681

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@MatsueYu MatsueYu changed the title [Fix] [NPU] kimi-k3: Skip the CuTe DSL TGV tactic registration on Asc… [Fix] [NPU] kimi-k3: Skip the CuTe DSL TGV tactic registration on NPU Nov 12, 2026
@iforgetmyname iforgetmyname added run-ci CI: run the baseline test suite on this PR bypass-fail-fast CI: a failing job no longer aborts its siblings (lint still gates) labels Nov 13, 2026
@iforgetmyname

Copy link
Copy Markdown
Collaborator

/rerun-ci test_kimi_k3*.py

@github-actions

Copy link
Copy Markdown
Contributor

⛔ /rerun-ci isn't a recognized CI command. Did you mean /run-nv-ci?

See the command reference.

@iforgetmyname

Copy link
Copy Markdown
Collaborator

/rerun-test test_kimi_k3*.py

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🚀 8-gpu-b300 (2 tests): ❌ View workflow run

cd test/ && python3 registered/e2e/models/test_kimi_k3_b300.py  # extra-b
cd test/ && python3 registered/e2e/models/test_kimi_k3_b300_low_latency.py  # extra-b

🚀 ubuntu-latest (9 tests): ✅ View workflow run

cd test/ && python3 registered/expert_pack/test_kimi_k3_gguf.py  # base-a
cd test/ && python3 registered/unit/disaggregation/test_kimi_k3_encoder_mode.py  # base-a
cd test/ && python3 registered/unit/layer_boundary/test_kimi_k3_stage_kernels.py  # base-a
cd test/ && python3 registered/unit/models/test_kimi_k3_expert_placement.py  # base-a
cd test/ && python3 registered/unit/models/test_kimi_k3_packed_modules_mapping.py  # base-a
cd test/ && python3 registered/unit/models/test_kimi_k3_pipeline_layers.py  # base-a
cd test/ && python3 registered/unit/models/test_kimi_k3_rocm_quant.py  # base-a
cd test/ && python3 registered/unit/models/test_kimi_k3_vision.py  # base-a
cd test/ && python3 registered/unit/multimodal/test_kimi_k3_gpu_preprocess.py  # base-a

🚀 1-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/moe/test_kimi_k3_fused_routing.py  # base-b-kernel-unit

🚀 4-gpu-b200 (2 tests): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/moe/test_kimi_k3_prepared_routing.py  # base-b-kernel-unit
cd test/ && python3 registered/unit/models/test_kimi_k3_bfa_overlap.py  # base-b

⛔ test/registered/amd/accuracy/mi35x/test_kimi_k31_pro_eval_mi35x.py: test/registered/amd/accuracy/mi35x/test_kimi_k31_pro_eval_mi35x.py is registered for AMD (suite nightly-amd-accuracy-8-gpu-mi35x-kimi-k31-pro), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

⛔ test/registered/amd/accuracy/mi35x/test_kimi_k3_eval_mi35x.py: test/registered/amd/accuracy/mi35x/test_kimi_k3_eval_mi35x.py is registered for AMD (suite nightly-amd-accuracy-8-gpu-mi35x-kimi-k3), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

⛔ test/registered/amd/perf/mi35x/test_kimi_k31_pro_perf_mi35x.py: test/registered/amd/perf/mi35x/test_kimi_k31_pro_perf_mi35x.py is registered for AMD (suite nightly-perf-8-gpu-mi35x-kimi-k31-pro), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

⛔ test/registered/amd/perf/mi35x/test_kimi_k3_perf_mi35x.py: test/registered/amd/perf/mi35x/test_kimi_k3_perf_mi35x.py is registered for AMD (suite nightly-perf-8-gpu-mi35x-kimi-k3), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

⛔ test/registered/amd/test_kimi_k3_kda_inproj_fusion.py: test/registered/amd/test_kimi_k3_kda_inproj_fusion.py is registered for AMD (suite stage-b-test-1-gpu-small-amd-mi35x), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

⛔ test/registered/kernels/ops/attention/kda_flydsl/test_kimi_k3_kda_decode.py: test/registered/kernels/ops/attention/kda_flydsl/test_kimi_k3_kda_decode.py is registered for AMD (suite stage-b-test-1-gpu-small-amd-mi35x), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

@iforgetmyname
iforgetmyname merged commit 4f8b686 into sgl-project:main Nov 13, 2026
127 of 145 checks passed
rumitdesai added a commit to rumitdesai/sglang that referenced this pull request Nov 25, 2026
KimiK3LinearForCausalLM.__init__ imports
sglang.kernels.ops.gemm.cutedsl_bf16_gemm to register K3's measured TGV
GEMM tactics on every platform except ROCm (sgl-project#49929) and Ascend NPU (sgl-project#50107).
That module imports cuda.bindings and cutlass at module level, and only
the CUDA install (python/pyproject.toml) depends on cuda-python and
nvidia-cutlass-dsl. On the CPU, XPU and other installs, and on
out-of-tree accelerator platforms, Kimi-K3 therefore fails at model
construction with `ModuleNotFoundError: No module named 'cutlass'`.

Only the CUDA CuTe DSL GEMM path reads these tactics. Move the
registration into `_register_k3_tgv_m_ranges`, which returns unless
`get_platform().is_cuda` (the check the file already uses for other
CUDA-only paths), so new platforms no longer have to be added to a
skip list one at a time. CUDA behaviour is unchanged, and ROCm and NPU
stay skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fail-fast CI: a failing job no longer aborts its siblings (lint still gates) run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants