In this article
AoS and SoA change the relationship between lane indexes and field addresses; the best layout follows the fields consumed together by a kernel.
Data layout determines which values become neighbors in memory. Array-of-structures and structure-of-arrays representations can describe the same logical records while giving a GPU instruction very different addresses. The useful choice follows what neighboring lanes consume together, including the work needed to construct and maintain that representation.
Trace a field through neighboring records
In an array of structures, each record keeps its fields together. Neighboring records repeat that whole structure. Reading the same field across records therefore steps over the remaining fields. A structure of arrays stores each field separately, making that field contiguous across records. Neither representation changes the meaning of a record by itself; it changes the addresses presented to the memory system when a kernel visits those records.
Primary reference: CUDA Programming Guide: Writing SIMT Kernels.
Separate hot fields from cold fields
Imagine particles with position, color and a large diagnostic payload. A kernel updating positions does not need the payload. A field-oriented layout can place the accessed values close together, while a record-oriented layout may spread them apart. This is a hypothetical access example, not a universal particle-engine recommendation. Another kernel consuming all fields may benefit differently, so the workload consists of the complete sequence of consumers.
Primary reference: CUDA C++ Best Practices Guide.
A hybrid layout can match a tile
A tiled representation can group a small set of records while separating their fields inside that group. This creates a compromise between field-wise access and record locality. The tile becomes part of the indexing contract and should be documented with strides and edge handling. A hybrid layout is useful when it matches actual cooperation, rather than because its name sounds more sophisticated than either endpoint.
Primary reference: Nsight Compute Profiling Guide.
Conversion is real work
If an upstream reader produces records, converting them into separate field arrays consumes bandwidth and storage. Repeating that conversion for every small kernel may erase a local improvement. Conversely, keeping the transformed representation across many operations can amortize preparation. Track ownership and update frequency: a layout that accelerates reads but forces frequent reconstruction can move the bottleneck into a different stage of the same application.
Compare the complete access sequence
Preserve logical records and output associations while comparing layouts. Measure preparation, kernel execution and any required reconstruction separately, then examine their combined completion. Include a consumer that reads a subset of fields and another that reads most fields. The experiment can explain where transaction grouping improves, where indexing grows and which representation is useful for this specific pipeline, without declaring a universally superior container type.
Related reading: A GPU inference benchmark you can trust; Reproducible inference stacks: preserving a GPU pilot’s result.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.