Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Any way to do array reduction ?

baranovsky
Beginner
1,293 Views

Single variable reduction seems to be possible with sycl::reduction interface.

According to "SYCL 2020 Specification (revision 4)", array reduction will be achieved via reduction interface with std::span, which does not exist in current oneAPI release.

template <typename T, typename Extent, typename BinaryOperation>
__unspecified__ reduction(span<T, Extent> vars, const T& identity, BinaryOperation combiner, const property_list &propList = {});

Is there any way to do array reduction at this point?

Thank you in advance for your help!

0 Kudos
1 Solution
NoorjahanSk_Intel
Moderator
1,240 Views

Hi,

Thanks for reaching out to us.

Yes, you are correct array reduction will be achieved via reduction interface with std::span, and is not supported in current oneAPI release. We will discuss with the Developer team and come back with an update soon.

 

Thanks & Regards,

Noorjahan

 

View solution in original post

0 Kudos
5 Replies
NoorjahanSk_Intel
Moderator
1,241 Views

Hi,

Thanks for reaching out to us.

Yes, you are correct array reduction will be achieved via reduction interface with std::span, and is not supported in current oneAPI release. We will discuss with the Developer team and come back with an update soon.

 

Thanks & Regards,

Noorjahan

 

0 Kudos
cw_intel
Moderator
1,213 Views

Hi,


DPC++ supports built-in reduction operations, for more information, please refer to this guide https://www.intel.com/content/www/us/en/develop/documentation/oneapi-gpu-optimization-guide/top/kernels/reduction.html


Thanks


0 Kudos
baranovsky
Beginner
1,190 Views

Thank you everyone!
I'm going to implement array reduction by using the built-in reduction operation multiple time.
I will move to the std::span interface, once it is supported!

0 Kudos
cw_intel
Moderator
1,173 Views

Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


0 Kudos
baranovsky
Beginner
1,108 Views

I found that ruduction of sycl::float2/3/4/8/16 and sycl::double2/3/4/8/16 does the trick for me.

 

I hope arbitrary-size array reduction will be supported soon!

 

0 Kudos
Reply