Hi.
We can use dynamically allocated shared memory by using the ‘extern’ keyword and setting the size at kernel launch time.
But I’m wondering what would be the use cases for this dynamic allocation.
We can just set the size of the shared memory to be the maximum in the code, (e.g. shared a[MAXSIZE_SHARED]).
One reason I can think of is that,
if we decide to set the L1-cache / shared memory configuration at runtime (for Fermi machines)
so that the maximum size of the shared memory is not known at compile time,
this could be useful.
But is there any other purposes I’m missing for this feature?
Is there any chances that the unused shared memory would be used for other purposes
if we just declare that only portions of the shared memory is going to be used?
Thanks in advance.