To add to the point, you can also get non-aligned stuff with subarrays or results from a ccall.
-viral On Tuesday, November 25, 2014 9:24:36 AM UTC+5:30, Simon Kornblith wrote: > > In general, arrays cannot be assumed to be 16-byte aligned because it's > always possible to create one that isn't using pointer_to_array. However, > from Intel's AVX introduction > <https://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions> > : > > IntelĀ® AVX has relaxed some memory alignment requirements, so now Intel > AVX by default allows unaligned access; however, this access may come at a > performance slowdown, so the old rule of designing your data to be memory > aligned is still good practice (16-byte aligned for 128-bit access and > 32-byte aligned for 256-bit access). > > On Monday, November 24, 2014 10:01:45 PM UTC-5, Erik Schnetter wrote: >> >> On Mon, Nov 24, 2014 at 9:30 PM, Steven G. Johnson >> <[email protected]> wrote: >> > Unfortunately, Julia allocates 16-byte aligned data by default (to help >> SIMD >> > code), and there is no calloc version of posix_memalign as far as I >> know. >> >> The generated machine code I've seen does not make use of this. All >> the load/store instructions in vectorized or unrolled loops assume >> unaligned pointers. (Plus, with AVX one should align to 32 bytes >> instead.) >> >> -erik >> >> -- >> Erik Schnetter <[email protected]> >> http://www.perimeterinstitute.ca/personal/eschnetter/ >> >
