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

Group algorithms cannot take iterators #409

Open
jzc opened this issue May 3, 2023 · 1 comment · May be fixed by #723
Open

Group algorithms cannot take iterators #409

jzc opened this issue May 3, 2023 · 1 comment · May be fixed by #723
Labels
bug Something isn't working

Comments

@jzc
Copy link
Contributor

jzc commented May 3, 2023

The first paragraph of 4.17.4. Group algorithms library says that iterators can be passed to group algorithms:

The first argument to each function is a group, and data ranges can be described using pointers, iterators or instances of the multi_ptr class

However, all the joint_* functions have a restriction that the input is a pointer. Example: 4.17.4.1. any_of, all_of and none_of

template <typename Group, typename Ptr, typename Predicate>
bool joint_any_of(Group g, Ptr first, Ptr last, Predicate pred); // (1)

Constraints: Available only if sycl::is_group_v<std::decay_t> is true and Ptr is a pointer.

So are the group algorithms meant to also take in iterators? (I would presume this should be restricted to random access iterators, to be more precise.) Since these algorithms are like their std counterparts, I think they probably should. For example, for an accessor acc, it would make sense to do something like joint_any_of(group, acc.begin(), acc.end()) , but as the spec is, this is not necessarily allowed.

@tomdeakin
Copy link
Contributor

  • Restrict to contiguous iterators, not random access iterators? If so, can just turn into pointer and use current interface.
    • Should it be Random access iterators if we enable iterators in the interface
  • No join_* group algorithms currently take an iterator, so why mention iterators?
  • SYCL 2020: clarify only accepts pointers; SYCL Next: work on accepting iterators in interface.

Action: draft PR for clarification in final bullet.

@Pennycook Pennycook linked a pull request Feb 13, 2025 that will close this issue
@Pennycook Pennycook added the bug Something isn't working label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants