Alignment - 2021.1 English

AI Engine Kernel Coding Best Practices Guide (UG1079)

Document ID
UG1079
Release Date
2021-07-19
Version
2021.1 English

The alignas standard C specifier can be used to ensure proper alignment of local memory. In the following example, the reals is aligned to 16 byte boundary.

alignas(16) const int32 reals[8] = 
       {32767, 23170, 0, -23170, -32768, -23170, 0, 23170};
       //align to 16 bytes boundary, equivalent to "alignas(v4int32)"