Take the maximum shared allocation size across block indices.

Is usually waaaay too conservative, but at least it's correct.
Handle thread blocks with a size that depends on the block index.

Takes a max across all possible values of blockidx. Often over-conservative.
Test for shared allocations and thread blocks that depend on blockidx
Comment fixes.