array spilling into local memory

Hi

I have an array in my kernel that gets spilled into local memory although I am using not that much registers in the kernel. My problem is that I often write/read to/from that array and as a consequence this really messes up the execution time.

Does anyone know if there is a possibility to avoid that the array gets placed into the local memory?

If there is no way to prohibit the spillage I would really be grateful if maybe someone knows a nice workaround for that problem.

Best Regards,
Juergen

The array will spill if the compiler determines that indexing might be dynamic or if it thinks it’s too big to fit in registers.

AFAIK you can only count on arrays getting compiled into registers if you index them with literals (ie. array[1], never array[n], even if n is const it might not work, I hear) and if they are small (a couple of elements).

You could try to fit this array into shared memory if you have some to spare.

Thanks for the quick answer.

I noticed that to, but in my case it isn’t possible to determine at compile time which elements of the array will be accessed by a certain instruction. So, I am afraid constants as access specifiers aren’t gonna work

I have already placed one array into the shared memory, so there is no more space available.