box3x3(uniform float image[32][32], int x, int y) takes varying x and y
parameters and exploits parallelism coming from these vectors. For SSE4 it
will handle 4 pixels at a time. So you need to organise outer loops to
supply these pixels in chunks of 4 (or 8, or 16, depending on your target).
This loop will do the job:
for(uniform int ii = 0; ii < numRows; ii++){ // note uniform counter
for(int jj = 0; jj < numCols; jj++){ // note varying counter
mO[ii, jj] = box3x3(mI, jj, ii); // on the first iteration it will
handle pixels (0,0), (1,0), (2,0), (3,0), i.e. jj is (0,1,2,3), ii is
uniform int 0, which is casted to varying int (0,0,0,0).
}
}
In case of both counter are varying, it will basically handle only 4
diagonal points of out of 16 in 4x4 area: (0,0), (1,1), (2,2), (3,3).
On Fri, Aug 17, 2018 at 3:15 AM Royi <[email protected]> wrote:
> Hello,
>
> I'm trying to do my first steps with ISPC.
>
> I understand the concept of ISPC that you write the programs from the
> point of view of a single element.
> It is easy to understand in the case there is an array as input and array
> as output and the ISPC program is the whole program.
>
> What I don't get is how it the Box Blur example
> <https://ispc.github.io/ispc.html#uniform-control-flow> should be used by
> the host program.
>
> let's say we have an image (Single Channel) as mI.
> Should we iterate it like:
>
> for(ii = 0; ii < numRows; ii++){
> for(jj = 0; jj < numCols; jj++){
> mO[ii, jj] = box3x3(mI, jj, ii);
> }
> }
>
> But then it doesn't make sense.
> As it seem a "Gang" will update single value.
>
> Could someone show a simple example how to utilize ISPC for Image
> Filtering?
>
> Thank You.
>
> --
> 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.
>
--
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.