diff --git a/test/test_callables.py b/test/test_callables.py index d7b3ab4475e6c5cabf0d44896c982e8bddf27484..f79f6e8f193b639ea7b6ea2609e22fa3e87a534d 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])