I’m just starting out with CUDA and am trying to make sense of the some of the documentation. Can anyone explain the reason why struct type{float x,y,z;} has not bank conflict and struct type {float x,y;} does? This entire section is really confusing.
For reference it is page 57, section 5.1.2.4 of the manual.
thanks!!
A structure assignment is compiled into as many memory requests as there are members in the structure, so the following code, for example:
shared struct type shared[32];
struct type data = shared[BaseIndex + tid];
results in:
- Three separate memory reads without bank conflicts if type is defined as
struct type {
float x, y, z;
};
since each member is accessed with a stride of three 32-bit words;
- Two separate memory reads with bank conflicts if type is defined as
struct type {
float x, y;
};
since each member is accessed with a stride of two 32-bit words;
- Two separate memory reads with bank conflicts if type is defined as
struct type {
float f;
char c;
};
since each member is accessed with a stride of five bytes.