From 3bd7cdcc9cd612bd8382856348b538fce800aa79 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Mon, 27 Mar 2017 21:09:43 +0200
Subject: [PATCH] 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