Skip to content

Commit a5416b8

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 b62de69 commit a5416b8

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
@@ -3668,6 +3668,21 @@ def test_no_unnecessary_lbarrier(ctx_factory):
36683668
assert not barrier_between(knl, "write_s_a", "write_ao")
36693669

36703670

3671+
def test_long_kernel():
3672+
n = 500
3673+
insns = [
3674+
f"a{i}[j{i}] = j{i}"
3675+
for i in range(n)
3676+
]
3677+
domains = [
3678+
f"{{ [j{i}]: 0<=j{i}<10 }}"
3679+
for i in range(n)
3680+
]
3681+
t_unit = lp.make_kernel(domains, insns)
3682+
t_unit = lp.preprocess_kernel(t_unit)
3683+
lp.get_one_linearized_kernel(t_unit.default_entrypoint, t_unit.callables_table)
3684+
3685+
36713686
if __name__ == "__main__":
36723687
if len(sys.argv) > 1:
36733688
exec(sys.argv[1])

0 commit comments

Comments
 (0)