Skip to content

Python runtime rework #4222

Open
cehongwang wants to merge 13 commits intomainfrom
python-runtime-rework-patches
Open

Python runtime rework #4222
cehongwang wants to merge 13 commits intomainfrom
python-runtime-rework-patches

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 Apr 29, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation component: tests Issues re: Tests component: conversion Issues re: Conversion stage 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 Apr 29, 2026
@github-actions github-actions Bot requested a review from zewenli98 April 29, 2026 00:01
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.

Not sure this PR is clean yet

: TRTEngine::ResourceAllocationStrategy::kStatic);
})
.def_readwrite("use_pre_allocated_outputs", &TRTEngine::use_pre_allocated_outputs)
.def_readwrite("pre_allocated_outputs", &TRTEngine::pre_allocated_outputs)
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.

Why do we need both?

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.

The first one is the flag, and the second one is the tensor. There is a test that compares the output tensor pointer to verify it is the same tensor. So the second one is needed

.. code-block:: python

tp_group = dist.new_group(ranks=[0, 1])
with torch_tensorrt.distributed.distributed_context(tp_group, trt_model) as model:
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.

Are we keeping this or removing it?

Comment thread py/torch_tensorrt/dynamo/runtime/_serialized_engine_layout.py
Comment thread py/torch_tensorrt/dynamo/_exporter.py Outdated
Comment thread scripts/remove_set_runtime_backend_with.py Outdated
@cehongwang cehongwang force-pushed the python-runtime-rework-patches branch from daad718 to a328e80 Compare April 29, 2026 20:59
Copy link
Copy Markdown
Collaborator

@zewenli98 zewenli98 left a comment

Choose a reason for hiding this comment

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

Is this PR based on #4164? Why do we need two separate PRs?
Can you complete Description of the PRs so that other folks can understand why and what the PRs are doing?

@cehongwang cehongwang force-pushed the python-runtime-rework-patches branch from a328e80 to 00e4ea2 Compare April 30, 2026 21:04
@cehongwang cehongwang changed the title Python runtime rework patches Python runtime rework Apr 30, 2026
@cehongwang cehongwang force-pushed the python-runtime-rework-patches branch from 00e4ea2 to 168bdea Compare April 30, 2026 22:08
@cehongwang
Copy link
Copy Markdown
Collaborator Author

I will revert the commit 168bdea547a614b26c256527f65217e2d0fbf222 once the pytorch changes are landed.

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: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: runtime component: tests Issues re: Tests documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants