Skip to content

Commit bb46dce

Browse files
committed
Add test_long_kernel
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.
1 parent a5b1452 commit bb46dce

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_loopy.py

+15
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,21 @@ def test_no_unnecessary_lbarrier(ctx_factory):
36893689
assert not barrier_between(knl, "write_s_a", "write_ao")
36903690

36913691

3692+
def test_long_kernel():
3693+
n = 500
3694+
insns = [
3695+
f"a{i}[j{i}] = j{i}"
3696+
for i in range(n)
3697+
]
3698+
domains = [
3699+
f"{{ [j{i}]: 0<=j{i}<10 }}"
3700+
for i in range(n)
3701+
]
3702+
t_unit = lp.make_kernel(domains, insns)
3703+
t_unit = lp.preprocess_kernel(t_unit)
3704+
lp.get_one_linearized_kernel(t_unit.default_entrypoint, t_unit.callables_table)
3705+
3706+
36923707
if __name__ == "__main__":
36933708
if len(sys.argv) > 1:
36943709
exec(sys.argv[1])

0 commit comments

Comments
 (0)