Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize manipulation.join.concatenate for len(tup)>3 #124

Open
LWisteria opened this issue Sep 18, 2018 · 0 comments
Open

Optimize manipulation.join.concatenate for len(tup)>3 #124

LWisteria opened this issue Sep 18, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@LWisteria
Copy link
Member

clpy/clpy/core/core.pyx

Lines 2639 to 2674 in 3fd3b23

# TODO(yoshiki.imaizumi): keep clpy implementation to optimize
# when len(tup) > 3
# if len(tup) > 3:
# all_same_type = True
# all_one_and_contiguous = True
# dtype = tup[0].dtype
# for a in tup:
# all_same_type = all_same_type and (a.dtype == dtype)
# all_one_and_contiguous = (
# all_one_and_contiguous and a._c_contiguous and
# a._shape[axis] == 1)
#
# if all_same_type:
# ptrs = numpy.ndarray(len(tup), numpy.int64)
# for i, a in enumerate(tup):
# ptrs[i] = a.data.ptr
# x = array(ptrs)
#
# raise NotImplementedError("clpy does not support this")
# if all_one_and_contiguous:
# base = <int>internal.prod_ssize_t(shape[axis + 1:])
# _concatenate_kernel_one(x, base, ret)
# else:
# ndim = tup[0].ndim
# x_strides = numpy.ndarray((len(tup), ndim), numpy.int32)
# cum_sizes = numpy.ndarray(len(tup), numpy.int32)
# cum = 0
# for i, a in enumerate(tup):
# for j in range(ndim):
# x_strides[i, j] = <int>a._strides[j]
# cum_sizes[i] = cum
# cum += <int>a._shape[axis]
#
# _concatenate_kernel(
# x, axis, array(cum_sizes), array(x_strides), ret)
# return ret

They are commented out in current ClPy. However, should be implement same as CuPy's due to performance problem.

@LWisteria LWisteria added the enhancement New feature or request label Sep 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant