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]: Provide generic and safe C++ interfaces for warp shuffle #2976

Open
1 task done
fbusato opened this issue Nov 27, 2024 · 0 comments
Open
1 task done

[FEA]: Provide generic and safe C++ interfaces for warp shuffle #2976

fbusato opened this issue Nov 27, 2024 · 0 comments
Labels
feature request New feature or request.

Comments

@fbusato
Copy link
Contributor

fbusato commented Nov 27, 2024

Is this a duplicate?

Area

libcu++

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

CUDA provides warp shuffle intrinsics that support a limited set of types. Secondly, they there are not check to validate the inputs
see https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#warp-shuffle-functions

Describe the solution you'd like

Provide:

  • cuda::shfl(T var, int srcLane, unsigned mask = 0xFFFFFFFF, int width=warpSize)
  • cuda::shfl_up(T var, int delta, unsigned mask = 0xFFFFFFFF, int width=warpSize)
  • cuda::shfl_down(T var, int delta, unsigned mask = 0xFFFFFFFF, int width=warpSize)
  • cuda::shfl_xor(T var, int delta, unsigned mask = 0xFFFFFFFF, int width=warpSize)

that work with any trivially copyable types and validate the inputs, e.g. width must be a power of two, in debug mode

Describe alternatives you've considered

I suggest putting mask at the end because most of the time warp shuffles are used with all warp threads

Additional context

No response

@fbusato fbusato added the feature request New feature or request. label Nov 27, 2024
@github-project-automation github-project-automation bot moved this to Todo in CCCL Nov 27, 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
Status: Todo
Development

No branches or pull requests

1 participant