Customization point for iterators to be passed directly #1939
Replies: 4 comments 11 replies
-
|
For |
Beta Was this translation helpful? Give feedback.
-
|
@akukanov @masterleinad |
Beta Was this translation helpful? Give feedback.
-
|
The specification patch: uxlfoundation/oneAPI-spec#620 |
Beta Was this translation helpful? Give feedback.
-
|
Implemented in https://github.com/uxlfoundation/oneDPL/releases/tag/oneDPL-2022.9.0-release |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
#855 provides an example were users want to provide their own iterators that reference data on the device. Currently, this causes segfaults since
oneDPLis creating a CPU-side copy of the respective elements before launching the algorithm.This problem also appeared in
Kokkos, see kokkos/kokkos#7502.Kokkosdefines aRandomAccessIteratorclass that references aKokkos::Viewthat manges the respective data and has similar functionality tomdspan(the latter was inspired by the former). This means that the access pattern can be anything although in most cases consecutive elements are a constant stride apart. This means that simply passing raw pointers tooneDPLdoesn't represent the iterator space correctly andoneDPLalgorithms can't be used (without copying data to a continuous buffer on the host or device).Whether to create CPU-side buffers is controlled by
oneapi::dpl::__internal::is_passed_directlywhich basically looks for anis_passed_directlyalias in the iterator class.This works but pollutes user-defined classes (and the alias name doesn't indicate that the alias is used in
oneDPL).#861 provides a solution that provides a wrapper class called
direct_iteratorso that forwards all iterator calls the wrapped class. A different solution is opposed in #861 (comment) by introducing a customization point in the publiconedplnamespace such asonedpl::is_passed_directlysimilar tosycl::is_device_copyable.Beta Was this translation helpful? Give feedback.
All reactions