January 09, 2015 Re: Alignment of dynamic arrays | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On 1/9/15 8:02 AM, Steven Schveighoffer wrote:
> On 1/9/15 7:43 AM, Robert burner Schadek wrote:
>> On Friday, 9 January 2015 at 11:19:47 UTC, bearophile wrote:
>>> If you have a 16-byte aligned array of doubles and you slice the first
>>> double away, what's the alignment of the result?
>>
>> the first double[0] is 16-byte aligned, double[1] would be 20-byte
>> aligned as a double is 4 byte long.
>>
>> p.s. I'm properly wrong as my last two posts contained errors
>
> *sigh* s/20/24, s/4 byte/8 byte :)
Bleh, even that is wrong :) second element would be 8-byte aligned, not 24-byte aligned.
-Steve
| |||
January 09, 2015 Re: Alignment of dynamic arrays | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Keeping alignment when slicing is easy since it matches the size of the xmm registers: one has to partition the array by blocks of 2 doubles, 4 floats, etc. For AVX, the ideal alignment is on 32-byte boundaries but the really bad performance hit happens only when an unaligned access crosses a cacheline boundary. With SSE2, this concerns every single access. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply