Saturday, 31 August 2013

Autovectorization alignment

Autovectorization alignment

From Intel's Compiler Autovectorization Guide there's an example related
to alignment that I don't understand. The code is
double a[N], b[N];
...
for(i = 0; i < N; i++)
a[i+1] = b[i] * 3;
And it says
If the first element of both arrays is aligned at a 16-byte boundary, then
either an unaligned load of elements from b or an unaligned store of
elements into a, has to be used after vectorization. However, the
programmer can enforce the alignment shown below, which will result in two
aligned access patterns after vectorization (assuming an 8-byte size for
doubles)
_declspec(align(16, 8)) double a[N];
_declspec(align(16, 0)) double b[N];
How to see where the misalignment comes after vectorization? Wouldn't the
alignment depend on the size of the arrays?

No comments:

Post a Comment