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]: libcu++ iterator_traits should pick up std iterator_traits specializations #1930

Open
1 task done
bernhardmgruber opened this issue Jul 2, 2024 · 0 comments
Open
1 task done
Labels
feature request New feature or request.

Comments

@bernhardmgruber
Copy link
Contributor

Is this a duplicate?

Area

libcu++

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

In cub/util_type.cuh we have something like:

#ifdef _CCCL_COMPILER_NVRTC
#  include <cuda/std/iterator>
#else // !defined(_CCCL_COMPILER_NVRTC)
#  include <iterator>
#endif // defined(_CCCL_COMPILER_NVRTC)
...
template <typename Iterator>
using value_t =
#  ifdef _CCCL_COMPILER_NVRTC
  typename ::cuda::std::iterator_traits<Iterator>::value_type;
#  else // !defined(_CCCL_COMPILER_NVRTC)
  typename std::iterator_traits<Iterator>::value_type;
#  endif // defined(_CCCL_COMPILER_NVRTC)

IIRC, @gevtushenko pointed out that the special treatment for NVRTC is necessary, because there may be no standard library around to supply std::iterator_traits. However, this seems like a problem that should be solved by libcu++ instead. Furthermore, we use plain std::iterator_traits in a lot of places without this special handling.

We cannot just use ::cuda::std::iterator_traits directly, because a user is free to specialize std::iterator_traits for their iterator type, which currently is not detected by ::cuda::std::iterator_traits.

Describe the solution you'd like

I want to use only ::cuda::std::iterator_traits<T> and it should pick up a specialization of std::iterator_traits<T> when it exists.

Describe alternatives you've considered

No response

Additional context

No response

@bernhardmgruber bernhardmgruber added the feature request New feature or request. label Jul 2, 2024
@bernhardmgruber bernhardmgruber changed the title [FEA]: libcu++ iterator traits should pick up std iterator_trait specializations [FEA]: libcu++ iterator_traits should pick up std iterator_traits specializations Jul 2, 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