Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Graph break overhead#3946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cehongwang wants to merge3 commits intomain
base:main
Choose a base branch
Loading
fromgraph-break-overhead
Open

Graph break overhead#3946

cehongwang wants to merge3 commits intomainfromgraph-break-overhead

Conversation

@cehongwang
Copy link
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

@github-actionsgithub-actionsbot added component: coreIssues re: The core compiler component: build systemIssues re: Build system component: api [Python]Issues re: Python API component: runtime component: dynamoIssues relating to the `torch.compile` or `torch._dynamo.export` paths labelsDec 3, 2025
@cehongwangcehongwangforce-pushed thegraph-break-overhead branch 2 times, most recently from7541aca to10662c0CompareDecember 12, 2025 00:21
Copy link

@github-actionsgithub-actionsbot left a comment

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.py2025-12-12 00:21:37.519598+00:00+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/_compiler.py2025-12-12 00:22:13.058405+00:00@@ -947,11 +947,11 @@    # Here we delete the frozen parameters from the graph module. Note this does not affect the submodules. We are going to delete the frozen parameters from the submodules in the convert_module function.    # This is done to release CPU memory.    for attr in dir(gm):        if attr.startswith("_frozen_param"):            delattr(gm, attr)-+    trt_module = None    for name, _ in partitioned_module.named_children():        submodule = getattr(partitioned_module, name)        # filter on the GraphModule        if not isinstance(submodule, torch.fx.graph_module.GraphModule):

@cehongwangcehongwangforce-pushed thegraph-break-overhead branch 4 times, most recently from4813804 to4615705CompareDecember 16, 2025 20:43
TORCHTRT_CHECK(
compiled_engine->exec_ctx->setInputShape(name.c_str(), dims),"Error while setting the input shape");

if (shape_changed) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we use the same shape keys we used for cudagraphs? Why are we implementing another system?

num_io =std::make_pair(inputs_size, outputs);

this->current_device_id =at::cuda::current_device();
this->stream =c10::cuda::getCurrentCUDAStream(this->current_device_id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this PR supposed to implement the stream operator?

forattrindir(gm):
ifattr.startswith("_frozen_param"):
delattr(gm,attr)
trt_module=None
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this? Why does this variable need to be outside the of scope of iterating through the module?

trt_module=getattr(partitioned_module,name)
trt_module.setup_engine()

iftrt_module:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this is a pretty round about way to get the last engine

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also the order from items is not deterministic so I dont think this is guaranteed to give you the last module anyway. You might need to work back from outputs.

cehongwang reacted with thumbs up emoji
settings.use_fast_partitioner=True

dryrun_stats_display(dryrun_tracker,settings.dryrun)
ifnotsettings.dryrun:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this conditioned on dry run? Dry run should reflect the deployment graph

cmd.append("--compilation_mode=dbg")
else:
cmd.append("--compilation_mode=opt")
#if develop:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove



@torch.library.custom_op("tensorrt::enter_compute_stream",mutates_args=())
defenter_compute_stream()->None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO these should likely be dependent on the input tensors and pull their stream information from there. You arent necessarily guaranteed for the input tensors to be on the default stream. It also means you need storage for the streams.

Also how does this work in c++?

partitioned_module:torch.fx.GraphModule,
)->torch.fx.GraphModule:
fornodeinpartitioned_module.graph.nodes:
ifnode.op=="placeholder":
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if there are multiple placeholders or outputs?

@github-actionsgithub-actionsbot removed the component: build systemIssues re: Build system labelDec 17, 2025
@github-actionsgithub-actionsbot added the component: build systemIssues re: Build system labelDec 17, 2025
@cehongwangcehongwangforce-pushed thegraph-break-overhead branch 2 times, most recently from7022b29 tod36494aCompareDecember 17, 2025 23:00
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@narendasannarendasannarendasan left review comments

@github-actionsgithub-actions[bot]github-actions[bot] requested changes

Assignees

No one assigned

Labels

cla signedcomponent: api [Python]Issues re: Python APIcomponent: build systemIssues re: Build systemcomponent: coreIssues re: The core compilercomponent: dynamoIssues relating to the `torch.compile` or `torch._dynamo.export` pathscomponent: runtime

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@cehongwang@narendasan

[8]ページ先頭

©2009-2025 Movatter.jp