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

Add reverse_iterator compatible with return of oneapi::dpl::[begin,end]() #1836

Open
danhoeflinger opened this issue Sep 10, 2024 · 0 comments

Comments

@danhoeflinger
Copy link
Contributor

Summary:
Add a reverse_iterator inside oneDPL which allows usage with the return of oneapi::dpl::begin() and oneapi::dpl::end().

Problem Statement:
Currently, the return from oneapi::dpl::begin() and oneapi::dpl::end() returns an iterator-like typed object. This is not compatible with std::reverse_iterator, although some implementations allow it to work (other result in compiler errors).

For types being processed on the way to SYCL kernels in the dpcpp, std::reverse_iterator is merely a marker used to generate a reverse_view_simple of the resulting processed wrapped type. However, some implementations of reverse_iterator have compile time checks of the capabilities of the types they wrap (MSVC STL for instance) which makes them incompatible with each other.

Preferred Solution:
It may be best for oneDPL to implement its own reverse_iterator which acts as a reverse iterator when used as one, but does not impose requirements that a type be a fully featured iterator if those functionalities are not used. This would allow users to use it safely with iterator types which may or may not involve the return of oneapi::dpl::begin() and oneapi::dpl::end().

It would need to be decided how it is best to make this implementation, and if there is any way to partially rely upon the implementation from the standard library. Perhaps oneDPL could make their own type which has partial specializations for the return types of oneapi::dpl::begin() and oneapi::dpl::end(), and otherwise just inherits std::reverse_iterator for other types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant