Skip to content

fix: fix Kimi-VL encoder parallelism - #30869

Merged
mickqian merged 5 commits into
sgl-project:mainfrom
mickqian:codex/kimi-vl-encoder-parallelism
Jul 14, 2026
Merged

mickqian merged 5 commits into
sgl-project:mainfrom
mickqian:codex/kimi-vl-encoder-parallelism

Conversation

@mickqian

@mickqian mickqian commented Jul 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • wire MoonViT through the existing encoder-DP sharding helper and preserve the TP=1 projector-facing tensor contract
  • make MoonViT layers tensor-parallel when encoder DP is disabled, and avoid TP-collective CUDA-graph capture for DP-sharded image work
  • eliminate per-layer GPU synchronization for packed attention metadata and bound the serving-time positional interpolation cache
  • resolve the language model once before prefill graph setup and cache supported image-processor kwargs

Before / after behavior

This is primarily a Kimi-VL correctness/enablement change, not a valid before/after throughput benchmark: before, Kimi-VL TP=1 encoder-DP returns a list where the projector requires a tensor and fails on serving; after, the output is concatenated and the server completes image requests. No cross-engine number is presented as a PR performance result.

Validation

  • pre-commit on all changed files
  • registered Kimi-VL encoder/DP, interpolation-cache eviction, ViT capture-context, and HF image-processor tests
  • the Kimi-VL entry was intentionally removed from the shared test_encoder_dp matrix.

CI States

Latest PR Test (Base): ✅ Run #29237951501
Latest PR Test (Extra): ❌ Run #29237951515

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request implements tensor parallelism (TP) and data parallelism (DP) support for the Kimi-VL model and its MoonViT encoder. It also introduces several performance optimizations, including caching interpolated positional embeddings, passing precomputed max_seqlen to avoid GPU synchronization, and caching accepted kwargs in image processor patches to bypass slow exception paths. The review feedback highlights a critical issue where the new positional embedding cache grows without bound during inference, potentially causing a GPU memory leak and Out-Of-Memory (OOM) crashes. It is recommended to limit the cache size and evict old entries to ensure stability in long-running serving environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@mickqian

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Jul 13, 2026
@mickqian mickqian changed the title Fix Kimi-VL encoder parallelism fix: fix Kimi-VL encoder parallelism Jul 13, 2026
@mickqian
mickqian merged commit 33f8301 into sgl-project:main Jul 14, 2026
135 of 167 checks passed
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
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.

1 participant