8000 [dynamo][fx] Don't emit `call_function` node to construct `NamedTuple` instances for Dynamo and `make_fx` tracing by StrongerXi · Pull Request #147145 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[dynamo][fx] Don't emit call_function node to construct NamedTuple instances for Dynamo and make_fx tracing #147145

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Al 8000 ready on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

StrongerXi
Copy link
Contributor
@StrongerXi StrongerXi commented Feb 13, 2025

[ghstack-poisoned]
Copy link
pytorch-bot bot commented Feb 13, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/147145

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Unrelated Failure

As of commit 7be4215 with merge base f95bdf5 (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

StrongerXi added a commit that referenced this pull request Feb 13, 2025
…` instances for Dynamo and `make_fx` tracing

As title. This effectively undoes #49553, for Dynamo and `make_fx`
tracing only (for `symbolic_trace` backward compatibility reasons).

It heps enforce the invariant that Dynamo and `make_fx` graphs would
always contain tensor ops -- so rather than having these `call_function`
nodes to construct `NamedTuple`, we inline them directly as instance
arguments to the user nodes.

ghstack-source-id: d87a554
Pull Request resolved: #147145
@zou3519 zou3519 self-requested a review February 13, 2025 21:59
Comment on lines 145 to 151
# Decides whether we represent `NamedTuple` instances into `call_function`
# nodes in the IR, or inline them directly as instance arguments to the user
# nodes.
_proxy_named_tuple: bool

def __init__(self):
self._proxy_named_tuple = True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zou3519 not sure what's the best way to do it here, so this is just to get the proof-of-concept working.

"""
Given the output arguments, generates the return statement of the FX function.
Note: The returned statement should not be indented.
"""
return f"return {repr(output_args)}"
return f"return {arg_repr(output_args)}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the arg_repr plumbing is to get this to apply.

[ghstack-poisoned]
@StrongerXi
Copy link
Contributor Author

Abandoning this stack, see #147530.

@StrongerXi StrongerXi closed this Feb 20, 2025
@github-actions github-actions bot deleted the gh/StrongerXi/85/head branch March 25, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0