diff --git a/test/test_target.py b/test/test_target.py index b6acd0902..a7e838785 100644 --- a/test/test_target.py +++ b/test/test_target.py @@ -719,6 +719,24 @@ def test_empty_array_stride_check_fortran(ctx_factory): knl(queue, input=a_f) +def test_non_executable_targets_respect_args(): + # See https://github.com/inducer/loopy/issues/648 + t_unit = lp.make_kernel( + "{ : }", + """ + a[0] = 1729 + """, + [lp.GlobalArg("a,b,c,d,e", + shape=(10,), + dtype="float64")], + target=lp.CTarget() + ) + code_str = lp.generate_code_v2(t_unit).device_code() + + for var in ["b", "c", "d", "e"]: + assert code_str.find(f"double const *__restrict__ {var}") != -1 + + if __name__ == "__main__": if len(sys.argv) > 1: exec(sys.argv[1])