From 8b754ba06222ddfcdaf634239ebd73460bcc0ee3 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Fri, 18 Nov 2011 12:32:12 -0500
Subject: [PATCH] Re-fix stage 2 reduction arg passing.

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

diff --git a/pyopencl/reduction.py b/pyopencl/reduction.py
index f8cc9876..082555cc 100644
--- a/pyopencl/reduction.py
+++ b/pyopencl/reduction.py
@@ -222,10 +222,13 @@ def get_reduction_kernel(stage,
          name="reduce_kernel", preamble="",
          device=None, options=[], max_group_size=None):
     if map_expr is None:
-        map_expr = "in[i]"
+        if stage == 2:
+            map_expr = "pyopencl_reduction_inp[i]"
+        else:
+            map_expr = "in[i]"
 
     if stage == 2:
-        in_arg = "__global const %s *in" % out_type
+        in_arg = "__global const %s *pyopencl_reduction_inp" % out_type
         if arguments:
             arguments = in_arg + ", " + arguments
         else:
-- 
GitLab