From a7be6a8c64088832b6fcc0667ef114332841dd71 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 6 Aug 2017 14:42:18 -0500 Subject: [PATCH 1/2] check_insn_attributes(): Check no_sync_with. Closes #55 --- loopy/check.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/loopy/check.py b/loopy/check.py index e72f9e3e6..6ac058b93 100644 --- a/loopy/check.py +++ b/loopy/check.py @@ -60,6 +60,12 @@ def check_identifiers_in_subst_rules(knl): # {{{ sanity checks run pre-scheduling + +# FIXME: Replace with an enum. See +# https://gitlab.tiker.net/inducer/loopy/issues/85 +VALID_NOSYNC_SCOPES = frozenset(["local", "global", "any"]) + + def check_insn_attributes(kernel): all_insn_ids = set(insn.id for insn in kernel.instructions) @@ -76,6 +82,19 @@ def check_insn_attributes(kernel): % (insn.id, ", ".join( insn.depends_on - all_insn_ids))) + no_sync_with_insn_ids = set(id for id, scope in insn.no_sync_with) + if not no_sync_with_insn_ids <= all_insn_ids: + raise LoopyError("insn '%s' has nosync directive with unknown " + "instruction ids: %s" + % (insn.id, + ", ".join(no_sync_with_insn_ids - all_insn_ids))) + + no_sync_with_scopes = set(scope for id, scope in insn.no_sync_with) + if not no_sync_with_scopes <= VALID_NOSYNC_SCOPES: + raise LoopyError("insn '%s' has invalid nosync scopes: %s" + % (insn.id, + ", ".join(VALID_NOSYNC_SCOPES - no_sync_with_scopes))) + def check_loop_priority_inames_known(kernel): for prio in kernel.loop_priority: -- GitLab From 5463cdfc6629d62cf33e82b4767969fa13c123ed Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 6 Aug 2017 14:44:58 -0500 Subject: [PATCH 2/2] Fix ordering. --- loopy/check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopy/check.py b/loopy/check.py index 6ac058b93..9115d740e 100644 --- a/loopy/check.py +++ b/loopy/check.py @@ -93,7 +93,7 @@ def check_insn_attributes(kernel): if not no_sync_with_scopes <= VALID_NOSYNC_SCOPES: raise LoopyError("insn '%s' has invalid nosync scopes: %s" % (insn.id, - ", ".join(VALID_NOSYNC_SCOPES - no_sync_with_scopes))) + ", ".join(no_sync_with_scopes - VALID_NOSYNC_SCOPES))) def check_loop_priority_inames_known(kernel): -- GitLab