On Thu, May 26, 2011 at 09:58, Alexey Kravets <kayr...@ispras.ru> wrote:
> On 05/24/2011 10:09 PM, Sebastian Pop wrote:
>>
>> One change that I introduced sometime in February is that some reductions
>> are not translated to a zero dim array to make the dependence test work
>> on some of the interchange testcases.  With this change, are we going to
>> also create privatized copies for the reduction variables that are not
>> translated into zero dim arrays?
>>
>
> Hi Sebastian,
> Could you please provide some more details about these reductions?
> An example of loop nest or testcase with such reductions would be very
> helpful.

I think that most of the interchange-*.c files contain such reductions that
were not previously handled by the data dependence analysis, and thus
not interchanged.  I can see interchange-1.c and interchange-7.c have
reductions.

> In current graphite-opencl implementation only zero dim arrays can be
> privatized (but local scalar variables are always private).
>
> Currently we are not able to handle reduction between OpenCL kernels,
> so loops like this can not be transformed into kernel:
>
> for (i = 0; i < N; i++)
> sum += A[i];
>
> We are only able to handle reduction inside kernel's body by privatizing
> local reduction variable:
>
> for (j = 0; j < M; j++)
> {
>        int sum = 0;
>        for (i = 0; i < N; i++)
>                sum+= B[i];
>
> }
>
> In this case we privatize sum[0] (zero dim array created from scalar
> variable) inside kernel's body (outer loop will be replaced by kernel
> launch).

I see.  Would it be possible to strip mine the reduction loop that you say
not handled yet, and then translate to opencl the partial sums?

Thanks,
Sebastian

Reply via email to