Skip to content

supported cross serialization and runtime merge#4286

Open
cehongwang wants to merge 2 commits into
mainfrom
cross-serialization
Open

supported cross serialization and runtime merge#4286
cehongwang wants to merge 2 commits into
mainfrom
cross-serialization

Conversation

@cehongwang
Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@meta-cla meta-cla Bot added the cla signed label May 21, 2026
@github-actions github-actions Bot added component: core Issues re: The core compiler component: api [Python] Issues re: Python API component: runtime component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels May 21, 2026
@github-actions github-actions Bot requested a review from narendasan May 21, 2026 21:59
Copy link
Copy Markdown
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

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

One minor thing then looks good

from torch_tensorrt.dynamo.runtime._TRTEngine import TRTEngine

self.engine = TRTEngine(
self.engine = TRTEngine( # type: ignore[assignment]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Think you can just add a :Optional[torch.classes.tensorrt.Engine|TRTEngine] above

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It gives me lots of other errors:

py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:234: error: Item "None" of "Any | None" has no attribute "streamable_device_memory_budget"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:237: error: Item "None" of "Any | None" has no attribute "automatic_device_memory_budget"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:240: error: Item "None" of "Any | None" has no attribute "device_memory_budget"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:245: error: Item "None" of "Any | None" has no attribute "device_memory_budget"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:246: error: Item "None" of "Any | None" has no attribute "device_memory_budget"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:248: error: Item "None" of "Any | None" has no attribute "device_memory_budget"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:254: error: Item "None" of "Any | None" has no attribute "reset_captured_graph"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:260: error: Item "None" of "Any | None" has no attribute "use_dynamically_allocated_resources"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:384: error: Unused "type: ignore" comment  [unused-ignore]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:399: error: Item "None" of "Any | None" has no attribute "use_pre_allocated_outputs"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:409: error: Item "None" of "Any | None" has no attribute "use_output_allocator_outputs"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:467: error: Item "None" of "Any | None" has no attribute "set_output_tensors_as_unowned"  [union-attr]
py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py:470: error: Item "None" of "Any | None" has no attribute "are_output_tensors_unowned"  [union-attr]

@cehongwang cehongwang force-pushed the cross-serialization branch from 067ebe3 to a863aad Compare June 1, 2026 22:36
@cehongwang cehongwang force-pushed the cross-serialization branch from a863aad to 3474e91 Compare June 1, 2026 23:28
Copy link
Copy Markdown
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

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

Looks fine, please get an additional reviewer and make sure we are testing Python only in CI as a separate line of jobs for each channel

@cehongwang cehongwang requested a review from lanluo-nvidia June 1, 2026 23:38
Comment on lines +224 to +230
warnings.warn(
"`use_python_runtime` is deprecated and has no effect. The Python and C++ "
"runtimes have been merged; the runtime is now selected automatically based "
"on whether the C++ Torch-TensorRT runtime is available. This argument will "
"be removed in a future release.",
DeprecationWarning,
stacklevel=2,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the path to test in CI currently? Do we have two jobs for each {CUDA-VERSION, GPU, OS, Flavor} combination (I realize CUDA-VERSION, GPU is fixed for now and flavor here refers to TRT standard vs TRT-RTX) : one with wheels built and one without?

From my read of the CI files : https://github.com/pytorch/TensorRT/blob/main/.github/workflows/build-test-linux-x86_64.yml it seems we only exercise the C++ route (build wheel, install it and run tests, which should pick the C++ runtime)? Is that right, or is my understanding off?

If so, can we first have a an MR updating CI to run both tests with python and C++ runtime and then put in this change? We are developing C++/python runtime features in parallel for TRT-RTX and want to test both paths if possible. Thanks!

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: runtime Force All Tests[L0+L1+L2] For run all the L0, L1, L2 tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants