Fix ReductionKernel
@@ -253,7 +253,11 @@ def _get_reduction_kernel(
name, block_size, reduce_type, identity, map_expr, reduce_expr,
post_map_expr, preamble, options):
kernel_params = _get_kernel_params(params, args_info)
- arrays = [p for p, a in zip(params, args_info)
+ params = params[:nin + nout]
+ args_info = args_info[:nin + nout]
+ in_arrays = [p for p, a in zip(params[:nin], args_info[:nin])
+ if not p.raw and a[0] is ndarray]
+ out_arrays = [p for p, a in zip(params[nin:], args_info[nin:])
if not p.raw and a[0] is ndarray]
type_preamble = '\n'.join(
'typedef %s %s;' % (_get_typename(v), k)
@@ -261,10 +265,10 @@ def _get_reduction_kernel(
input_expr = '\n'.join(
[(('const {0} {1}' if p.is_const else '{0}& {1}') +
' = _raw_{1}[_in_ind.get()];').format(p.ctype, p.name)
- for p in arrays[:nin]])
+ for p in in_arrays])
output_expr = '\n'.join(
['{0} &{1} = _raw_{1}[_out_ind.get()];'.format(p.ctype, p.name)
- for p in arrays[nin:nin + nout] if not p.is_const])
+ for p in out_arrays if not p.is_const])
return _get_simple_reduction_kernel(
name, block_size, reduce_type, kernel_params, identity,
