Skip to content

ThunderFX: Modify GraphModule in-place - #2399

Merged
shino16 merged 8 commits into
Lightning-AI:mainfrom
shino16:do-not-return-deepcopy-of-GraphModule
Aug 28, 2025
Merged

shino16 merged 8 commits into
Lightning-AI:mainfrom
shino16:do-not-return-deepcopy-of-GraphModule

Conversation

@shino16

@shino16 shino16 commented Aug 6, 2025

Copy link
Copy Markdown
Collaborator

Fixes #1821.

Changes

  • ThunderFX now mutates the given GraphModule itself.
  • As part of it, remove_empty_autocast(gm) is changed in the same way.

See @kiya00's analysis on why this resolves #1821.

Further step

As @kshitij12345 has pointed out in his comment, the existing deepcopy of the GraphModules for constructing subgraph_info should be avoided. This PR changes the way we handle the GraphModule argument but does not eliminate copying.

@kshitij12345 kshitij12345 left a comment

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.

LGTM, thanks @shino16

Comment thread thunder/dynamo/splitter.py
@kshitij12345
kshitij12345 requested a review from kiya00 August 6, 2025 10:31
Comment thread thunder/dynamo/utils.py Outdated
Masato Shinokawa and others added 4 commits August 6, 2025 23:36
…optionally save fusion region and traces (Lightning-AI#2232)

While exploring the split reasons and observing changes in traces and fusion areas when adding missing fallback operators, I realized that having an API to save all repro scripts, with options to also save fusion graphs or traces to files, would be helpful. Before this PR, the user had to do the iteration and save manually.
@shino16
shino16 force-pushed the do-not-return-deepcopy-of-GraphModule branch from 3bffc0b to 64e9426 Compare August 7, 2025 06:37

@t-vi t-vi left a comment

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.

@kiya00

kiya00 commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

Hi @shino16 , Tom has stamped, let's rebase and merge it.
By the way, the commit history seems a bit strange, but the files changed are correct, don't know if that would matter when squash

@shino16
shino16 enabled auto-merge (squash) August 28, 2025 13:08
@shino16
shino16 merged commit ec2f746 into Lightning-AI:main Aug 28, 2025
59 of 65 checks passed
@shino16
shino16 deleted the do-not-return-deepcopy-of-GraphModule branch August 28, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_dynamo.py::test_thundercompiler_optim_step broken

5 participants