Skip to content

[dynamo, nested graph breaks] support very simple nested graph breaks #159329

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.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: gh/williamwen42/267/base
Choose a base branch
from

Conversation

Copy link

pytorch-bot bot commented Jul 29, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 353beee with merge base d68c323 (image):
💚 Looks good so far! There are no failures yet. 💚

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

…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
@williamwen42 williamwen42 added the topic: not user facing topic category label Jul 30, 2025
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
williamwen42 added a commit that referenced this pull request Jul 31, 2025
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
@williamwen42 williamwen42 marked this pull request as ready for review August 8, 2025 01:46
…raph breaks"


e.g. this graph breaks once now:
```python
import torch

torch._dynamo.config.nested_graph_breaks = True


def inner(x):
    x = x + 1
    torch._dynamo.graph_break()
    return x + 2


torch.compile(backend="eager")
def outer(x):
    return inner(x)


print(outer(torch.ones(3)))
```


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

[ghstack-poisoned]
@williamwen42 williamwen42 requested a review from StrongerXi August 8, 2025 23:29
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.

1 participant