CUDA: In what memory space is an array of a fixed size stored?

When setting up a fixed-size array in the kernel, for example:

int my_array[100];

What memory space does the array end in?

In particular, I would like to know if such an array can be stored in a register file or shared memory on devices> = 2.0 and, if so, what requirements exist.

+5
source share
2 answers

For Fermi (and possibly earlier architectures), the following conditions must be met to store an array in a register file:

  • The array is indexed only by constants
  • Registers available
  • Hopefully the compiler will also do some analysis to determine the effect on overall performance.

(1) , SASS. .

, (2), :

  • SASS 6 , , 64. 63, -.
  • SM , , .
  • , .

(1) . , ( #pragma unroll ) , , SASS.

NVIDIA: . , .

+8

, , , , .

, :

__shared__ int my_array[100];
+3
source

All Articles