From 161365a9d92babea385a1ed10d42617ecbe19ed9 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 13 Jan 2023 11:02:39 +0530 Subject: [PATCH] Add a failing test with holes in inames --- test/test_callables.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/test_callables.py b/test/test_callables.py index f3b701b67..c7f6ca675 100644 --- a/test/test_callables.py +++ b/test/test_callables.py @@ -1430,6 +1430,37 @@ def test_inline_stride(): lp.generate_code_v2(knl).device_code() +@pytest.mark.xfail +@pytest.mark.parametrize("inline", [False, True]) +def test_inames_with_holes(ctx_factory, inline): + child_knl = lp.make_function( + ["{[i]: 0<=i<3}"], + """ + g[i] = 1 + """, name="foo") + parent_knl = lp.make_kernel( + ["{[j]:0<=j<5 and j%4<2}"], + """ + [j]: z[j] = foo() + """, + kernel_data=[ + lp.GlobalArg( + name="z", + dtype=np.float64, + shape=(5,)), + ...], + ) + knl = lp.merge([parent_knl, child_knl]) + if inline: + knl = lp.inline_callable_kernel(knl, "foo") + + ctx = ctx_factory() + queue = cl.CommandQueue(ctx) + + evt, (out,) = knl(queue) + assert np.allclose(out.get(), np.array([1, 1, 0, 0, 1], dtype=np.float64)) + + if __name__ == "__main__": if len(sys.argv) > 1: exec(sys.argv[1])