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]: Add out of bound assertion to cuda::std::mdspan on operator() #3045

Closed
1 task done
Kh4ster opened this issue Dec 4, 2024 · 2 comments · Fixed by #3055
Closed
1 task done

[FEA]: Add out of bound assertion to cuda::std::mdspan on operator() #3045

Kh4ster opened this issue Dec 4, 2024 · 2 comments · Fixed by #3055
Assignees
Labels
feature request New feature or request.

Comments

@Kh4ster
Copy link
Contributor

Kh4ster commented Dec 4, 2024

Is this a duplicate?

Area

Thrust

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

cuda::std::mdspan doesn't trigger, in debug, an assertion when an out of bound access is performed via operator(), contrary to cuda::std::span (with its operator[]).

Describe the solution you'd like

cuda::std::mdspan should trigger an assertion, in debug, in both host and device just like cuda::std::span.

We will also have to update the following: https://github.com/NVIDIA/cccl/blob/main/docs/libcudacxx/standard_api/container_library/mdspan.rst

Describe alternatives you've considered

Using cuda::std::span but we want to promote cuda::std::mdspan as a safe multi-dimensional accessor

Additional context

Came in a discussion with @bernhardmgruber on slack. The goal is for it to be used in the "The Modern CUDA Developer’s Toolbox" future blogpost.

@Kh4ster Kh4ster added the feature request New feature or request. label Dec 4, 2024
@github-project-automation github-project-automation bot moved this to Todo in CCCL Dec 4, 2024
@bernhardmgruber
Copy link
Contributor

@fbusato since you are working on mdspan at the moment, maybe you have time to add an assertion to operator() and operator[].

@bernhardmgruber
Copy link
Contributor

@fbusato it seems @miscco was faster.

@github-project-automation github-project-automation bot moved this from In Review to Done in CCCL Dec 5, 2024
@bernhardmgruber bernhardmgruber changed the title [FEA]: Add out of bound assertion to cuda::std::span on operator() [FEA]: Add out of bound assertion to cuda::std::mdspan on operator() Dec 5, 2024
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
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants