From ab0e7ee060c582d2f147371b3ba2c4a138a1e672 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Thu, 13 Feb 2014 10:23:31 -0600
Subject: [PATCH] Fix finding of sub-loop barriers in barrier insertion

---
 loopy/schedule.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/loopy/schedule.py b/loopy/schedule.py
index 419672a96..c884a2bfd 100644
--- a/loopy/schedule.py
+++ b/loopy/schedule.py
@@ -903,8 +903,9 @@ def insert_barriers(kernel, schedule, reverse, kind, level=0):
             last_barrier_index = None
 
             for j, sub_sched_item in enumerate(subresult):
-                if (isinstance(sched_item, Barrier) and
-                        barrier_kind_more_or_equally_global(sched_item.kind, kind)):
+                if (isinstance(sub_sched_item, Barrier) and
+                        barrier_kind_more_or_equally_global(
+                            sub_sched_item.kind, kind)):
 
                     seen_barrier()
                     last_barrier_index = j
-- 
GitLab