oneapi::dpl::inclusive_scan
with an initial element requires the input's value_type to be convertible to the output's value_type with the SYCL backend
#1686
Labels
Describe the Bug:
In
std::inclusive_scan
, thevalue_type
of the input iterator does not necessarily need to be convertible to thevalue_type
of the output iterator. Only if no init element is defined, then the result ofbinary_op
must also be convertible to the input iterator'svalue_type
according to https://en.cppreference.com/w/cpp/algorithm/inclusive_scanHowever, if an init element is provided the following returns must be convertible to the init type:
I have a reproducer with a binary_op that satisfies these conditions, but fails to compile with the oneDPL SYCL backend.
To Reproduce:
The following CPP code be used to reproduce this issue (compile error) with any oneDPL version:
Expected Behavior:
The above code is expected to compile. This can be observed by altering the reproducer to run the serial host version of
std::inclusive_scan
. The root of the issue is that the same SLM accessor is used internally to load the input and store the result of the binary operation which requires the two types to be convertible. The type of this accessor is theinit
type (my_int
in the example) whereas the input data is a buffer of integers. This results in the following compilation error:Additional Context:
I believe this issue exists in the reduce-then-scan prototype targeted for 2022.7.0. We should either resolve this in the upcoming scan implementation or document this issue as a known limitation.
The affected scan pattern is used in many oneDPL algorithms, so the impact of this issue is likely broader than
inclusive_scan
.The text was updated successfully, but these errors were encountered: