Before using shared memory, ask whether the same data is read repeatedly—by one thread or by multiple threads. If not, shared memory adds overhead without capturing reuse. section 11.4
Use the test as a guide, not a guarantee:
- A pure element-wise map, such as out[i] = in[i] * 2, reads each element once; shared memory offers no reuse to capture. section 11.4
- Repeated reads can make staging worthwhile, but shared-memory use may still lose if it reduces occupancy. Some kernels without reuse may benefit for another reason, such as improved coalescing. section 11.4
Overlapping convolution windows
When one thread computes neighboring outputs in a 1D convolution, it may reread overlapping input values. Staging the input window in shared memory can let it fetch each value from global memory once and reuse it on-chip. section 11.4
