shared memory usage per Block VS per SM


Shared memory is allocated per block, right ?
So when u have three active blocks running on a SM, do you have three times the shared memory allocated per block allocated on the 16KB shared mem of the SM ? That sounds logical but I just wish to be sure, because this would mean that depending on the Thread Block Size (and so occupancy) you would be able to allocate more or less of shared mem per block.

Thanks for the help!


Yes, that’s how it works.
In general, for given occupancy, you have a fixed amount of shared memory available per each running thread.

For 1.2 or 1.3 device and maximum occupancy that is 16 bytes per thread — 4 32-bit words (ints or floats).

Thank you!