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

Implement tuple interface for cuda vector types #1410

Merged
merged 8 commits into from
Apr 9, 2024

Conversation

miscco
Copy link
Collaborator

@miscco miscco commented Feb 20, 2024

This specializes the std::tuple_size and std::tuple_element traits so that they are usable with cuda vector types.

We also provide overloads for std::get, which together enables structured bindings support in C++17 onwards.

Fixes #1406

@jaredhoberock
Copy link

jaredhoberock commented Feb 20, 2024

Thanks for considering the feature request.

We also provide overloads for std::get

To avoid putting additional overloads of std::get, it might be better to make get a member or friend function of these types. There are lots of std::get functions, and introducing more may slow down overload resolution.

@miscco
Copy link
Collaborator Author

miscco commented Feb 20, 2024

To avoid putting additional overloads of std::get, it might be better to make get a member or friend function of these types. There are lots of std::get functions, and introducing more may slow down overload resolution.

The preferred method would indeed be a hidden friend. Its a bit sad, that we need to define the get specializations twice due to the vector types being defined in the global namespace

@miscco miscco added feature request New feature or request. libcu++ For all items related to libcu++ nvbug Has an associated internal NVIDIA NVBug. labels Feb 20, 2024
@miscco miscco force-pushed the vector_types_tuple branch 4 times, most recently from d7db687 to fc11825 Compare February 21, 2024 14:50
@miscco miscco requested a review from wmaxey February 26, 2024 07:15
This specializes the `std::tuple_size` and `std::tuple_element` traits so that they are usable with cuda vector types.

We also provide overloads for `std::get`, which together enables structured bindings support in C++17 onwards.

Fixes NVIDIA#1406
@miscco miscco merged commit 05b5d1d into NVIDIA:main Apr 9, 2024
585 checks passed
@miscco miscco deleted the vector_types_tuple branch April 9, 2024 06:53
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. libcu++ For all items related to libcu++ nvbug Has an associated internal NVIDIA NVBug.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[FEA]: CUDA vector types should implement the C++ tuple protocol
4 participants