From f5f35fc6148803c66df9631bf690eddecdd45b88 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 2 Dec 2013 14:53:30 -0600
Subject: [PATCH] Print predicates when stringify kernels and instructions

---
 loopy/kernel/__init__.py | 3 +++
 loopy/kernel/data.py     | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py
index 59cb0763a..1ced7f2d6 100644
--- a/loopy/kernel/__init__.py
+++ b/loopy/kernel/__init__.py
@@ -899,6 +899,9 @@ class LoopKernel(Record):
 
             lines.extend(trailing)
 
+            if insn.predicates:
+                lines.append(10*" " + "if (%s)" % " && ".join(insn.predicates))
+
         dep_lines = []
         for insn in self.instructions:
             if insn.insn_deps:
diff --git a/loopy/kernel/data.py b/loopy/kernel/data.py
index 9e9538b2e..d3e6ee475 100644
--- a/loopy/kernel/data.py
+++ b/loopy/kernel/data.py
@@ -587,6 +587,8 @@ class ExpressionInstruction(InstructionBase):
         if options:
             result += " (%s)" % (": ".join(options))
 
+        if self.predicates:
+            result += "\n" + 10*" " + "if (%s)" % " && ".join(self.predicates)
         return result
 
 
-- 
GitLab