implementing reductions as specialized kernels