Hello guys,
I have following scenario which I don't know how to solve with ISPC. I
basically have 1D array of floats, which needs
to be processed. Processing one element involves accessing its neighbors,
so first and last element needs to
be treated in special way, as neighbors can be outside range of input
values.
Code looks like this:
...
foreach (x = 1 ... size - 1)
{
const float s0 = srcRow[x - 1];
const float s1 = srcRow[x];
const float s2 = srcRow[x + 1];
dstRow[x] = min(min(s0, s1), s2);
}
// Here is the problematic part. I want to compute 0th and (size -1)th
element, this time with 'clamp' style addressing (I also need to support
'wrap' mode)
{
const float s0 = srcRow[0];
const float s1 = srcRow[0];
const float s2 = srcRow[1];
dstRow[0] = min(min(s0, s1), s2);
...
}
I get warning about scatter being used when writing to dstRow[0] and
dstRow[sizex - 1], which is logical & OK. But I also get warning about
undefined behavior caused
by all instances writing to same location, which I don't know how to solve.
Actually I would like to kind of force serial execution for block, which
computes values for dstRow[0], dstRow[sizex - 1].
Am I approaching it in wrong way ? How to solve this kind of computational
pattern ?
Many thanks for tips !
Regards
Petr
--
You received this message because you are subscribed to the Google Groups
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.