cudadeprecatedgpu-shared-memory

cudaFuncSetSharedMemConfig is deprecated in 12.4 - why?


After just upgrading to CUDA 12.4 and recompiling my project, I got the following warning:

Experiments.cu:188:39: warning: ‘cudaError_t cudaFuncSetSharedMemConfig(T*, cudaSharedMemConfig) [with T = void(long unsigned int, BigNum<256>*, BigNum<256>*, BigNum<512>*); cudaError_t = cudaError]’ is deprecated [-Wdeprecated-declarations]
  188 |   gpuErrchk(cudaFuncSetSharedMemConfig(&BatchMultiply, cudaSharedMemBankSizeEightByte));
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/cuda/targets/x86_64-linux/include/cuda_runtime.h:1589:1: note: declared here
 1589 | __host__ cudaError_t cudaFuncSetSharedMemConfig(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~

The documentation doesn't seem to say why it is deprecated.

Do you know why and what shall we use instead?


Solution

  • The purpose of that function was to set the shared memory bank size. As indicated in the documentation, the available options are/were:

    The supported bank configurations are:

    cudaSharedMemBankSizeDefault: use the device's shared memory configuration when launching this function.

    cudaSharedMemBankSizeFourByte: set shared memory bank width to be four bytes natively when launching this function.

    cudaSharedMemBankSizeEightByte: set shared memory bank width to be eight bytes natively when launching this function.

    Most CUDA devices, both today, and historically, have had a fixed bank size of 4 bytes per bank. There were Kepler devices that had a configurable bank size that could be either 4 or 8 bytes.

    No devices beyond Kepler had this capability. All currently supported CUDA GPUs have a fixed, four-byte bank size.

    Given that cc3.x/Kepler is no longer supported by CUDA 12.x (last support - for cc3.5 - was in CUDA 11.x), it seems that the CUDA development managers feel its no longer necessary to support this function, as it would have no effect on any currently supported CUDA GPU. Therefore they are advertising that it may be removed in a future release, to indicate to developers that you should remove it from code being developed, moving forward. It serves no purpose.

    There is no replacement. There is no functionality like this available, currently.