Constant Memory Allocation __constant__ memory runtime allocation?

Please help understand if there is any way decide on the size of the constant memory allocation at runtime ? if so, a small example showing how to declare and initialize it would help. (I know this is possible for shared memory allocation.).

My application tells me how much constant memory is needed before the kernel is launched, however, I don’t know how to reserve and initialize variable amounts of constant memory before each invocation, causing me to over allocate and take up all the available constant memory using a large fixed size allocation.

Also, after the kernel execution is completed, I am interested in copying the results from global memory to constant memory, before the next kernel invocation. Is this possible ? (instead of copying it to host and back into device constant memory area)

I realize the topic has been discussed on the forum, however from the various examples listed it was not entirely clear to me if this was possible and has been a little confusing.

Appreciate any pointers.


I think,

for ur 1st question, no. the guide says “static”

for 2nd question, no. The guides says “can only be copied to from device memory”.