Skip to content

Refactor mdspan cuda::std::__detectably_invalid#6733

Merged
fbusato merged 29 commits intoNVIDIA:mainfrom
fbusato:host-device-mdspan-accessible
Jan 8, 2026
Merged

Refactor mdspan cuda::std::__detectably_invalid#6733
fbusato merged 29 commits intoNVIDIA:mainfrom
fbusato:host-device-mdspan-accessible

Conversation

@fbusato
Copy link
Contributor

@fbusato fbusato commented Nov 22, 2025

Description

Replace old code in host/device/managed mdspan with https://nvidia.github.io/cccl/libcudacxx/extended_api/memory/is_pointer_accessible.html

@fbusato fbusato self-assigned this Nov 22, 2025
@fbusato fbusato added the 3.2.0 label Nov 22, 2025
@fbusato fbusato requested a review from a team as a code owner November 22, 2025 02:03
@fbusato fbusato added this to CCCL Nov 22, 2025
@fbusato fbusato requested a review from wmaxey November 22, 2025 02:03
@github-project-automation github-project-automation bot moved this to Todo in CCCL Nov 22, 2025
@fbusato fbusato changed the title Applies `is_pointer_accessible to mdspan Applies is_pointer_accessible to mdspan Nov 22, 2025
@cccl-authenticator-app cccl-authenticator-app bot moved this from Todo to In Review in CCCL Nov 22, 2025
@github-actions

This comment has been minimized.

@github-project-automation github-project-automation bot moved this from In Review to In Progress in CCCL Nov 22, 2025
@fbusato fbusato moved this from In Progress to In Review in CCCL Nov 24, 2025
@fbusato fbusato requested a review from davebayer November 24, 2025 19:23
@fbusato
Copy link
Contributor Author

fbusato commented Nov 24, 2025

@davebayer @miscco I'm starting thinking that we are doing the wrong thing for host/device/managed.
There are two problems:

  1. We cannot check the pointer validity in respect to the memory space for EVERY access. This involves multiple driver calls. This is too expensive even in debug mode.
  2. We cannot check the device accessibility on the host because its access is always wrong on the host side.

Ideally, mdspan itself should check the pointer during the creating, not during run-time. Two potential solutions:

  • cuda:std::mdpan checks __detectably_invalid.
  • Modify the host/device/managed_mdspan constructs to check the memory space.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-project-automation github-project-automation bot moved this from In Review to In Progress in CCCL Dec 8, 2025
@fbusato fbusato changed the title Applies is_pointer_accessible to mdspan Refactor cuda::std::__detectably_invalid Dec 17, 2025
@fbusato fbusato changed the title Refactor cuda::std::__detectably_invalid Refactor mdspan cuda::std::__detectably_invalid Dec 18, 2025
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-project-automation github-project-automation bot moved this from In Progress to In Review in CCCL Jan 5, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

// - Direct-non-list-initializes ptr_ with cuda::std::move(p),
// - direct-non-list-initializes map_ with ext, and
// - value-initializes acc_.
#define _CCCL_DISABLE_MDSPAN_ACCESSOR_DETECT_INVALIDITY
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is very hard to reimplement all tests to work with the right accessor respect to the memory space.
I added this macro to disable the checks

@github-actions

This comment has been minimized.

@fbusato fbusato enabled auto-merge (squash) January 7, 2026 18:00
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

🥳 CI Workflow Results

🟩 Finished in 2h 10m: Pass: 100%/84 | Total: 1d 12h | Max: 1h 48m | Hits: 86%/197813

See results here.

@fbusato fbusato merged commit 281f441 into NVIDIA:main Jan 8, 2026
96 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in CCCL Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants