mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-23 21:28:17 +08:00
add and update samples for CUDA 11.5
This commit is contained in:
10
Samples/alignedTypes/doc/alignedTypes.txt
Normal file
10
Samples/alignedTypes/doc/alignedTypes.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
CUDA programming language, being a C with extensions, offers the ability to use arbitrary data structures in GPU programs. But in order for the hardware to perform efficient global loads and stores with variables of structured types, additional alignment details must be specified.
|
||||
|
||||
Take a look at this structure definition:
|
||||
typedef struct{
|
||||
float a;
|
||||
float b;
|
||||
} testStructure;
|
||||
|
||||
Without alignment specification the compiler will not automatically use a single 64-bit global memory load/store instruction, but will emit two 32-bit load instructions instead.
|
||||
This significantly impacts aggregate load/store bandwidth, since the latter breaks coalescing rules because of incontiguous memory access pattern. Refer to section 5.1.2.1 of the Programming Guide.
|
||||
Reference in New Issue
Block a user