Skip to content

[Fix] [AMD] kimi-k3: Skip the CuTe DSL TGV tactic registration on ROCm - #49929

Merged
nvpohanh merged 1 commit into
sgl-project:mainfrom
michaelzhang-ai:ci-fix/kimi-k3-hip-tgv-import
Nov 12, 2026
Merged

nvpohanh merged 1 commit into
sgl-project:mainfrom
michaelzhang-ai:ci-fix/kimi-k3-hip-tgv-import

Conversation

@michaelzhang-ai

@michaelzhang-ai michaelzhang-ai commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

What

Guard the per-M TGV tactic registration in KimiK3LinearForCausalLM.__init__ with if not _is_hip, so ROCm 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. That module imports cuda.bindings and cutlass at module level, and neither ships in the ROCm image, so the Kimi-K3.1-Pro server exits during model init with ModuleNotFoundError: No module named 'cuda' (traceback through kimi_k3.py:3459). The registered tactics are only read by the CuTe DSL GEMM path, which ROCm never selects; the other import sites of this module in kimi_k3.py are already behind the cutedsl backend or SM103 checks.

Failing jobs on main (MI35x, rocm10 nightly, first scheduled run containing #49478):

The same job passed on rocm10 on Nov 9 and on rocm724 on Nov 10, before the change.

Test plan


CI States

Latest PR Test (Base): ❌ Run #43100836191
Latest PR Test (Extra): ❌ Run #43100836865
Latest PR Test (AMD ROCm 10): ❌ Run #43100836123

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

KimiK3LinearForCausalLM.__init__ imports cutedsl_bf16_gemm unconditionally
to register per-M TGV tactics. That module imports cuda.bindings and cutlass
at module level, so the Kimi-K3.1-Pro server fails to start on ROCm with
ModuleNotFoundError: No module named 'cuda'. The tactics are only read by
the CuTe DSL GEMM, which ROCm never selects.
@michaelzhang-ai
michaelzhang-ai marked this pull request as ready for review November 11, 2026 22:50
@michaelzhang-ai michaelzhang-ai added the run-ci CI: run the baseline test suite on this PR label Nov 11, 2026

@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.

@nvpohanh
nvpohanh merged commit 83b9012 into sgl-project:main Nov 12, 2026
275 of 308 checks passed
@nvpohanh

Copy link
Copy Markdown
Collaborator

merged. sorry for causing the issue

kevin-mii added a commit that referenced this pull request Nov 14, 2026
Conflicts:
- pyproject_other.toml: take the target's fastokens extra; keep the sgl-amd-mono pin at
  b9f40eb562 (sgl-amd-mono#121), which contains the target's 7113024f.
- speculative/draft_worker_common.py, arg_groups/speculative_hook.py: DFLASH_MLA_ONLY_DRAFT_BACKENDS
  moved to arg_groups/choices.py (#49621); keep the two DCP draft-backend helpers beside it.
- dsa_backend.py: take the target's removal of _validate_dcp_backend, and drop
  validate_dcp_backend_hip with it; server_args already rejects non-triton DSA backends under DCP on ROCm.
- dsa/dsa_indexer.py: keep the FP4 index-K branch around the target's BF16-logits budget and
  LiteTopK prefill (both off on ROCm).
- prefill_cuda_graph_runner.py: prefix hits now replay under DCP (#49943) and the per-shape KV
  buffers are gone; ROCm Kimi-K3.1 still skips the DCP extend plan, which its DSA layers never read.
- models/dflash.py: both platform flags.
- models/kimi_k3.py: take the target's MXFP8 in-proj guard and ROCm TGV skip (#49929); the ROCm
  in-proj fusion stays ungated by do_fuse_qkvbfg.
- attention/test_dflash_mla_backends.py: take the sliding-window case; skip it on ROCm
  (trtllm_mla and cutedsl_mla have no ROCm build).

Also: test_triton_mla_window_dcp imports is_mla_dcp_lse_base_on_e from dcp.layout, its new home.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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

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