Enable Qwen3.5 TRT-RTX EP path with CUDA graph - #2139
Enable Qwen3.5 TRT-RTX EP path with CUDA graph#2139Baiju Meswani (baijumeswani) merged 12 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Enables more reliable CUDA-graph-style replay/reuse for Qwen3.5 on the TRT-RTX execution provider by stabilizing input/output buffer addresses and fixing a couple of TRT-RTX QDQ export edge cases.
Changes:
- Add shared past/present recurrent-state buffer mode to keep bindings stable for TRT-RTX graph replay.
- Keep Qwen2VL-style
attention_maskand 3Dposition_idsat decode-stable shapes for graph capture/shared-buffer runs, updating contents in place. - Adjust TRT-RTX QDQ export behavior for SkipLayerNorm output naming and avoid mixed INT8 weight-only overrides on explicit QDQ paths.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/python/py/models/builders/qwen.py | Avoid applying mixed INT8 (weight-only/QOperator) overrides when exporting explicit QDQ. |
| src/python/py/models/builders/base.py | Pass redirected SkipLayerNorm output_3 name to primitives to avoid duplicate producers in QDQ export. |
| src/models/recurrent_state.h | Track whether past/present buffers are shared. |
| src/models/recurrent_state.cpp | Implement shared-buffer recurrent-state allocation/binding and disable swapping/rewind rebinding in that mode. |
| src/models/position_inputs.h | Add static-shape handling APIs for attention mask and 3D position IDs. |
| src/models/position_inputs.cpp | Implement static mask + stable decode position_ids tensors and in-place updates for TRT-RTX graph replay. |
| examples/python/model-qa.py | Add NvTensorRtRtx EP option to the example CLI. |
|
@microsoft-github-policy-service agree company="NVIDIA Corporation" |
1a7742c to
a837888
Compare
|
kunal-vaishnavi , Baiju Meswani (@baijumeswani) , can you please help review. |
6b44e87 to
5630dd6
Compare
bc30bb1 to
1d4fae7
Compare
|
Thanks for the reviews. I rewrote/rebased the branch and addressed the outstanding threads in a smaller two-commit form:
|
1d4fae7 to
7a152a1
Compare
|
Hi Akshay Sonawane (@apsonawane) and kunal-vaishnavi, Can you review again please? Thanks! |
|
Yen-Shi Wang (@yen-shi) can you integrate this change as well: #2127 |
My changes have already been applied on top of #2127, and I've tested TRT-RTX EP on Qwen3.5 models without issues. |
|
Yen-Shi Wang (@yen-shi) could you please resolve the merge-conflicts as well? |
6d3522a to
d70abd4
Compare
|
Baiju Meswani (@baijumeswani) I've done final clean-up, can you review again please? Thanks! |
…into yenshiw/qwen3.5-trtrtx
|
Yen-Shi Wang (@yen-shi) I hope you don't mind if I push on top of your branch. There seems to be a test failing. And I am also addressing kunal-vaishnavi comment. I want to include this PR for the ort-genai release 0.14.0 |
06d3fae
into
microsoft:main
This PR enables Qwen3.5 text-only INT4 QDQ export and TRT-RTX EP inference with CUDA graph/shared past-present buffers.
Structure
The branch is rebased on latest
mainand intentionally split into two commits:Add Qwen3.5 text-only export supportposition_idsas[B, S]and expands inside the graph to[3, B, S]for mRoPE.Enable Qwen3.5 TRT-RTX shared-buffer inferencepast_present_share_bufferis enabled, preserving stable input/output addresses for TRT-RTX graph replay.output_3producer wiring.k_quant_linearpath rather than Qwen-local code.NvTensorRtRtxname to the example EP choices.PR #2157 compatibility
This branch was compared against #2157 using
git merge-tree. The same Qwen files are touched, but Git auto-merges them cleanly and the simulation produced no conflict markers.If #2157 merges first, the first commit in this branch is the overlap and can be dropped/rebased away; the second commit contains the TRT-RTX-specific delta.
Validation
main(bf6cf3fe).python build.py --use_cuda --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2" --config Release --update --build --parallel --skip_tests --skip_examples