From 3bd7cdcc9cd612bd8382856348b538fce800aa79 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Mon, 27 Mar 2017 21:09:43 +0200 Subject: [PATCH 1/2] Introduce kernel option 'check_dep_resolution' defaults to True. If set, any unmatched instruction dependency will issue an error. --- loopy/kernel/creation.py | 2 +- loopy/options.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index d81b1f895..cc034ae5a 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -1642,7 +1642,7 @@ def _resolve_dependencies(knl, insn, deps): new_deps.append(other_insn.id) found_any = True - if not found_any: + if not found_any and knl.options.check_dep_resolution: raise LoopyError("instruction '%s' declared a depency on '%s', " "which did not resolve to any instruction present in the " "kernel '%s'" diff --git a/loopy/options.py b/loopy/options.py index 7c778681d..0120ed17c 100644 --- a/loopy/options.py +++ b/loopy/options.py @@ -95,6 +95,11 @@ class Options(ImmutableRecord): determining whether an iname duplication is necessary for the kernel to be schedulable. + .. attribute:: check_dep_resolution + + Whether loopy should issue an error if a dependency + expressions does not match any instructions in the kernel. + .. rubric:: Invocation-related options .. attribute:: skip_arg_checks @@ -200,6 +205,7 @@ class Options(ImmutableRecord): allow_terminal_colors_def), disable_global_barriers=kwargs.get("disable_global_barriers", False), + check_dep_resolution=kwargs.get("check_dep_resolution", True), ) # {{{ legacy compatibility -- GitLab From 4fe2bf78c3c99a8a524cebcab87d815dbdfd8388 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Mon, 27 Mar 2017 22:19:47 +0200 Subject: [PATCH 2/2] Fix documentation/error message of check_dep_resolution --- loopy/kernel/creation.py | 4 ++-- loopy/options.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index cc034ae5a..14b18150f 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -1645,8 +1645,8 @@ def _resolve_dependencies(knl, insn, deps): if not found_any and knl.options.check_dep_resolution: 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)) + "kernel '%s'. Set the kernel option 'check_dep_resolution'" + "to False to disable this check." % (insn.id, dep, knl.name)) for dep_id in new_deps: if dep_id not in knl.id_to_insn: diff --git a/loopy/options.py b/loopy/options.py index 0120ed17c..25bb7014c 100644 --- a/loopy/options.py +++ b/loopy/options.py @@ -98,7 +98,7 @@ class Options(ImmutableRecord): .. attribute:: check_dep_resolution Whether loopy should issue an error if a dependency - expressions does not match any instructions in the kernel. + expression does not match any instructions in the kernel. .. rubric:: Invocation-related options -- GitLab