Repository navigation
[6915422] Fix TensorRT 11 inference shape validation - #2798
Conversation
|
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. |
cjluo-nv
left a comment
There was a problem hiding this comment.
Bot review (bedrock-claude-opus-5-5) — DM the bot to share feedback.
LGTM: the fix is correct and small, and real-engine regression tests cover it. I'm only asking for a human because it edits the skip gating in an existing test file.
Needs action:
- Confirm the skip change in
tests/gpu/torch/deploy/_runtime/test_trt_client.py: module-level skips are now inside_compile_and_profileplusimportorskip("tensorrt"). Existing tests keep the same gating and assertions, and the new tests no longer need trtexec or ORT's TRT EP.
No action needed:
- The fix drops the removed
all_shape_inputs_specifiedproperty. It now selects the profile before callingset_input_shape, checks that call's return value, and runsinfer_shapes()on each call torun()after the inputs are copied. When any input lives on the host, it synchronizes first so shape tensors are read correctly. - Host-located tensors are now allocated on the CPU, which shape-tensor inputs need.
- The tests cover static, inferred-static, dynamic and shape-tensor engines. They check outputs and the failure paths: wrong input count, out-of-profile dims and an invalid reshape. I read the tests but didn't run them; the PR reports they pass on TRT 10.13 and 11.1.
infer_shapes()now runs on every call, which costs about 3 μs per call according to the PR's measurement. That's acceptable.
|
|
Confirmed the dependency-gating change against the base diff and the TensorRT 10.13.3.9 / 11.1.0.106 runs:
No source change is needed for this confirmation. This is automated verification, not the human sign-off requested by the review. Full ImageNet accuracy and FP8/INT8 evaluation remain unverified, as disclosed in the PR description. |
|
|
||
| **Bug Fixes** | ||
|
|
||
| - Fix TensorRT inference initialization on TensorRT 11 and retain shape validation for static, dynamic, and shape-tensor inputs. |
There was a problem hiding this comment.
Yes, I have moved this to the 0.48 entry in changelog.
adef98c to
35d82b5
Compare
|
|
||
| - Fix ONNX preprocessing with custom TensorRT plugin libraries on TensorRT 11. | ||
| - Fix building the custom TensorRT plugin example with TensorRT 11. | ||
| - Fix TensorRT inference initialization on TensorRT 11 and retain shape validation for static, dynamic, and shape-tensor inputs. |
There was a problem hiding this comment.
@ajrasane are all 3 lines addressed in this PR or is that to cover the changelog cherry-picks for other related PRs?
gcunhase
left a comment
There was a problem hiding this comment.
LGTM, added a minor comment.
8785337 to
df38cb7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2798 +/- ##
==========================================
+ Coverage 73.86% 78.44% +4.57%
==========================================
Files 662 662
Lines 75835 77541 +1706
==========================================
+ Hits 56019 60826 +4807
+ Misses 19816 16715 -3101
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:
|
df38cb7 to
8c3e8b1
Compare
Use infer_shapes after input values are copied instead of the execution-context property removed in TensorRT 11. Select the profile before input dimensions and allocate shape buffers at their declared locations. Signed-off-by: ajrasane <[email protected]>
Signed-off-by: ajrasane <[email protected]>
Signed-off-by: ajrasane <[email protected]>
8c3e8b1 to
a7304e2
Compare
Resolve the TensorRT runtime overlap while retaining deferred shape inference and the removal of the obsolete API. Preserve upstream changelog additions and the PR's TensorRT 0.48 entries. Signed-off-by: Ajinkya Rasane <[email protected]>
|
/ok to test 7c1e074 |
## Cherry-picked PRs - #2980 - #3041 - #2798 - #2979 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * INT4 and W4A8 exports now include more accurate quantization metadata. * Layerwise checkpoint loading is safer and provides clearer guidance when a checkpoint cannot be resumed. * **Bug Fixes** * TensorRT inference now handles dynamic and host-based inputs more reliably, validates input shapes and counts, and improves initialization. * Added warnings when fused-expert quantization stages are skipped or ModelOpt state saving is unsupported during layerwise export. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Fridah-nv <[email protected]> Signed-off-by: Rohan Joshi <[email protected]> Signed-off-by: yingguo-trt <[email protected]> Signed-off-by: ajrasane <[email protected]> Co-authored-by: Frida Hou <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> Co-authored-by: yingguo-trt <[email protected]> Co-authored-by: Ajinkya Rasane <[email protected]>
What does this PR do?
Type of change: Bug fix
TensorRT inference fails during session initialization on TensorRT 11 because
IExecutionContext.all_shape_inputs_specifiedwas removed. Replace that legacy check withinfer_shapes()after input values are available, including whenio_shapesis 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 and #2801.
Usage
Testing
libcublas.so.12; seven manual vision tests were not selected. Full ImageNet accuracy and FP8/INT8 evaluation were not run.git diff --checkpass.[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 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