From 1eacf33e94c485d2fbe4b575bb76d0ec7e5a027f Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Tue, 9 Jul 2013 10:23:23 -0400
Subject: [PATCH] Expand defines in array shapes

---
 loopy/kernel/creation.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py
index 39a40728b..23533b399 100644
--- a/loopy/kernel/creation.py
+++ b/loopy/kernel/creation.py
@@ -901,11 +901,14 @@ def make_kernel(device, domains, instructions, kernel_data=["..."], **kwargs):
 
     # {{{ separate temporary variables and arguments
 
-    from loopy.kernel.data import TemporaryVariable
+    from loopy.kernel.data import TemporaryVariable, ArrayBase
 
     kernel_args = []
     temporary_variables = {}
     for dat in kernel_data:
+        if isinstance(dat, ArrayBase) and isinstance(dat.shape, tuple):
+            dat = dat.copy(shape=expand_defines_in_expr(dat.shape, defines))
+
         if isinstance(dat, TemporaryVariable):
             temporary_variables[dat.name] = dat
         else:
-- 
GitLab