From 96ed28365c3d38fe639e1e8a9b0202178742e0ae Mon Sep 17 00:00:00 2001
From: Tim Warburton <timwar@caam.rice.edu>
Date: Sat, 3 Nov 2012 21:23:20 -0500
Subject: [PATCH] Insert new ordering depency between reduction iname dup and
 tag-reduction-as-seq.

---
 loopy/creation.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/loopy/creation.py b/loopy/creation.py
index ef2aa23ae..55bc29d44 100644
--- a/loopy/creation.py
+++ b/loopy/creation.py
@@ -431,10 +431,19 @@ def make_kernel(*args, **kwargs):
 
     check_for_nonexistent_iname_deps(knl)
 
+    knl = duplicate_reduction_inames(knl)
+
+    # -------------------------------------------------------------------------
+    # Ordering dependency:
+    # -------------------------------------------------------------------------
+    # Must duplicate reduction inames before tagging reduction inames as
+    # sequential because otherwise the latter operation will run into @iname
+    # (i.e. duplication) markers and not understand them.
+    # -------------------------------------------------------------------------
+
     knl = tag_reduction_inames_as_sequential(knl)
 
     knl = create_temporaries(knl)
-    knl = duplicate_reduction_inames(knl)
     knl = duplicate_inames(knl)
 
     # -------------------------------------------------------------------------
-- 
GitLab