CUDA Pro Tip: Optimize for Pointer Aliasing

Hi Jeremy,

If I use plain (restrict annotated) pointer arguments for a kernel directly, the behavior is what I expect and what you described. Still, if I use restrict annotated pointers inside a struct, it’s compiling, but the compiler doesn’t seem to take advantage of this.
See __restrict__ seems to be ignored for base pointers in structs. having base pointers with restrict as kernel arguments directly works as expected for tiny examples.

So to put it in short: Is there a trick to specify such annotation using struct of arrays in a way that nvcc takes advantage of this?

Thanks you and kind regards,
Klaus

PS: It’s not only nvcc, clang behaves very similar. So I might be a front end problem in clang which nvcc inherits, I am just speculating here.