From a2775d69f2b663939650f0beccc0fb4d69936087 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Sun, 19 Apr 2015 12:31:46 -0500 Subject: [PATCH] Add test of fix in 85d81e --- test/test_loopy.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/test/test_loopy.py b/test/test_loopy.py index 9498dab35..e713dd7d4 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -1843,7 +1843,40 @@ def test_precompute_confusing_subst_arguments(ctx_factory): def test_precompute_nested_subst(ctx_factory): - pass + ctx = ctx_factory() + + knl = lp.make_kernel( + "{[i,j]: 0<=i<n and 0<=j<5}", + """ + E:=a[i] + D:=E*E + b[i] = D + """) + + knl = lp.add_and_infer_dtypes(knl, dict(a=np.float32)) + + ref_knl = knl + + knl = lp.tag_inames(knl, dict(j="g.1")) + knl = lp.split_iname(knl, "i", 128, outer_tag="g.0", inner_tag="l.0") + + from loopy.symbolic import get_dependencies + assert "i_inner" not in get_dependencies(knl.substitutions["D"].expression) + knl = lp.precompute(knl, "D", "i_inner") + + # There's only one surviving 'E' rule. + assert len([ + rule_name + for rule_name in knl.substitutions + if rule_name.startswith("E")]) == 1 + + # That rule should use the newly created prefetch inames, + # not the prior 'i_inner' + assert "i_inner" not in get_dependencies(knl.substitutions["E"].expression) + + lp.auto_test_vs_ref( + ref_knl, ctx, knl, + parameters=dict(n=12345)) def test_poisson(ctx_factory): -- GitLab