AnsweredAssumed Answered

The usage of restrict modifier in __local memory space

Question asked by Raistmer on Nov 6, 2016
Latest reply on Nov 8, 2016 by Raistmer

Hello.

 

When I add restrict modifier to pointer from __local memory space no errors generated by compiler but kernel silently starts to produce invalid results.

But particular memory location accessed only via that pointer (but from different workitems, local memory used in reduction procedure).

So, what meaning "restrict" keyword has if it used for __local type* restrict  pointer?

Does such usage

kernel k(__local type* restrict pp){

const int tid=get_local_id(0);

__local type* restrict p=pp+1;

p[tid]=1;

barrier(CLK_LOCAL_MEM_FENCE);

if(tid==0){p[0]+=p[1];}

barrier(CLK_LOCAL_MEM_FENCE);

type a=p[0];

}

contradict with restrict meaning?

Outcomes