def test_dependent_loop_bounds_4(): # https://gitlab.tiker.net/inducer/loopy/issues/23 import loopy as lp loopy_knl = lp.make_kernel([ "{[a]: 0<=a<10}", "{[b]: b_start<=b<b_end}", "{[c,idim]: c_start<=c<c_end and 0<=idim<dim}", ], """ for a <> b_start = 1 <> b_end = 2 for b <> c_start = 1 <> c_end = 2 for c ... nop end <>t[idim] = 1 end end """, "...", seq_dependencies=True) loopy_knl = lp.fix_parameters(loopy_knl, dim=3) with lp.CacheMode(False): lp.generate_code_v2(loopy_knl)
def test_ilp_write_race_detection_global(ctx_factory): ctx = ctx_factory() knl = lp.make_kernel("[n] -> {[i,j]: 0<=i,j<n }", [ "a[i] = 5+i+j", ], [ lp.GlobalArg("a", np.float32), lp.ValueArg("n", np.int32, approximately=1000), ], assumptions="n>=1") knl = lp.tag_inames(knl, dict(j="ilp")) knl = lp.preprocess_kernel(knl, ctx.devices[0]) with lp.CacheMode(False): from loopy.diagnostic import WriteRaceConditionWarning from warnings import catch_warnings with catch_warnings(record=True) as warn_list: list(lp.generate_loop_schedules(knl)) assert any( isinstance(w.message, WriteRaceConditionWarning) for w in warn_list)