Repository navigation
[MM][Mistral] Add compile support for Pixtral vision encoders - #57168
Merged
Merged
Conversation
Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Jakub Zakrzewski <jzakrzewski@nvidia.com>
|
✅ @jzakrzew, CI is now available for this PR.
|
Member
|
/ci run |
4 tasks
Contributor
Author
|
/ci run |
|
❌ This PR is 27 commits behind upstream |
Contributor
Author
|
/ci run |
|
✅ Triggered Buildkite CI #91555 for commit |
Contributor
Author
|
/ci retry |
|
✅ Queued 1 failed job(s) for retry in Buildkite CI #91555. |
This was referenced Sep 28, 2026
Contributor
Author
|
/ci run |
|
✅ Triggered Buildkite CI #91862 for commit |
Contributor
Author
|
/ci run |
|
✅ Triggered Buildkite CI #92093 for commit |
2 of 6 tasks
6 tasks done
michael-gpu
pushed a commit
to practical-inference/vllm-ampere-extended
that referenced
this pull request
Oct 20, 2026
…roject#57168) Signed-off-by: Jakub Zakrzewski <jzakrzewski@nvidia.com> Co-authored-by: Nicolò Lucchesi <nicolo.lucchesi@mistral.ai> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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
Add
compile_mm_encodersupport for both Pixtral vision encoder implementations:PixtralForConditionalGeneration, including Mistral-format Mistral 3 models.Mistral3ForConditionalGeneration.The change applies
support_torch_compileto the transformer blocks in both implementations and marks the token, rotary embedding, and packed-sequence dimensions as dynamic.The feature remains gated behind
compile_mm_encoder, which is disabled by default.Performance results
Note: the results are only about GPU kernel time. Total E2E runtime improves much less, even with Cuda graphs from #56277, because apply_hf_processor is the main bottleneck now.
Profiling was performed on an NVIDIA GB200 system using the same 16-image BF16 capture before and after enabling compilation.
Total GPU kernel time decreased by 42%, from 1173.6 ms to 676.8 ms, corresponding to a 1.73x speedup.
The improvement came from eliminating or fusing much of execution overhead:
CUDA-graph compatibility
This work is complementary to #56277, which adds Pixtral encoder CUDA-graph support. It does not duplicate or modify that implementation.
The CUDA-graph PR’s pixtral.py and mistral3.py changes apply cleanly over this change. Its packed encoder forwards continue to use the unchanged transformer interface. Encoder CUDA-graph capture also performs an eager warmup before capture,
allowing the transformer blocks to compile first.
A combined compile_mm_encoder=True plus cudagraph_mm_encoder=True integration test should be added once #56277 is merged.
Test Plan
Exercise both encoder implementations with compilation enabled and disabled:
PixtralForConditionalGenerationMistral3ForConditionalGenerationThe test uses dummy weights and verifies that the compilation counter increases only when
compile_mm_encoderis enabled.Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.