Skip to content
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

Add test_long_kernel #826

Merged
merged 1 commit into from
Aug 25, 2024
Merged

Add test_long_kernel #826

merged 1 commit into from
Aug 25, 2024

Conversation

inducer
Copy link
Owner

@inducer inducer commented Feb 16, 2024

On Python 3.12, this provokes a stack overflow in the scheduler. It is not quite clear why that's the case; pure-Python recursion even with generators seems to respond well to setrecursionlimit():

def f(n):
    if n:
        yield from f(n-1)
    else:
        yield 5

import sys
sys.setrecursionlimit(3500)
print(list(f(3400)))

That said, there have been behavior changes in Py3.12 in this regard, but it is not clear what exactly about Loopy's behavior makes it fall into the 'bad' case.

This is a smaller reproducer of an issue flagged by @a-alveyblanc in the context of tensor product code generated from Pytato.

It appears that Py3.12 will receive some changes soon that mitigate this. More broadly, a better scheduling algorithm would help with this, as would #350.

@inducer inducer mentioned this pull request Feb 16, 2024
On Python 3.12, this provokes a stack overflow in the scheduler. It is
not quite clear why that's the case; pure-Python recursion even with
generators seems to respond well to setrecursionlimit():

```py
def f(n):
    if n:
        yield from f(n-1)
    else:
        yield 5

import sys
sys.setrecursionlimit(3500)
print(list(f(3400)))
```

That said, there have been [behavior](python/cpython#96510)
[changes](python/cpython#112215)
in Py3.12 in this regard, but it is not clear what exactly
about Loopy's behavior makes it fall into the 'bad' case.
@inducer inducer force-pushed the provoke-sched-stack-overflow branch from a5416b8 to 6587602 Compare August 25, 2024 12:42
@inducer inducer marked this pull request as ready for review August 25, 2024 12:42
@inducer inducer enabled auto-merge (rebase) August 25, 2024 12:45
@inducer inducer merged commit bb46dce into main Aug 25, 2024
19 checks passed
@inducer inducer deleted the provoke-sched-stack-overflow branch August 25, 2024 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.

1 participant