Open mmichel11 opened 2 months ago
@mmichel11 is this issue resolved with the merge of #1680?
@timmiesmith This issue is not fixed with the current state of the reduce-then-scan PRs, so I think we will need to documentation note. A fix will also need to be made to the original scan-then-propagate algorithm since it is used as a fallback.
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
.