Modify findMinAndMax kernel to handle infinities in input.
The problem is that the accumulator function does not prefer the input
over the accumulator, and the combiner function does not prefer an
"accumulated" accumulator over an "initialized-only" accumulator.
This can cause the kernel to return an illegal location (-1, the
initialized location value) if the input consists of all
POSITIVE_INFINITY or all NEGATIVE_INFINITY. The easiest way to
provoke this is with a single-cell input consisting of
POSITIVE_INFINITY (as in the new test case patternFindMinAndMaxInf).
However, our current test cases never include infinities within the
input, so regardless of the pseudorandom seed used to construct the
input, they are safe.
Nevertheless, for the sake of clarity and completeness, it seems best
for the kernel to handle these cases.
Change-Id: I714920bf5a7e9eaf1778d2fe8dc7e0d21a5fd747
5 files changed