Conversation
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
This was referenced Aug 21, 2026
gcanlin
marked this pull request as ready for review
August 22, 2026 07:23
gcanlin
requested review from
AndreasKaratzas,
WoosukKwon,
mgoin,
tlrmchlsmth,
yewentao256 and
zyongye
as code owners
August 22, 2026 07:23
47 tasks
gau-nernst
reviewed
Aug 25, 2026
Contributor
There was a problem hiding this comment.
q: this doesn't look very different from RoPE used in LLMs. Can we reuse existing RoPE kernels in vLLM? also, since you are doing this, can we fuse QK-Norm+RoPE as well (I actually don't know if MoonViT has QK-Norm, just wondering)
gcanlin
marked this pull request as draft
September 13, 2026 17:27
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.
Purpose
MoonViT currently materializes the real and imaginary RoPE components in every
encoder layer and invokes
ApplyRotaryEmbseparately for the strided Q and Kviews of its packed QKV projection. This PR adds an SM90+ Triton path that:
image sizes; and
shapes, and empty inputs.
The kernel is adapted from SGLang's fused vision RoPE implementation, while its
arithmetic order follows vLLM's current interleaved RoPE path.
This is not a duplicate of an existing open PR. Searches for
MoonViT RoPE,Kimi vision RoPE,fused QK complex RoPE, andkimi_k25_vitfound no PRimplementing this kernel. #53011 addresses eager
torch.compilecache behavior,and #40600 targets full ViT CUDA graphs; neither fuses Q/K complex RoPE.
AI assistance (OpenAI Codex) was used for implementation and testing. The human
submitter must review every changed line and be able to defend the change before
this draft is marked ready for review.
Test Plan
Kimi K3's packed-QKV layout and dynamic token counts.
ApplyRotaryEmbtwice,including real/imag materialization) against the fused path on B200.
Test Result
Local hooks:
B200 kernel tests in the vLLM nightly container:
The tests cover BF16 and FP16, 1/257/4096 tokens, packed QKV strides,
contiguous outputs, unsupported-input rejection, and CUDA graph replay. In a
direct BF16 comparison with the existing vLLM path, the maximum difference was
one BF16 ULP (
0.0078125), affecting0.00152%of elements.B200 BF16 microbenchmark, 12 heads and head dimension 128:
A 27-layer random-weight MoonViT run using Kimi K3's vision geometry produced
finite outputs with cosine similarity
0.999912between the existing and fusedpaths. This is a numerical stress test, not a trained-model evaluation.
Trained Kimi K3 multimodal end-to-end serving/evaluation has not been run
yet. This PR remains a draft until that result and human line-by-line review are
complete.
Essential Elements of an Effective PR Description Checklist