Skip to content

Commit

Permalink
More feedback driven changes
Browse files Browse the repository at this point in the history
  • Loading branch information
akukanov committed Oct 9, 2024
1 parent 37523d9 commit 6e1cb68
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions source/elements/oneDPL/source/parallel_api/buffer_wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ which type satisfies the following requirements but is otherwise unspecified:
- It is comparable with ``operator==`` and ``operator!=``.
- It provides the ``get_buffer()`` method that returns the SYCL buffer, which an object was built over.
- The expressions ``a + n`` and ``a - n``, where ``a`` is a buffer position object and ``n``
is an integer value, are valid and evaluate to a buffer position object representing
a position in the buffer that follows or precedes the position of ``a`` by ``n``.
is an integer value, are valid and evaluate to a buffer position object such that
the corresponding position in the buffer follows (precedes) that of ``a`` by ``n``.
If this new position is out of the buffer bounds, the behavior is undefined.
- The expression ``a - b``, where ``a`` and ``b`` are buffer position objects,
is valid and evaluates to an integer value ``n`` such that ``a == b + n``.

These operations are only valid for objects built over the same SYCL buffer.
If an expression operates with buffer position objects that are not built
over the same buffer, the behavior is undefined.
If these operators and expressions are applied to buffer position objects that are not built
over the same SYCL buffer, the behavior is undefined.

When invoking an algorithm, the buffer passed to ``begin`` should be the same
as the buffer passed to ``end``. Otherwise, the behavior is undefined.
Expand All @@ -73,6 +72,11 @@ in expressions with other objects built over the same buffer.
auto pos = dpl::find(dpl::execution::dpcpp_default, dpl::begin(buf), dpl::end(buf), value);
int value_index = (pos == dpl::end(buf)) ? -1 : (pos - dpl::begin(buf));
.. note::
Though buffer position objects substitute for iterators as arguments and return values
of oneDPL algorithms, they cannot be used as iterators in other contexts, including dereference,
as their type does not satisfy the C++ standard requirements for an iterator.

SYCL deduction tags (the ``TagT`` parameters) and ``sycl::property::no_init``
allow to specify an access mode to be used by algorithms for accessing a SYCL buffer.
The mode serves as a hint, and can be overridden depending on semantics of the algorithm.
Expand Down

0 comments on commit 6e1cb68

Please sign in to comment.