Pointing to either shared or global memory

Hello Forum,

I am experimenting with trading off the use of shared memory with fewer threads and global memory with a lot of threads. I wish to allow the kernel to use one or the other determined by an argument in the kernel arguments. The compiler warns that the point doesn’t know at compile time what to point to, and decides to make it global. I was afraid of that.

I could solve this by using a preprocessor #define but that would defeat the purpose of dynamically deciding to use shared or global memory for a particular purpose in my kernel. Is it possible to instruct the kernel to use global or shared memory at launch?

Thanks.

Hello Forum,

I am experimenting with trading off the use of shared memory with fewer threads and global memory with a lot of threads. I wish to allow the kernel to use one or the other determined by an argument in the kernel arguments. The compiler warns that the point doesn’t know at compile time what to point to, and decides to make it global. I was afraid of that.

I could solve this by using a preprocessor #define but that would defeat the purpose of dynamically deciding to use shared or global memory for a particular purpose in my kernel. Is it possible to instruct the kernel to use global or shared memory at launch?

Thanks.

Fermi handles this automatically. As far as I know there’s not really a way to do this in pre-GF100 cards except by maybe including both code paths and deciding which to take via an argument to the kernel.

Fermi handles this automatically. As far as I know there’s not really a way to do this in pre-GF100 cards except by maybe including both code paths and deciding which to take via an argument to the kernel.

Thanks for the reply.

I was doing that originally but the compiler wants to resolve the pointer and issues the warnings.
One other way may be to define different kernels and launch the one of choice but depending on the complexity of the kernel would require a great deal of duplication.

For now I am using a compiler flag.

Thanks again.

Thanks for the reply.

I was doing that originally but the compiler wants to resolve the pointer and issues the warnings.
One other way may be to define different kernels and launch the one of choice but depending on the complexity of the kernel would require a great deal of duplication.

For now I am using a compiler flag.

Thanks again.