[PCG] Enable piecewise CUDA graph testing for VLM models#20548
[PCG] Enable piecewise CUDA graph testing for VLM models#20548edwingao28 wants to merge 12 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request aims to significantly improve the coverage and reliability of Piecewise CUDA Graph (PCG) testing for Vision-Language Models (VLMs). By introducing a more flexible mechanism for identifying transformer layers within complex VLM architectures and explicitly enabling PCG in relevant test configurations, the changes ensure that PCG is properly utilized and validated across a broader range of models, addressing current limitations where VLM CI tests might not have been exercising PCG effectively. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enables piecewise CUDA graph (PCG) testing for a wider range of Vision Language Models (VLMs) by making the transformer layer discovery more robust. The core change is the introduction of the _find_transformer_layers function, which correctly locates transformer layers across different VLM wrapper structures. The init_piecewise_cuda_graphs function is updated to use this new discovery mechanism. Additionally, several test configurations are modified to enforce PCG, ensuring better test coverage for this feature. The changes are logical and well-implemented. I have not found any issues of medium or higher severity.
- LLaVA/LLaVaVid: add None guard for mm_inputs during PCG warmup, where ForwardBatch is constructed with mm_inputs=None - Qwen3VL/Omni: stabilize input_deepstack_embeds kwarg to prevent TorchDynamo recompilation during PCG capture. Preallocate deepstack buffer and always pass it for consistent function signatures. Based on sgl-project#16785. Co-Authored-By: narutolhy <582909902@qq.com>
… leakage The preallocated deepstack buffer is always passed as a kwarg, but general_mm_embed_routine only zeroes it when mm_inputs are present. For text-only batches, the buffer retains stale embeddings from the previous multimodal request, corrupting text-only inference. Zero the buffer before each pass so text-only batches see clean zeros.
Motivation
Piecewise CUDA Graph initialization currently assumes the transformer layers are located at model.model.layers. This assumption works for many LLM models but fails for several VLM architectures where the language model is wrapped differently (e.g., model.language_model.model.layers, model.model.model.layers, or model.thinker.model.layers).
As a result, VLM CI tests may run without actually exercising Piecewise CUDA Graph.
This PR improves PCG coverage for VLM models by enabling the runtime to correctly locate transformer layers and by enforcing PCG in relevant test configurations.
Modifications
Introduces _find_transformer_layers() so PCG can work across different VLM wrapper structures
forces CI to actually run PCG via --enforce-piecewise-cuda-graph
stabilize these model-specific issues so that the majority of VLM test files can pass with PCG enabled..py
LLaVA: scheduler crash during PCG warmup.
Qwen3-VL / Qwen3-Omni: server startup returns connection refused. Will re-test after applying the Qwen3 bug fix PR. [Bugfix] fix recompile in qwen3 vl #16785
test_vlms_mmmu_eval.py
test_nvidia_nemotron_nano_v2_vl.py
test_encoder_dp.py
test_vision_openai_server_a.py
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci