Skip to content

[dynamo][hop] Add intermediate to subgraph output only if side-effect observed#177368

Open
anijain2305 wants to merge 3 commits intogh/anijain2305/1077/basefrom
gh/anijain2305/1077/head
Open

[dynamo][hop] Add intermediate to subgraph output only if side-effect observed#177368
anijain2305 wants to merge 3 commits intogh/anijain2305/1077/basefrom
gh/anijain2305/1077/head

Conversation

@anijain2305
Copy link
Contributor

@anijain2305 anijain2305 commented Mar 13, 2026

Stack from ghstack (oldest at bottom):

Only collect intermediates as extra subgraph outputs when side effects
actually occurred during the trace, not whenever the HOP supports side
effects. Previously, allow_side_effects=True (a static class attribute
on InvokeSubgraphHigherOrderVariable) caused
collect_intermediate_outputs to run unconditionally, adding spurious
extra outputs to the graph.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @Lucaskabela @jataylo

… observed

Only collect intermediates as extra subgraph outputs when side effects
actually occurred during the trace, not whenever the HOP supports side
effects. Previously, allow_side_effects=True (a static class attribute
on InvokeSubgraphHigherOrderVariable) caused
collect_intermediate_outputs to run unconditionally, adding spurious
extra outputs to the graph.

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 13, 2026

🔗 Helpful Links

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

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

❌ 6 New Failures, 1 Unrelated Failure

As of commit c25e877 with merge base 3fab23b (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 13, 2026

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

anijain2305 added a commit that referenced this pull request Mar 13, 2026
… observed

Only collect intermediates as extra subgraph outputs when side effects
actually occurred during the trace, not whenever the HOP supports side
effects. Previously, allow_side_effects=True (a static class attribute
on InvokeSubgraphHigherOrderVariable) caused
collect_intermediate_outputs to run unconditionally, adding spurious
extra outputs to the graph.

ghstack-source-id: 5d6207f
Pull Request resolved: #177368
@anijain2305 anijain2305 added the keep-going Don't stop on first failure, keep running tests until the end label Mar 13, 2026
…side-effect observed"

Only collect intermediates as extra subgraph outputs when side effects
actually occurred during the trace, not whenever the HOP supports side
effects. Previously, allow_side_effects=True (a static class attribute
on InvokeSubgraphHigherOrderVariable) caused
collect_intermediate_outputs to run unconditionally, adding spurious
extra outputs to the graph.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo

[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Mar 14, 2026
… observed

Only collect intermediates as extra subgraph outputs when side effects
actually occurred during the trace, not whenever the HOP supports side
effects. Previously, allow_side_effects=True (a static class attribute
on InvokeSubgraphHigherOrderVariable) caused
collect_intermediate_outputs to run unconditionally, adding spurious
extra outputs to the graph.

ghstack-source-id: 6c2daa3
Pull Request resolved: #177368
…side-effect observed"

Only collect intermediates as extra subgraph outputs when side effects
actually occurred during the trace, not whenever the HOP supports side
effects. Previously, allow_side_effects=True (a static class attribute
on InvokeSubgraphHigherOrderVariable) caused
collect_intermediate_outputs to run unconditionally, adding spurious
extra outputs to the graph.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo

[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Mar 14, 2026
… observed

Only collect intermediates as extra subgraph outputs when side effects
actually occurred during the trace, not whenever the HOP supports side
effects. Previously, allow_side_effects=True (a static class attribute
on InvokeSubgraphHigherOrderVariable) caused
collect_intermediate_outputs to run unconditionally, adding spurious
extra outputs to the graph.

ghstack-source-id: 889247f
Pull Request resolved: #177368
@aorenste aorenste changed the title [dynamo][hop] Add intermediate to subgrahp output only if side-effect observed [dynamo][hop] Add intermediate to subgraph output only if side-effect observed Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests keep-going Don't stop on first failure, keep running tests until the end module: dynamo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant