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

Investigate usage of _ReverseCounter in __pstl_left_bound #1522

Open
mmichel11 opened this issue Apr 23, 2024 · 1 comment
Open

Investigate usage of _ReverseCounter in __pstl_left_bound #1522

mmichel11 opened this issue Apr 23, 2024 · 1 comment

Comments

@mmichel11
Copy link
Contributor

mmichel11 commented Apr 23, 2024

          Revere counter iterator looks like a little bit strange for me,

As far as I know we already have oneapi::dpl::counting_iterator. Is it not enough?
Also when I see the API like _Index __first, _Index __last I assume that the element before __first isn't exist and the element iterated by __last isn't exist too. From this point of view what does it mean __first - 1 below?

Originally posted by @SergeyKopienko in #1446 (comment)

We have a _ReverseCounter utility which is used in __pstl_left_bound to run an upper bound operation in reverse. We should be able to achieve a similar effect with oneapi::dpl::counting_iterator. Additionally, it's usage sets the end index to __first - 1 which will likely be problematic if __first is an unsigned type and is passed as 0.

@mmichel11
Copy link
Contributor Author

The following TODO is also listed in the implementation of _ReverseCounter:

// TODO: Temporary hotfix. Investigate the necessity of _ReverseCounter
// Investigate potential user types convertible to integral
// This is the compile-time trick where we define the conversion operator to sycl::id
// conditionally. If we can call accessor::operator[] with the type that converts to the
// same integral type as _ReverseCounter (it means that we can call accessor::operator[]
// with the _ReverseCounter itself) then we don't need conversion operator to sycl::id.
// Otherwise, we define conversion operator to sycl::id.

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