Skip to content

[cherry-pick][release/2.13] user provided bound for torchtrt compile (#4213)#4375

Open
apbose wants to merge 3 commits into
release/2.13from
cherrypick_4213
Open

[cherry-pick][release/2.13] user provided bound for torchtrt compile (#4213)#4375
apbose wants to merge 3 commits into
release/2.13from
cherrypick_4213

Conversation

@apbose

@apbose apbose commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Cherry-pick of #4213 onto release/2.13.

⚠️ Note: #4213 is still OPEN (not merged). This cherry-pick reflects the current state of that PR.

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 unrelated main commits 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 the compile_module(..., graph_signature=exported_program.graph_signature) call and the added user_symbol_bounds / fallback_data_dependent_ops block. The other 3 files applied cleanly.

🔎 Pre-existing issue inherited from #4213 (not introduced here): #4213 makes graph_signature a required keyword-only arg of compile_module, but py/torch_tensorrt/dynamo/backend/backends.py still calls compile_module(...) without it (true on both main/PR-head and here). The torch.compile backend path would raise TypeError until #4213 addresses this. Flagging for awareness.

Original PR: #4213

🤖 Generated with Claude Code

…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>
@github-actions github-actions Bot added component: tests Issues re: Tests component: core Issues re: The core compiler component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Jun 30, 2026
@meta-cla meta-cla Bot added the cla signed label Jun 30, 2026
@github-actions github-actions Bot requested a review from cehongwang June 30, 2026 16:15
apbose and others added 2 commits July 2, 2026 12:20
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>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Phases

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant