Skip to content
Snippets Groups Projects
Commit 310948cd authored by Michael Kuron's avatar Michael Kuron :mortar_board: Committed by Markus Holzer
Browse files

Align to __BIGGEST_ALIGNMENT__ (GCC, Clang, Intel) or to 512 bits

for AVX512 compatibility via pystencils

Intel always sets __BIGGEST_ALIGNMENT__ to 64, irrespective of what instruction set is enabled
parent a261f3a1
Branches
Tags
No related merge requests found
...@@ -316,14 +316,18 @@ namespace field { ...@@ -316,14 +316,18 @@ namespace field {
// Automatically select allocator if none was given // Automatically select allocator if none was given
if ( alloc == 0 ) if ( alloc == 0 )
{ {
const uint_t alignment = 32; #ifdef __BIGGEST_ALIGNMENT__
const uint_t alignment = __BIGGEST_ALIGNMENT__;
#else
const uint_t alignment = 64;
#endif
// aligned allocator only used (by default) if ... // aligned allocator only used (by default) if ...
if ( l == fzyx && // ... we use a structure of arrays layout if ( l == fzyx && // ... we use a structure of arrays layout
_xSize * sizeof(T) > alignment && // ... the inner coordinate is sufficiently large _xSize * sizeof(T) > alignment && // ... the inner coordinate is sufficiently large
sizeof(T) < alignment && // ... the stored data type is smaller than the alignment sizeof(T) < alignment && // ... the stored data type is smaller than the alignment
alignment % sizeof(T) == 0 ) // ... there is an integer number of elements fitting in one aligned line alignment % sizeof(T) == 0 ) // ... there is an integer number of elements fitting in one aligned line
alloc = make_shared<AllocateAligned<T,32> >(); alloc = make_shared<AllocateAligned<T,alignment> >();
else else
alloc = make_shared<StdFieldAlloc<T> > (); alloc = make_shared<StdFieldAlloc<T> > ();
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment