From 133e8fa09daee542a77e024202186667d8e1a7c6 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 18 Oct 2021 14:54:11 -0500
Subject: [PATCH] Teach PyOpenCLArrayContext how to deal with loopy programs
 without loops

---
 arraycontext/impl/pyopencl/__init__.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arraycontext/impl/pyopencl/__init__.py b/arraycontext/impl/pyopencl/__init__.py
index 18836ef..a737428 100644
--- a/arraycontext/impl/pyopencl/__init__.py
+++ b/arraycontext/impl/pyopencl/__init__.py
@@ -244,11 +244,17 @@ class PyOpenCLArrayContext(ArrayContext):
 
             if "idof" in all_inames:
                 inner_iname = "idof"
+
         elif "i0" in all_inames:
             outer_iname = "i0"
 
             if "i1" in all_inames:
                 inner_iname = "i1"
+
+        elif not all_inames:
+            # no loops, nothing to transform
+            return t_unit
+
         else:
             raise RuntimeError(
                 "Unable to reason what outer_iname and inner_iname "
-- 
GitLab