GenericScanKernel semantics misunderstanding or bug? #707
-
In I have the following need (oversimplified for this discussion): scan an array, and if the current value is different from some 'error' value '(so, considered as a 'valid' value), just transmit it, otherwise transmit the previous accumulator value plus one. In the following example,
I get the following output:
I am OK with lines i = -5 to -1, where things work as expected. I am OK with the first value (101) of the last line (the accumulator has the value 'neutral', so accumulator + 1 is transmitted). I do not understand the following ones (unless I consider that the first value is actually 4). For the other lines there is a behaviour that I can summarise as: 'when processing invalid slots, if accumulator + 1 == error_value, Is it a bug or a misunderstanding of scan kernel? It seems related to 'associativity' of the expression not being fulfilled:
returns
Do you think there is a way to obtain the correct result ? In general, is it possible to include tests in |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Tests are fine, but associativity is a hard requirement of the algorithm. Without it, I do not believe a parallel scan can be gotten to work. Maybe you can factor some of the processing into the "map expression" for each entry? |
Beta Was this translation helpful? Give feedback.
-
For sure. |
Beta Was this translation helpful? Give feedback.
For sure.