Repository navigation
[6919103] Fix custom-op plugin compilation with TensorRT 11 - #2801
Merged
Merged
Conversation
TensorRT 11 removes the legacy batch-broadcast virtual methods. Guard both callback declarations and definitions by TensorRT major version, preserving older interfaces. Add a real CMake build regression for the example plugin. Signed-off-by: ajrasane <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
cjluo-nv
approved these changes
Oct 14, 2026
cjluo-nv
left a comment
Collaborator
There was a problem hiding this comment.
Bot review (gpt-6.1-sol) — DM the bot to share feedback.
Approve: the matching TensorRT version guards preserve older callbacks, and the real CMake build regression covers compilation and linking.
No action needed.
ajrasane
enabled auto-merge (squash)
October 14, 2026 18:20
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2801 +/- ##
==========================================
- Coverage 71.97% 71.97% -0.01%
==========================================
Files 648 648
Lines 71793 71793
==========================================
- Hits 51676 51670 -6
- Misses 20117 20123 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
rohansjoshi
added a commit
that referenced
this pull request
Oct 17, 2026
#2769 #2770 #2719 #2796 #2801 #2794 #2787 #2682 #2793 #2791 #2792 #2766 #2823 #2777 #2773 #2813 #2832 #2795 #2684 #2822 #2838 #2807 #2772 #2837 #2820 (#2843) ## Cherry-picked PRs - #2647 - #2700 - #2718 - #2578 - #2580 - #2711 - #2731 - #2726 - #2697 - #2769 - #2770 - #2719 - #2796 - #2801 - #2794 - #2787 - #2682 - #2793 - #2791 - #2792 - #2766 - #2823 - #2777 - #2773 - #2813 - #2832 - #2795 - #2684 - #2822 - #2838 - #2807 - #2772 - #2837 - #2820 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Expanded quantized model export support for MXFP4, MXFP8, FP8, and additional block-quantization formats. * Added quantization support for GPT-OSS and Step-family models, plus export support for native FP8 experts. * Added chat JSONL data preparation for Megatron workflows and an option to freeze the student MTP head during distillation. * Added model recipes for Kimi, Gemma, DiffusionGemma, and GLM variants. * **Bug Fixes** * Improved ONNX quantization and export compatibility, distributed calibration consistency, and handling of packed attention caches. * Improved safe model loading and low-precision quantization accuracy. * **Documentation** * Updated the 0.48.0 changelog and guidance for data preparation and quantization recipes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Also includes a partial backport of #2656 (only the `_validate_fold_weight` hook and the `mtq.fold_weight` pre-check), which #2820 depends on. --------- Signed-off-by: Shengliang Xu <[email protected]> Signed-off-by: Rohan Joshi <[email protected]> Signed-off-by: Juhi Mittal <[email protected]> Signed-off-by: Fridah-nv <[email protected]> Signed-off-by: Chenjie Luo <[email protected]> Signed-off-by: yingguo-trt <[email protected]> Signed-off-by: weimingc <[email protected]> Signed-off-by: Yue <[email protected]> Signed-off-by: joe-nv <[email protected]> Signed-off-by: ajrasane <[email protected]> Signed-off-by: Ajinkya Rasane <[email protected]> Signed-off-by: ColinM-sys <[email protected]> Signed-off-by: Keval Morabia <[email protected]> Signed-off-by: Meng Xin <[email protected]> Signed-off-by: gcunhase <[email protected]> Signed-off-by: Chad Voegele <[email protected]> Co-authored-by: Shengliang Xu <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Juhi Mittal <[email protected]> Co-authored-by: Frida Hou <[email protected]> Co-authored-by: Chenjie Luo <[email protected]> Co-authored-by: yingguo-trt <[email protected]> Co-authored-by: Wei-Ming Chen <[email protected]> Co-authored-by: yueshen2016 <[email protected]> Co-authored-by: joe <[email protected]> Co-authored-by: Ajinkya Rasane <[email protected]> Co-authored-by: Colin McDonough <[email protected]> Co-authored-by: Keval Morabia <[email protected]> Co-authored-by: mxinO <[email protected]> Co-authored-by: Gwena Cunha <[email protected]> Co-authored-by: Chad Voegele <[email protected]>
ajrasane
added a commit
that referenced
this pull request
Oct 28, 2026
### What does this PR do? Type of change: Bug fix TensorRT inference fails during session initialization on TensorRT 11 because `IExecutionContext.all_shape_inputs_specified` was removed. Replace that legacy check with `infer_shapes()` after input values are available, including when `io_shapes` is supplied. Select the optimization profile before setting input dimensions, honor TensorRT's host/device buffer locations, and reject missing inputs and invalid dimensions. Host input copies finish before shape inference reads their values. Add real-engine regression coverage and a changelog entry. The 0.48.0 changelog also records the already merged TensorRT plugin compatibility fixes from [#2796](#2796) and [#2801](#2801). ### Usage ```bash pytest -o addopts= tests/gpu/torch/deploy/_runtime/test_trt_client.py -k test_trt_session_inference ``` ### Testing - Four real-engine cases pass on TensorRT 11.1.0.106 and 10.13.3.9: static shapes, inferred static shapes, dynamic dimensions, and a shape-tensor reshape. They compare actual inference outputs and check missing inputs, invalid profile dimensions, and invalid reshape values. - Reverting the production fix makes all four cases fail on TensorRT 11 with the removed-property error. The minimal identity-engine reproduction completes inference with the fix. - Full test module: 4 passed, 11 skipped per environment. Four existing compile/profile tests require an ORT TensorRT provider library that cannot load `libcublas.so.12`; seven manual vision tests were not selected. Full ImageNet accuracy and FP8/INT8 evaluation were not run. - Focused pre-commit hooks and `git diff --check` pass. - A 100-iteration identity-engine sample on TensorRT 10 with `[16, 3, 224, 224]` buffers showed unchanged peak allocated GPU memory (67,436,544 bytes). Median inference time was 40.3 μs before and 43.4 μs after validation. ### Before your PR is "*Ready for review*" Make sure you read and follow [Contributor guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md) and your commits are signed (`git commit -s -S`). Make sure you read and follow the [Security Best Practices](https://github.com/NVIDIA/Model-Optimizer/blob/main/SECURITY.md#security-coding-practices-for-contributors) (e.g. avoiding hardcoded `trust_remote_code=True`, `torch.load(..., weights_only=False)`, `pickle`, etc.). - Is this change backward compatible?: ✅ - If you copied code from any other sources or added a new PIP dependency, did you follow guidance in `CONTRIBUTING.md`: N/A - Did you write any new necessary tests?: ✅ - Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?: ✅ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved TensorRT inference initialization for static, dynamic, and shape-tensor inputs. * Improved handling of inputs stored on the host or GPU during inference. * Added validation for supplied inputs and shapes. Missing inputs, invalid shapes, and dynamic shapes outside the supported profile now produce errors. * Fixed preprocessing for custom TensorRT plugin libraries and corrected the custom plugin example build process. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: ajrasane <[email protected]>
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.
What does this PR do?
Type of change: Bug fix
The ONNX PTQ custom-op plugin fails to compile with TensorRT 11 because
isOutputBroadcastAcrossBatchandcanBroadcastInputAcrossBatchno longer override methods in the base interface. Guard their declarations and definitions withNV_TENSORRT_MAJOR < 11, preserving the legacy callbacks for older TensorRT versions.Add a regression in the existing TensorRT example test lane that runs the real CMake build and checks that it produces
libidentity_conv_plugin.so.Usage
Testing
python -m pytest --noconftest -o addopts= tests/examples/torch_trt/test_custom_op_plugin.py -q: passed with TensorRT 11.1 and TensorRT 10.13.3. This isolates the C++ build test from unrelated Python suite fixtures and options.0.48.0rc0source with only this fix applied: passed.Before your PR is "Ready for review"
Make sure you read and follow Contributor guidelines and your commits are signed (
git commit -s -S).Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded
trust_remote_code=True,torch.load(..., weights_only=False),pickle, etc.).CONTRIBUTING.md: N/ASummary by CodeRabbit
Bug Fixes
Tests