Tutorial question: why use "BLOCK_SIZE" in stencil example

In the tutorial found here: https://www.nvidia.com/docs/IO/116711/sc11-cuda-c-basics.pdf
in the stencil example, I’m confused why the constant “BLOCK_SIZE” is introduced (it’s never defined). By definition, is this not the same as blockDim.x? I guess it technically does not have to be, but why would you ever use a BLOCK_SIZE that wasn’t equal to the number of threads per block here? If BLOCK_SIZE was greater than the number of threads, you create temp entries you don’t use, and if BLOCK_SIZE is less than the number of threads then lindex + RADIUS will violate array bounds.

BLOCK_SIZE (i.e. a compile-time constant) is used because statically allocated shared memory cannot be allocated according to a size specified by a run time value (which is what blockDim.x is). The size of statically allocated shared memory must be compile-time-discoverable by the compiler.

In your code, you would ensure conformity with a construct like:

dim3 blocks(BLOCK_SIZE);

this would guarantee that blockDim.x is always identical to BLOCK_SIZE

there is not any communicated intent in that tutorial that BLOCK_SIZE would ever be set to anything other than the intended block size, or that blockDim.x would ever be set to anything else.

Ah right, of course. I’ve been away from C for too long.