Constant Memory overflow at runtime is it possible?

I know I have 64 KB constant memory
My kernel1 allocates say 40 KB of constant memory
What if another kernel launched now tries to allocate another 40 KB constant memory

At compile time the compiler checks against the total constant memory of device(i.e 64KB), but what happens if at runtime the total available constant memory is less than 64 KB

You are talking about a constant array with variable size? I guess you’ll get errors, either from the API directly when you’re doing your binding, or from your kernel result. Just try it.

There is no mechanism for dynamical allocation of constant memory, so you cannot run out of constant memory at runtime by launching a second kernel.

Also there are multiple segments of 64k each. So if you load multiple modules, they’ll get 64k each. What happens once the GPU runs out of segments, I don’t know (guess the module doesn’t load anymore). You could just try it, but you’ll probably need more than 8 or 16 modules.

Kernels from different modules use the same bank (bank 2) to store user-defined constant symbols. I think as long as the combined constant symbol size of a single module is less than 64K there would be no problem.