[cherry-pick][release/2.13] user provided bound for torchtrt compile (#4213)#4375
Open
apbose wants to merge 3 commits into
Open
[cherry-pick][release/2.13] user provided bound for torchtrt compile (#4213)#4375apbose wants to merge 3 commits into
apbose wants to merge 3 commits into
Conversation
…ounded (#4213) Cherry-pick of PR #4213 onto release/2.13, squashing the PR's 11 work-in-progress commits into a single commit (net diff of the PR vs its merge-base with main, so unrelated main commits such as the 2.13->2.14 version bump #4338 are excluded). Conflict resolution in _compiler.py: took the PR side for the compile_module call (passing graph_signature=exported_program.graph_signature) and the added user_symbol_bounds / fallback_data_dependent_ops block; release/2.13 was purely behind these additive changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cherry-pick of #4213 commit 223a209 onto release/2.13. Makes compile_module's graph_signature optional (None on the torch.compile backend path, which has no ExportedProgram) and skips _build_user_symbol_bounds in that case. Fixes the torch.compile path which otherwise raised: compile_module() missing 1 required keyword-only argument 'graph_signature'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The `if settings.fallback_data_dependent_ops and settings.require_full_compilation` check is main-only code (the fallback_data_dependent_ops setting was added to CompilationSettings by a separate PR that is not on release/2.13). It is not part of #4213's own change; it only appeared in this cherry-pick because the pre-rebase #4213 predated that main feature. Removing it here avoids AttributeError: 'CompilationSettings' object has no attribute 'fallback_data_dependent_ops' on release/2.13. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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/_compiler.py 2026-07-02 19:36:11.203383+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/_compiler.py 2026-07-02 19:36:27.624782+00:00
@@ -1077,13 +1077,11 @@
sample_arg_inputs: Sequence[Input],
sample_kwarg_inputs: Optional[dict[Any, Any]] = None,
settings: CompilationSettings = CompilationSettings(),
engine_cache: Optional[BaseEngineCache] = None,
*,
- graph_signature: Optional[
- torch.export.graph_signature.ExportGraphSignature
- ] = None,
+ graph_signature: Optional[torch.export.graph_signature.ExportGraphSignature] = None,
_debugger_config: Optional[DebuggerConfig] = None,
) -> torch.fx.GraphModule:
"""Compile a traced FX module
Includes: Partitioning + Conversion PhasesThere 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/_compiler.py 2026-07-02 19:37:03.008315+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/_compiler.py 2026-07-02 19:37:23.035277+00:00
@@ -1077,13 +1077,11 @@
sample_arg_inputs: Sequence[Input],
sample_kwarg_inputs: Optional[dict[Any, Any]] = None,
settings: CompilationSettings = CompilationSettings(),
engine_cache: Optional[BaseEngineCache] = None,
*,
- graph_signature: Optional[
- torch.export.graph_signature.ExportGraphSignature
- ] = None,
+ graph_signature: Optional[torch.export.graph_signature.ExportGraphSignature] = None,
_debugger_config: Optional[DebuggerConfig] = None,
) -> torch.fx.GraphModule:
"""Compile a traced FX module
Includes: Partitioning + Conversion Phases
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.
Cherry-pick of #4213 onto
release/2.13.Squashed: the PR's 11 work-in-progress commits were collapsed into a single commit using the PR's net diff vs its merge-base with
main, so unrelatedmaincommits the branch had picked up (notably the 2.13→2.14 version bump #4338) are excluded — release/2.13 stays on 2.13.Conflict resolved in
py/torch_tensorrt/dynamo/_compiler.py(both additive): took the PR side for thecompile_module(..., graph_signature=exported_program.graph_signature)call and the addeduser_symbol_bounds/fallback_data_dependent_opsblock. The other 3 files applied cleanly.🔎 Pre-existing issue inherited from #4213 (not introduced here): #4213 makes
graph_signaturea required keyword-only arg ofcompile_module, butpy/torch_tensorrt/dynamo/backend/backends.pystill callscompile_module(...)without it (true on bothmain/PR-head and here). Thetorch.compilebackend path would raiseTypeErroruntil #4213 addresses this. Flagging for awareness.Original PR: #4213
🤖 Generated with Claude Code