From abcebc984e15d4103bfa033c173f9746bd0a3c57 Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni Date: Mon, 17 May 2021 08:05:26 -0500 Subject: [PATCH] test floor div in sub-array-ref exprs --- test/test_callables.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test_callables.py b/test/test_callables.py index d7b3ab447..f79f6e8f1 100644 --- a/test/test_callables.py +++ b/test/test_callables.py @@ -792,6 +792,32 @@ def test_double_hw_axes_used_in_knl_call(inline): lp.generate_code_v2(knl) +@pytest.mark.parametrize("inline", [True, False]) +def test_kc_with_floor_div_in_expr(ctx_factory, inline): + # See https://github.com/inducer/loopy/issues/366 + import loopy as lp + + ctx = ctx_factory() + callee = lp.make_function( + "{[i]: 0<=i<10}", + """ + x[i] = 2*x[i] + """, name="callee_with_update") + + knl = lp.make_kernel( + "{[i]: 0<=i<10}", + """ + [i]: x[2*(i//2) + (i%2)] = callee_with_update([i]: x[i]) + """) + + knl = lp.merge([knl, callee]) + + if inline: + knl = lp.inline_callable_kernel(knl, "callee_with_update") + + lp.auto_test_vs_ref(knl, ctx, knl) + + if __name__ == "__main__": if len(sys.argv) > 1: exec(sys.argv[1]) -- GitLab