From f516e3eb260bd4ead7bb92363963b627a0e35e68 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 15 Feb 2017 11:18:03 -0600 Subject: [PATCH] Check dependency IDs for resolvability on creation --- loopy/kernel/creation.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index 885ecb576..6eedfcc20 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -1624,15 +1624,30 @@ def _resolve_dependencies(knl, insn, deps): new_deps = [] for dep in deps: + found_any = False + if isinstance(dep, MatchExpressionBase): for new_dep in find_instructions(knl, dep): if new_dep.id != insn.id: new_deps.append(new_dep.id) + found_any = True else: from fnmatch import fnmatchcase for other_insn in knl.instructions: if fnmatchcase(other_insn.id, dep): new_deps.append(other_insn.id) + found_any = True + + if not found_any: + raise LoopyError("instruction '%s' declared a depency on '%s', " + "which did not resolve to any instruction present in the " + "kernel '%s'" + % (insn.id, dep, knl.name)) + + for dep_id in new_deps: + if dep_id not in knl.id_to_insn: + raise LoopyError("instruction '%s' depends on instruction id '%s', " + "which was not found" % (insn.id, dep_id)) return frozenset(new_deps) -- GitLab