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

fix: slicing on GPU #3248

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

fix: slicing on GPU #3248

wants to merge 11 commits into from

Conversation

ianna
Copy link
Collaborator

@ianna ianna commented Sep 18, 2024

No description provided.

@ianna ianna linked an issue Sep 18, 2024 that may be closed by this pull request
@ianna ianna marked this pull request as draft September 18, 2024 18:37
Copy link
Collaborator Author

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpivarski - found the issue :-)
The numpy.ndarray head that is 0 is not passed to the GPU kernel!

in

elif is_integer_like(head):
assert advanced is None
nexthead, nexttail = ak._slicing.head_tail(tail)
lenstarts = self._starts.length
nextcarry = ak.index.Index64.empty(lenstarts, self._backend.index_nplike)
assert (
nextcarry.nplike is self._backend.index_nplike
and self._starts.nplike is self._backend.index_nplike
and self._stops.nplike is self._backend.index_nplike
)
self._maybe_index_error(
self._backend[
"awkward_ListArray_getitem_next_at",
nextcarry.dtype.type,
self._starts.dtype.type,
self._stops.dtype.type,
](
nextcarry.data,
self._starts.data,
self._stops.data,
lenstarts,
head,
),
slicer=head,

head in this case can be an array and it can be regularized to a proper backend, then the GPU kernel needs to be updated to handle a 'cp.array(0)'
@ianna ianna marked this pull request as ready for review September 19, 2024 13:21
@ianna ianna marked this pull request as ready for review September 19, 2024 15:04
Copy link
Collaborator Author

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martindurant - as discussed at today's awkward-uproot meeting this is a temporary fix. I will rewrite the way we handle this CUDA kernel wrapping it in a Python function and handling the 'at' type correctly.

@martindurant
Copy link
Contributor

+1, please let me know when this is out.

@martindurant
Copy link
Contributor

Any chance of a few more test cases like [:, 1:], [:, :1], [:, 1::2], [:, ::-1] ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad CUDA kernel during slice
2 participants