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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add test_long_kernel #826

wants to merge 1 commit into from

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.

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 mentioned this pull request Feb 16, 2024
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.

None yet

1 participant