cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

zeland
Journeyman III

restrict

When will I get some profit of using restrict for __gloabal variable?

(__global restrict float *)

0 Likes
7 Replies
bubu
Adept II

Good question!

0 Likes
gat3way
Journeyman III

What profit do you expect to see?

0 Likes

I do not know, may be "better memory access".

OpenCL Compile Error: clBuildProgram failed (CL_BUILD_PROGRAM_FAILURE).

Line 259: error: "restrict" is
not allowed
__kernel void Calc_ALL(__global restrict uint * in1,

0 Likes

gat3way,

restrict keyword is used to tell the compiler that the pointer does not alias with any other pointer argument.This helps compiler in doing more optimized compilation.

http://en.wikipedia.org/wiki/Restrict

zeland,

try __kernel void kernel(__global uint * restrict in1,...)

 

0 Likes

Thanks. I've read Wiki.  i want to what exactly do restrict in Amd implementation of OpenCL. And when it is better to use it or  not.  When will i feel difference?

0 Likes

zeland,

You can use restrict keyword for any pointer when you are sure the buffer will be accessed by only that pointer.And no pointer aliasing can happen.

IT can make the reordering of instructions more flexible which can improve performance.

0 Likes

Originally posted by: himanshu.gautam zeland,

 

You can use restrict keyword for any pointer when you are sure the buffer will be accessed by only that pointer.And no pointer aliasing can happen. IT can make the reordering of instructions more flexible which can improve performance.

 

Thanks. So every time when  pointer variable will be accessed by the only pointer, and this is rather typically,  i should use restrict keyword for may be better performance.

0 Likes