You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Add parallel_for interface simplification features (#1783)
This change implements "parallel_for simplification extension":
https://github.com/intel/llvm/tree/sycl/sycl/doc/extensions/ParallelForSimpification
Features list:
- Allow parallel_for call with number or braced-init-list as the first
argument, i.e.
- Allow C++14 Generic lambda expression as the kernel for parallel_for,
i.e [](auto){}
- Allow C++14 Generic lambda expression as the kernel for
parallel_for_work_group
- Allow integral type as the kernel argument for parallel_for called
with
range<1>, e.g. [](int i){}
- Allow item<1> to size_t conversion
Changes:
- Add overloads for parallel_for with range<1>, range<2> and range<3>
to allow implicit conversion either from number or from
braced-init-list.
Extract the previously existing body to _impl function.
- For generic lambda: Redesign the mechanism calculating lambda
argument type.
If the address of the Callable object can be taken, mechanism deduces
the
argument type, otherwise, uses the suggested type passed from the caller
side. Calculate the lambda argument type once and use it further on when
passing to kernel_parallel_for* function. Then the implementation of
kernel_parallel_for* uses the calculated lambda argument type to
determine the right overload of Builder::getElement by creating the
pseudo object of lambda argument type. That allows easier integration
of generic lambda support and allows to remove several overloads and
instances.
- For lambda with integral argument: if calculated lambda argument
type is integral change it to item, otherwise, leave it as is.
- Add conversion operator when item dimension is 1. accessor::operator[](size_t)
is removed though to make it possible to pass the item to the mentioned
operator. In that case we have accessor::operator[](id<>) left. Both
number and item can be used with that operator because both of them are
convertible to id. Otherwise, operator[] is ambiguous because item<1> is
convertible to id and is convertible to size_t.
Signed-off-by: Ruslan Arutyunyan <[email protected]>
0 commit comments