From 45d329e78b18b816a5e49c9ac724c1ea0bde4430 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 9 Feb 2018 17:23:43 -0600 Subject: [PATCH] Fix undefined order errors in tests --- test/test_apps.py | 13 +++++++------ test/test_fortran.py | 6 +----- test/test_loopy.py | 28 ++++++++++++++-------------- test/test_transform.py | 2 +- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/test/test_apps.py b/test/test_apps.py index 3be133d94..4707b7f07 100644 --- a/test/test_apps.py +++ b/test/test_apps.py @@ -258,7 +258,7 @@ def test_rob_stroud_bernstein_full(ctx_factory): <> w = s**(deg-alpha1) {id=init_w} <> tmp[alpha1,i2] = tmp[alpha1,i2] + w * coeffs[aind] \ - {id=write_tmp} + {id=write_tmp,dep=init_w:aind_init} for alpha2 w = w * r * ( deg - alpha1 - alpha2 ) / (1 + alpha2) \ {id=update_w,dep=init_w:write_tmp} @@ -272,15 +272,16 @@ def test_rob_stroud_bernstein_full(ctx_factory): <> xi2 = qpts[0, i1_2] {dep=aind_incr} <> s2 = 1-xi2 <> r2 = xi2/s2 - <> w2 = s2**deg + <> w2 = s2**deg {id=w2_init} for alpha1_2 for i2_2 result[el, i1_2, i2_2] = result[el, i1_2, i2_2] + \ - w2 * tmp[alpha1_2, i2_2] + w2 * tmp[alpha1_2, i2_2] {id=res2,dep=w2_init} end - w2 = w2 * r2 * (deg-alpha1_2) / (1+alpha1_2) + w2 = w2 * r2 * (deg-alpha1_2) / (1+alpha1_2) \ + {id=w2_update, dep=res2} end end end @@ -491,9 +492,9 @@ def test_lbm(ctx_factory): f_new[i, j, 11] = + 0.25*m[8] - 0.125*m[10] - 0.25*m[11] end end - """, - lang_version=(2017, 2, 1)) + """) + knl = lp.set_options(knl, enforce_variable_access_ordered="no_check") knl = lp.add_and_infer_dtypes(knl, {"f": np.float32}) ref_knl = knl diff --git a/test/test_fortran.py b/test/test_fortran.py index 842a0127e..ea2f68b61 100644 --- a/test/test_fortran.py +++ b/test/test_fortran.py @@ -405,15 +405,11 @@ def test_fuse_kernels(ctx_factory): fortran_template.format( inner=(xd_line + "\n" + yd_line), name="xyderiv")) - knl = lp.fuse_kernels((xderiv, yderiv)) + knl = lp.fuse_kernels((xderiv, yderiv), data_flow=[("result", 0, 1)]) knl = lp.prioritize_loops(knl, "e,i,j,k") assert len(knl.temporary_variables) == 2 - # This is needed for correctness, otherwise ordering could foul things up. - knl = lp.assignment_to_subst(knl, "prev") - knl = lp.assignment_to_subst(knl, "prev_0") - ctx = ctx_factory() lp.auto_test_vs_ref(xyderiv, ctx, knl, parameters=dict(nelements=20, ndofs=4)) diff --git a/test/test_loopy.py b/test/test_loopy.py index 8229f613e..273d0cfd0 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -893,8 +893,8 @@ def test_multiple_writes_to_local_temporary(): knl = lp.make_kernel( "{[i,e]: 0<=i<5 and 0<=e temp[i, 0] = 17 - temp[i, 1] = 15 + <> temp[i, 0] = 17 {nosync_query=writes:temp} + temp[i, 1] = 15 {nosync_query=writes:temp} """) knl = lp.tag_inames(knl, dict(i="l.0")) @@ -1849,7 +1849,7 @@ def test_nop(ctx_factory): <> z[i] = z[i+1] + z[i] {id=wr_z} <> v[i] = 11 {id=wr_v} ... nop {dep=wr_z:wr_v,id=yoink} - z[i] = z[i] - z[i+1] + v[i] + z[i] = z[i] - z[i+1] + v[i] {dep=yoink} end """) @@ -2110,11 +2110,11 @@ def test_if_else(ctx_factory): "{ [i]: 0<=i<50}", """ if i % 3 == 0 - a[i] = 15 + a[i] = 15 {nosync_query=writes:a} elif i % 3 == 1 - a[i] = 11 + a[i] = 11 {nosync_query=writes:a} else - a[i] = 3 + a[i] = 3 {nosync_query=writes:a} end """ ) @@ -2134,14 +2134,14 @@ def test_if_else(ctx_factory): for i if i % 2 == 0 if i % 3 == 0 - a[i] = 15 + a[i] = 15 {nosync_query=writes:a} elif i % 3 == 1 - a[i] = 11 + a[i] = 11 {nosync_query=writes:a} else - a[i] = 3 + a[i] = 3 {nosync_query=writes:a} end else - a[i] = 4 + a[i] = 4 {nosync_query=writes:a} end end """ @@ -2162,17 +2162,17 @@ def test_if_else(ctx_factory): if i < 25 for j if j % 2 == 0 - a[i, j] = 1 + a[i, j] = 1 {nosync_query=writes:a} else - a[i, j] = 0 + a[i, j] = 0 {nosync_query=writes:a} end end else for j if j % 2 == 0 - a[i, j] = 0 + a[i, j] = 0 {nosync_query=writes:a} else - a[i, j] = 1 + a[i, j] = 1 {nosync_query=writes:a} end end end diff --git a/test/test_transform.py b/test/test_transform.py index d9ad97240..08e1d789d 100644 --- a/test/test_transform.py +++ b/test/test_transform.py @@ -78,7 +78,7 @@ def test_collect_common_factors(ctx_factory): """ out_tmp = 0 {id=out_init,inames=i} out_tmp = out_tmp + alpha[i]*a[i,j]*b1[j] {id=out_up1,dep=out_init} - out_tmp = out_tmp + alpha[i]*a[j,i]*b2[j] {id=out_up2,dep=out_init,nosync=} + out_tmp = out_tmp + alpha[i]*a[j,i]*b2[j] {id=out_up2,dep=out_up1} out[i] = out_tmp {dep=out_up1:out_up2} """) knl = lp.add_and_infer_dtypes(knl, -- GitLab