Make ElementwiseKernel emit immutable in_params
@@ -97,7 +97,9 @@ cpdef str _get_kernel_params(tuple params, tuple args_info):
t = _get_typename(dtype)
if is_array:
t = 'CArray<%s, %d>' % (t, ndim)
- ret.append('%s %s%s' % (t,
+ ret.append('{}{} {}{}'.format(
+ 'const ' if p.is_const else '',
+ t,
'_raw_' if is_array and not p.raw else '',
p.name))
return ', '.join(ret)
@@ -364,7 +366,7 @@ cdef function.Function _get_elementwise_kernel(
for p, a in zip(params, args_info):
if not p.raw and a[0] == ndarray:
if p.is_const:
- fmt = '{t} &{n} = _raw_{n}[_ind.get()];'
+ fmt = 'const {t} &{n} = _raw_{n}[_ind.get()];'
else:
fmt = '{t} &{n} = _raw_{n}[_ind.get()];'
op.append(fmt.format(t=p.ctype, n=p.name))
