feat: support in-place plugins#4279
Open
bowang007 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/lowering/passes/unfunctionalize_qdp_inplace.py 2026-05-20 14:19:18.477550+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/lowering/passes/unfunctionalize_qdp_inplace.py 2026-05-20 14:19:37.985186+00:00
@@ -131,13 +131,11 @@
gm.graph.erase_node(user)
else:
return_getitems: List[Any] = []
with gm.graph.inserting_after(new_call):
for i in range(n_outputs):
- g = gm.graph.call_function(
- operator.getitem, args=(new_call, i)
- )
+ g = gm.graph.call_function(operator.getitem, args=(new_call, i))
if isinstance(hop_val, tuple) and i < len(hop_val):
g.meta["val"] = hop_val[i]
return_getitems.append(g)
for user in getitem_users:
idx = user.args[1]
narendasan
reviewed
May 20, 2026
Collaborator
There was a problem hiding this comment.
Can you explain this lowering pass? Auto functionalization is a bit more broader reaching that just for QDP nodes. Maybe it might be useful elsewhere?
526e555 to
9f05cee
Compare
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/lowering/passes/unfunctionalize_qdp_inplace.py 2026-07-14 09:13:16.073785+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/lowering/passes/unfunctionalize_qdp_inplace.py 2026-07-14 09:13:43.216625+00:00
@@ -131,13 +131,11 @@
gm.graph.erase_node(user)
else:
return_getitems: List[Any] = []
with gm.graph.inserting_after(new_call):
for i in range(n_outputs):
- g = gm.graph.call_function(
- operator.getitem, args=(new_call, i)
- )
+ g = gm.graph.call_function(operator.getitem, args=(new_call, i))
if isinstance(hop_val, tuple) and i < len(hop_val):
g.meta["val"] = hop_val[i]
return_getitems.append(g)
for user in getitem_users:
idx = user.args[1]…r converter Convert in-place QDP plugins by registering a converter on the auto_functionalized(_v2) higher-order wrapper (gated by a capability_validator to the ops that have a plugin) instead of reversing functionalization in a lowering pass. The graph stays functional and scoping is per-node. - Add _auto_functionalized_converter: wrapper converter that reconstructs the inner op's args, delegates to the inner op's converter, and returns the [*returns, *bases] tuple with a faithful base->return alias map; plus a scoped no-op converter for the aliased write-back copy_. - Add qdp_inplace_metadata pass: metadata-only (no graph reversal) so pre-conversion symbolic-shape extraction handles the direct-return case. - Remove unfunctionalize_qdp_inplace: its global copy_ deletion corrupted mixed graphs (a non-plugin in-place op's write-back was dropped). All in-place tests pass (5/5); full plugin+kernels suite green (57 passed). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Description
End-to-end support for in-place QDP plugins in torch-tensorrt
Fixes #4240
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: