Add specialized CUDA kernel for fill function
@@ -507,7 +507,7 @@ cdef class ndarray:
if value == 0 and self._c_contiguous:
self.data.memset_async(0, self.nbytes)
else:
- elementwise_copy(value, self, dtype=self.dtype)
+ fill_kernel(value, self)
# -------------------------------------------------------------------------
# Shape manipulation
@@ -1957,6 +1957,8 @@ include "reduction.pxi"
cdef str _id = 'out0 = in0'
+cdef fill_kernel = ElementwiseKernel('T x', 'T y', 'y = x', 'fill')
+
elementwise_copy = create_ufunc(
'cupy_copy',
('?->?', 'b->b', 'B->B', 'h->h', 'H->H', 'i->i', 'I->I', 'l->l', 'L->L',
