Skip to content

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

@meta-cla meta-cla bot added the cla signed label Nov 4, 2025
@github-actions github-actions bot added component: tests Issues re: Tests component: lowering Issues re: The lowering / preprocessing passes component: conversion Issues re: Conversion stage component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Nov 4, 2025
@github-actions github-actions bot requested a review from peri044 November 4, 2025 20:05
Copy link

@github-actions github-actions bot 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.py	2025-11-04 20:05:23.825034+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/_compiler.py	2025-11-04 20:05:55.253944+00:00
@@ -876,15 +876,14 @@
    # This is done to release CPU memory.
    for attr in dir(gm):
        if attr.startswith("_frozen_param"):
            delattr(gm, attr)

-
-
    from torch_tensorrt.dynamo.conversion._ConverterRegistry import DYNAMO_CONVERTERS
+
    DYNAMO_CONVERTERS.disallowed_targets = set()
-    
+
    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):
            continue

Copy link
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.

Do you have a test case or something to demonstrate this feature?

@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from 7f0e504 to 18ccadf Compare November 5, 2025 22:03
@narendasan
Copy link
Collaborator

  1. We should think about using this tech for refit vs non refit
  2. Make refit apis work across graph breaks

@narendasan
Copy link
Collaborator

Improve usability by automating nn.Module -> atomic fx graph

@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from 18ccadf to f03ab2c Compare November 6, 2025 20:06
@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch 3 times, most recently from c2c7fce to 6f580b6 Compare November 13, 2025 19:11
@github-actions github-actions bot removed component: tests Issues re: Tests component: lowering Issues re: The lowering / preprocessing passes component: conversion Issues re: Conversion stage labels Nov 13, 2025
@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from 6f580b6 to b9fe0c1 Compare November 13, 2025 19:20
@github-actions github-actions bot added the component: tests Issues re: Tests label Nov 14, 2025
@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from e7cad5b to 99581e2 Compare November 14, 2025 19:13
Copy link
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.

Its looking good, just add a quick example in the examples folder and list it under contributor documentation for now

@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from 3b02ef9 to 290cc39 Compare November 14, 2025 20:19
@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from aba69ef to 756f827 Compare November 18, 2025 00:06
@cehongwang cehongwang linked an issue Nov 18, 2025 that may be closed by this pull request
@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from cb8480d to 2d6053e Compare November 19, 2025 21:20
subgraphs = [Subgraph(is_acc=True, nodes=nodes)]
self.fusion_patterns = get_node_in_fusion_pattern(self.module.graph)

assert self.check_topological_order(
Copy link
Collaborator

Choose a reason for hiding this comment

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

When will this fail? Do we need to check this or can FX just guarantee this for us?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should never fail. I put this here just in case something changes in torch and we don't know

require_full_compilation=settings.require_full_compilation,
)

partitioned_module = resource_partition(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shoudnt this conditionally run based on if the user provided a budget at all?

Copy link
Collaborator

Choose a reason for hiding this comment

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

/ should we make this opt in while testing?

== 2
), "The graph should have 2 non-accelerated subgraphs"

def test_resource_partitioning_with_global_capability_partitioning(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should also have a test with no fall back as well as a test which tests for making sure that the atomic subgraph system works

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also one that tests registering a new atomic subgraph and then verifying that it has the desired effect

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also one that tests registering a new atomic subgraph and then verifying that it has the desired effect
Can this prove the atomic subgraph system works?

@cehongwang cehongwang force-pushed the cpu-memory-graph-break branch from a061180 to a67d4a6 Compare November 21, 2025 22:56
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: 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.

✨[Feature] Resource aware Graph partitioner

4 participants