I'm familiar with the usage of the __restrict keyword for performance optimization in C and specifically CUDA in this case.
void Foo(const float* __restrict X, const float* __restrict Y);
I understand that this Foo
function has __restrict
keywords which indicate to the compiler that X and Y are guaranteed to point to distinct blocks of memory.
What happens when we have a pointer to a pointer as far as alias restriction?
void Bar1(const float* const * __restrict X, const float* const * __restrict Y);
void Bar2(const float* const __restrict * __restrict X, const float* const __restrict * __restrict Y);
Is Bar1
fully restricted or does each level of indirection need to be restricted as shown in Bar2
?
Which syntax correctly indicates that all pointers can take advantage or read-only caching? Do I need to "restrict" both pointers or only the top level variable name?