From 27d9f3a4df221de62a6c8680f55006b5bfd7bf39 Mon Sep 17 00:00:00 2001
From: Matt Wala <wala1@illinois.edu>
Date: Sat, 30 May 2020 23:06:59 -0500
Subject: [PATCH] Fix order computation

---
 loopy/kernel/tools.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py
index 8b486ed61..e33d260fb 100644
--- a/loopy/kernel/tools.py
+++ b/loopy/kernel/tools.py
@@ -1598,9 +1598,10 @@ def get_global_barrier_order(kernel):
 
     See also :class:`loopy.instruction.BarrierInstruction`.
     """
-    dep_graph = {
-            insn.id: insn.depends_on
-            for insn in kernel.instructions}
+    dep_graph = {insn.id: set() for insn in kernel.instructions}
+    for insn in kernel.instructions:
+        for dep in insn.depends_on:
+            dep_graph[dep].add(insn.id)
 
     from pytools.graph import compute_topological_order
     order = compute_topological_order(dep_graph)
-- 
GitLab