From b09cc192a6be781dfa81811a385d42503e9d02dd Mon Sep 17 00:00:00 2001
From: jdsteve2 <jdsteve2@illinois.edu>
Date: Wed, 14 Mar 2018 18:03:42 -0500
Subject: [PATCH] allowing 0 stride in make_args and make_ref_args by
 calculating alloc_size as if stride-1

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

diff --git a/loopy/auto_test.py b/loopy/auto_test.py
index a91eb51a0..daf99eaf5 100644
--- a/loopy/auto_test.py
+++ b/loopy/auto_test.py
@@ -128,9 +128,7 @@ def make_ref_args(kernel, impl_arg_info, queue, parameters):
             else:
                 strides = evaluate(arg.unvec_strides, parameters)
 
-                from pytools import all
-                assert all(s > 0 for s in strides)
-                alloc_size = sum(astrd*(alen-1)
+                alloc_size = sum(astrd*(alen-1) if astrd != 0 else alen-1
                         for alen, astrd in zip(shape, strides)) + 1
 
                 if dtype is None:
@@ -241,8 +239,7 @@ def make_args(kernel, impl_arg_info, queue, ref_arg_data, parameters):
             itemsize = dtype.itemsize
             numpy_strides = [itemsize*s for s in strides]
 
-            assert all(s > 0 for s in strides)
-            alloc_size = sum(astrd*(alen-1)
+            alloc_size = sum(astrd*(alen-1) if astrd != 0 else alen-1
                     for alen, astrd in zip(shape, strides)) + 1
 
             # use contiguous array to transfer to host
-- 
GitLab