Skip to content
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
09bd199
[oneDPL][rfc][zip_view] + draft
MikeDvorskiy Nov 4, 2024
b56c860
Update README.md
MikeDvorskiy Nov 27, 2024
761ecb7
Update README.md
MikeDvorskiy Nov 29, 2024
7ef15f4
Update README.md
MikeDvorskiy Nov 29, 2024
e792b5b
Update README.md
MikeDvorskiy Nov 29, 2024
786d5c5
Update README.md
MikeDvorskiy Nov 29, 2024
171e5fe
Update README.md
MikeDvorskiy Nov 29, 2024
f9a2e45
[oneDPL][rfc][ranges][zip_view] + Implementation design proposal
MikeDvorskiy Dec 2, 2024
4a701fc
+ spelling fix
MikeDvorskiy Dec 3, 2024
cc3eac4
+ spelling fix
MikeDvorskiy Dec 3, 2024
52acfac
+Implementation proposal
MikeDvorskiy Dec 4, 2024
526a603
Delete rfcs/experimental/zip_view/README.md
MikeDvorskiy Dec 4, 2024
518aee0
Update README.md
MikeDvorskiy Dec 4, 2024
234dbdb
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
c20ef9f
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
aec760b
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
9ab570b
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
300e13c
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
f51297e
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
4cade93
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
7b882fb
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
2e9c98d
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 17, 2024
214dcde
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Dec 18, 2024
1f7b132
Update README.md
MikeDvorskiy Dec 20, 2024
720f1d2
Update README.md
MikeDvorskiy Jan 15, 2025
416010b
Update README.md
MikeDvorskiy Jan 15, 2025
28aed7e
Update README.md
MikeDvorskiy Jan 15, 2025
1ce2407
Update README.md
MikeDvorskiy Jan 15, 2025
20d82e8
Update README.md
MikeDvorskiy Feb 24, 2025
87a32a8
Update README.md
MikeDvorskiy Feb 24, 2025
c629dff
Update README.md
MikeDvorskiy Feb 24, 2025
68d67f6
Update README.md
MikeDvorskiy Mar 27, 2025
14118c6
Update README.md
MikeDvorskiy Mar 27, 2025
e8fcc7c
Update README.md
MikeDvorskiy Mar 27, 2025
13a814f
Update README.md
MikeDvorskiy Mar 28, 2025
8e140b0
Update rfcs/proposed/zip_view/README.md
MikeDvorskiy Apr 10, 2025
cc89449
Update README.md
MikeDvorskiy Apr 10, 2025
cdf9db7
[ranges][zip_view][rfc] updated wording about oneapi::dpl::__internal…
MikeDvorskiy Jan 21, 2026
a86e51e
[ranges][zip_view][rfc] updated wording for `oneapi::dpl::ranges::zip…
MikeDvorskiy Jan 21, 2026
55f41cb
[ranges][zip_view][rfc] updated wording
MikeDvorskiy Jan 21, 2026
210fae7
Update README.md
MikeDvorskiy Feb 9, 2026
5fef7a9
wording
MikeDvorskiy Feb 9, 2026
b28c2fe
gramma errors fixes
MikeDvorskiy Feb 10, 2026
ffaa838
[rfc][onedpl][zip_view] oneapi::dpl::ranges => oneapi::dpl::experimen…
MikeDvorskiy Feb 20, 2026
d7fbd96
Reduce duplication, improve grammar and formatting
akukanov Feb 23, 2026
c23437d
Add a short subsection for the experimental stage
akukanov Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions rfcs/proposed/zip_view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# zip_view Support for the oneDPL Range APIs with C++20

We propose to add `ranges::zip_view` to oneDPL, with at least the same API and functionality as `std::ranges::zip_view`.

## Motivation
`std::ranges::zip_view` is a convenient way to combine multiple ranges into a single view, where each element of
the resulting range is a tuple referring to corresponding elements from each of the input ranges. This can be particularly
useful for iterating over multiple collections in parallel. `std::ranges::zip_view` is added in C++23,
but many developers are still using the C++20 standard, and it is also the required standard for oneDPL parallel range algorithms.

In case of C++23 having a `zip_view` in oneDPL also makes sense at least for the device policies, because
`std::ranges::zip_view` still is not device copyable (any wrapper over `std::tuple` is not device copyable, see https://godbolt.org/z/brfvcMeM6)
There are other technical issues with `std::tuple` (see below for the details).

## Key Requirements
`ranges::zip_view` should be:
- compilable with C++20 version (minimum);
- API-compliant with `std::ranges::zip_view`;
- in case of device usage: a device copyable view if all underlying views are device copyable views;
- The implementation may be based on tuple-like type underhood, but it must provide transitive device copyability
for view pipelines created over `ranges::zip_view`.

`ranges::zip_view::iterator` should be:
- value-swappable (https://en.cppreference.com/w/cpp/named_req/ValueSwappable)
Comment thread
akukanov marked this conversation as resolved.
- indirectly writable (https://en.cppreference.com/w/cpp/iterator/indirectly_writable.html)
- able to be used with the non-range algorithms, including C++ and oneDPL parallel algorithms:
depending on the algorithm, stricter requirements may apply. For example, `std::sortable` concept must be satisfied in order to call `std::ranges::sort`.

### Discrepancies with std::zip_view C++23
- `ranges::zip_view` may use a oneDPL tuple-like type instead of `std::tuple`
- `ranges::zip_view::iterator::value_type` should not be defined as `std::tuple` (see a known technical issue below)

### Other technical reasons not to use std::zip_view C++23 (and std::tuple) with oneDPL algorithms in the future:
- There is an issue with `std::ranges::sort(zip_view)` with clang 19.0 and older. (https://godbolt.org/z/jKvG9rY5M)
- There is an issue with `std::ranges::stable_sort(zip_view)` with gcc library
- Passing `std::zip_view::iterator` instances to the iterator-based algorithms works only for gcc 14.1 and newer, clang 19.1 and newer or
starting 17.01 with libc++ lib (https://godbolt.org/z/To6Mjr9M6)
- Consideration `std::tuple` as `ranges::zip_view::iterator::value_type`. There are issues, at least, with `sortable`, `permutable`
and `indirectly_writable` concepts: `const_cast<const std::iter_reference_t<Out>&&>(*o) = std::forward<T>(t)` is not compiled till C++23. (https://godbolt.org/z/zT9qqnjWq)

## Implementation proposal (C++20)
- `ranges::zip_view` is as a C++ class representing a range adaptor (see C++ Range Library).
- The implementation derives from the C++ `std::ranges::view_interface`.
This class encapsulates a tuple-like type to keep a combination of two or more ranges.
- To ensure device copyability, `oneapi::dpl::__internal::tuple` is proposed as a tuple-like type for underlying elements.
- To provide a value-swappable requirement `oneapi::dpl::__internal::tuple` is proposed as a dereferenced value for

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it comes to the specification, this will need to be described as an unspecified tuple which satisfies some set of requirements, unless we want to make the move to specify our internal tuple and make it public (which I doubt we want to do).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the context of this, I was looking at the specification for our current zip_iterator, and noticed a couple of discrepancies as compared to our implementation with regard to std::tuple vs our unspecified internal tuple type. I believe that our implementation is intentional and the "correct" thing here and the spec should be changed, because of issues with device copyability when composing types from zip_iterators. std::tuple is not trivially copyable but our internal tuple is.

uxlfoundation/oneAPI-spec#605

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are moving towards specifying the tuple-like type better, most likely as a type that satisfies certain concepts / requirements. That should be done in an new proposal though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. I've mentioned it in the RFC document update.

`ranges::zip_view::iterator` due to `std::tuple` not satisfying the value-swappable requirement in C++20.
- To provide an indirectly writable requirement `oneapi::dpl::__internal::tuple` is proposed as the public type for `ranges::zip_view::iterator::value_type`.
- Usage of C++ concepts is desirable to write type requirements for types, methods and members of the class.
- C++20 is minimum supported version for the class. It allows using modern C++ features such as concepts and others.
- A range adapter `zip_view` is available in the `oneapi::dpl::experimental::ranges` namespace.
- A customization point object `zip` is available in the `oneapi::dpl::experimental::ranges::views` and `oneapi::dpl::experimental::views` namespaces.

### Test coverage
- `ranges::zip_view` is tested itself, base functionality (the API that is used for a range in the oneDPL algorithm implementations)
- the base functionality test coverage may be extended by the adapted LLVM `std::ranges::zip_view` (C++23) tests.
- should be tested with range based algorithms.
- should be tested with iterator based algorithms.

### Experimental stage
Until the API is fully specified, it should go into `namespace oneapi::dpl::experimental`.
For C++20 and higher, it replaces the current implementation in that namespace, extending applicability
beyond experimental range algorithms but still supporting those.