From 0c3e3d9c94a35140c8babdc99f8eaef8ce8ba5e6 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 27 Nov 2016 11:51:58 -0600 Subject: [PATCH 1/4] Change default precompute barrier insn naming --- loopy/transform/precompute.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopy/transform/precompute.py b/loopy/transform/precompute.py index 5ab9dfab3..a19e06ecd 100644 --- a/loopy/transform/precompute.py +++ b/loopy/transform/precompute.py @@ -799,7 +799,7 @@ def precompute(kernel, subst_use, sweep_inames=[], within=None, if temporary_scope == temp_var_scope.GLOBAL: barrier_insn_id = kernel.make_unique_instruction_id( - based_on=c_subst_name+"_b") + based_on=c_subst_name+"_barrier") from loopy.kernel.instruction import BarrierInstruction barrier_insn = BarrierInstruction( id=barrier_insn_id, -- GitLab From 5169f6a30392e8c8a1abc137e8c07c5f996558fd Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 27 Nov 2016 12:24:48 -0600 Subject: [PATCH 2/4] Various fixese to add_dependency --- loopy/transform/instruction.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/loopy/transform/instruction.py b/loopy/transform/instruction.py index 92bcb0bf4..7c9c96886 100644 --- a/loopy/transform/instruction.py +++ b/loopy/transform/instruction.py @@ -92,13 +92,18 @@ def add_dependency(kernel, insn_match, depends_on): if isinstance(depends_on, str) and depends_on in kernel.id_to_insn: added_deps = frozenset([depends_on]) else: - added_deps = find_instructions(depends_on) + added_deps = frozenset( + dep.id for dep in find_instructions(kernel, depends_on)) if not added_deps: - raise LoopyError("no instructions found matching '%s'" % depends_on) + raise LoopyError("no instructions found matching '%s' " + "(to add as dependencies)" % depends_on) + + matched = [False] def add_dep(insn): new_deps = insn.depends_on + matched[0] = True if new_deps is None: new_deps = added_deps else: @@ -106,7 +111,13 @@ def add_dependency(kernel, insn_match, depends_on): return insn.copy(depends_on=new_deps) - return map_instructions(kernel, insn_match, add_dep) + result = map_instructions(kernel, insn_match, add_dep) + + if not matched[0]: + raise LoopyError("no instructions found matching '%s' " + "(to which dependencies would be added)" % insn_match) + + return result # }}} -- GitLab From ac35dfb6388d6a7310effc000571619af72223b6 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 27 Nov 2016 12:25:10 -0600 Subject: [PATCH 3/4] Fix test_global_parallel_reduction for barrier rename --- test/test_reduction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_reduction.py b/test/test_reduction.py index fec72138d..be3029bbd 100644 --- a/test/test_reduction.py +++ b/test/test_reduction.py @@ -239,7 +239,7 @@ def test_global_parallel_reduction(ctx_factory, size): knl = lp.realize_reduction(knl) knl = lp.add_dependency( knl, "writes:acc_i_outer", - "red_i_outer_arg_b") + "id:red_i_outer_arg_barrier") lp.auto_test_vs_ref( ref_knl, ctx, knl, parameters={"n": size}, -- GitLab From d66a5ed7960288a1abe27e71ef03c3b3f684b9f6 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 27 Nov 2016 12:38:17 -0600 Subject: [PATCH 4/4] Fix test_global_mc_parallel_reduction for barrier rename --- test/test_reduction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_reduction.py b/test/test_reduction.py index be3029bbd..820c669da 100644 --- a/test/test_reduction.py +++ b/test/test_reduction.py @@ -279,7 +279,7 @@ def test_global_mc_parallel_reduction(ctx_factory, size): knl = lp.realize_reduction(knl) knl = lp.add_dependency( knl, "writes:acc_i_outer", - "red_i_outer_arg_b") + "id:red_i_outer_arg_barrier") lp.auto_test_vs_ref( ref_knl, ctx, knl, parameters={"n": size}) -- GitLab