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

[FEA]: cuda.parallel - forbid (or handle) non-contiguous arrays as inputs to algorithms #3223

Closed
1 task done
shwina opened this issue Dec 31, 2024 · 2 comments · Fixed by #3233
Closed
1 task done
Assignees
Labels
feature request New feature or request.

Comments

@shwina
Copy link
Contributor

shwina commented Dec 31, 2024

Is this a duplicate?

Area

cuda.parallel (Python)

Is your feature request related to a problem? Please describe.

See #3216 (comment).

Describe the solution you'd like

See #3216 (comment).

Describe alternatives you've considered

No response

Additional context

No response

@shwina
Copy link
Contributor Author

shwina commented Dec 31, 2024

Here are some potential solutions:

  1. We raise when the input array has a non-zero stride.
    • It can be the user's responsibility to construct an iterator to describe strided input.
    • In this case, we should consider whether to provide a special-purpose iterator StridedIterator (alternately, the user would have to construct a TransformIterator themselves)
  2. We don't raise - instead we translate the array with non-zero stride into an iterator on the user's behalf.
  3. We change the API so as to not accept arrays directly at all, instead accepting RawPointer which is necessarily a pointer to contiguous device memory.

My personal preference is for (1) or (3) with a slight preference for (1).

@shwina shwina changed the title [FEA]: cuda.parallel - forbid (or handle) non-contiguous arrays as inputs to cuda.parallel algorithms [FEA]: cuda.parallel - forbid (or handle) non-contiguous arrays as inputs to algorithms Dec 31, 2024
@leofang
Copy link
Member

leofang commented Jan 1, 2025

We should raise for now since we clearly can't handle it today. A strided iterator would be cool to have in the future, but it could have performance concerns. By the time we start working on CuPy integration, we should revisit this subject and see if/what we could do better. A naive copy to a contiguous buffer could also be considered in certain cases.

@cccl-authenticator-app cccl-authenticator-app bot moved this from Todo to In Review in CCCL Jan 2, 2025
@github-project-automation github-project-automation bot moved this from In Review to Done in CCCL Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants