diff --git a/pyopencl/reduction.py b/pyopencl/reduction.py index f8cc9876f7ce3abbc0f0fc2a56424fbac6749236..082555cc75431afa2e958d2ac1347f66224a97b0 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: