IA-32 Intel® Architecture Optimization
but is somewhat inefficient as there is the overhead of extra instructions
during computation. Performing the swizzle statically, when the data
structures are being laid out, is best as there is no runtime overhead.
As mentioned earlier, the SoA arrangement allows more efficient use of
the parallelism of the SIMD technologies because the data is ready for
computation in a more optimal vertical manner: multiplying
components
slots to produce 4 unique results. In contrast, computing directly on AoS
data can lead to horizontal operations that consume SIMD execution
slots but produce only a single scalar result as shown by the many
"don't-care" (DC) slots in Example 3-16.
Use of the SoA format for data structures can also lead to more efficient
use of caches and bandwidth. When the elements of the structure are not
accessed with equal frequency, such as when element
accessed ten times more often than the other entries, then SoA not only
saves memory, but it also prevents fetching unnecessary data items
and
.
c
Example 3-17 Hybrid
NumOfGroups = NumOfVertices/SIMDwidth
typedef struct{
float x[SIMDwidth];
float y[SIMDwidth];
float z[SIMDwidth];
} VerticesCoordList;
typedef struct{
int a[SIMDwidth];
int b[SIMDwidth];
int c[SIMDwidth];
. . .
} VerticesColorList;
VerticesCoordList VerticesCoord[NumOfGroups];
VerticesColorList VerticesColor[NumOfGroups];
3-30
by
x0,x1,x2,x3
SoA Data Structure
using 4 SIMD execution
xF,xF,xF,xF
,
,
are
x
y
z
,
,
a
b
Need help?
Do you have a question about the ARCHITECTURE IA-32 and is the answer not in the manual?