Re: Cost of handling misaligned access

Liste des GroupesRevenir à c arch 
Sujet : Re: Cost of handling misaligned access
De : tkoenig (at) *nospam* netcologne.de (Thomas Koenig)
Groupes : comp.arch
Date : 17. Feb 2025, 11:00:20
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vov1bk$13df5$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : slrn/1.0.3 (Linux)
On 2025-02-17, Terje Mathisen <terje.mathisen@tmsw.no> wrote:

No, the real problem is when a compiler want to auto-vectorize any code
working with 1/2/4/8 byte items: All of a sudden the alignment
requirement went from the item stride to the vector register stride
(16/32/64 bytes).
>
The only way this can work is to have the compiler control _all_
allocations to make sure they are properly aligned, including code in
libraries, or the compiler will be forced to use vector load/store
operations which do allow unaligned access.

Not necessarily the compiler's choice - compiler-generated code
has to deal with everything that conforms to the ABI, and if that
specifies 8-byte aligned pointers to doubles, the compiler cannot
assume otherwise unless directed.

Loop peeling might help, but becomes difficult when more than
one pointer is involved.  Consider a dot product calculation
which you want to vectorize with 256-bit SIMD instructions,
with pointers a and b.

You then have to deal with the case (uintptr_t) a % 32 == 1
and (uintptr_t) a % 32 == 3, for example.

Or you can use an extension, like __attribute__ ((aligned(32))).

Date Sujet#  Auteur
13 Feb 25 * Re: Cost of handling misaligned access48Marcus
13 Feb 25 +- Re: Cost of handling misaligned access1Thomas Koenig
14 Feb 25 +* Re: Cost of handling misaligned access41BGB
14 Feb 25 i`* Re: Cost of handling misaligned access40MitchAlsup1
18 Feb 25 i `* Re: Cost of handling misaligned access39BGB
18 Feb 25 i  +* Re: Cost of handling misaligned access33MitchAlsup1
18 Feb 25 i  i+- Re: Cost of handling misaligned access1BGB
18 Feb 25 i  i`* Re: Cost of handling misaligned access31Michael S
18 Feb 25 i  i +- Re: Cost of handling misaligned access1Thomas Koenig
18 Feb 25 i  i +* Re: Cost of handling misaligned access26MitchAlsup1
18 Feb 25 i  i i`* Re: Cost of handling misaligned access25Terje Mathisen
18 Feb 25 i  i i `* Re: Cost of handling misaligned access24MitchAlsup1
19 Feb 25 i  i i  `* Re: Cost of handling misaligned access23Terje Mathisen
19 Feb 25 i  i i   `* Re: Cost of handling misaligned access22MitchAlsup1
19 Feb 25 i  i i    `* Re: Cost of handling misaligned access21BGB
20 Feb 25 i  i i     +- Re: Cost of handling misaligned access1Robert Finch
20 Feb 25 i  i i     +* Re: Cost of handling misaligned access5MitchAlsup1
20 Feb 25 i  i i     i+* Re: Cost of handling misaligned access2BGB
20 Feb 25 i  i i     ii`- Re: Cost of handling misaligned access1BGB
21 Feb 25 i  i i     i`* Re: Cost of handling misaligned access2Robert Finch
21 Feb 25 i  i i     i `- Re: Cost of handling misaligned access1BGB
21 Feb 25 i  i i     `* Re: Cost of handling misaligned access14BGB
22 Feb 25 i  i i      +- Re: Cost of handling misaligned access1Robert Finch
22 Feb 25 i  i i      `* Re: Cost of handling misaligned access12Robert Finch
23 Feb 25 i  i i       +* Re: Cost of handling misaligned access10BGB
23 Feb 25 i  i i       i`* Re: Cost of handling misaligned access9Michael S
24 Feb 25 i  i i       i +- Re: Cost of handling misaligned access1BGB
24 Feb 25 i  i i       i `* Re: Cost of handling misaligned access7Michael S
24 Feb 25 i  i i       i  +* Re: Cost of handling misaligned access4Robert Finch
24 Feb 25 i  i i       i  i+- Re: Cost of handling misaligned access1BGB
24 Feb 25 i  i i       i  i`* Re: Cost of handling misaligned access2MitchAlsup1
25 Feb 25 i  i i       i  i `- Re: Cost of handling misaligned access1BGB
25 Feb 25 i  i i       i  `* Re: Cost of handling misaligned access2MitchAlsup1
25 Feb 25 i  i i       i   `- Re: Cost of handling misaligned access1BGB
23 Feb 25 i  i i       `- Re: Cost of handling misaligned access1Robert Finch
18 Feb 25 i  i `* Re: Cost of handling misaligned access3BGB
19 Feb 25 i  i  `* Re: Cost of handling misaligned access2MitchAlsup1
19 Feb 25 i  i   `- Re: Cost of handling misaligned access1BGB
18 Feb 25 i  `* Re: Cost of handling misaligned access5Robert Finch
18 Feb 25 i   `* Re: Cost of handling misaligned access4BGB
18 Feb 25 i    `* Re: Cost of handling misaligned access3Brett
18 Feb 25 i     `* Re: Cost of handling misaligned access2Marcus
18 Feb 25 i      `- Re: Cost of handling misaligned access1BGB
17 Feb 25 `* Re: Cost of handling misaligned access5Terje Mathisen
17 Feb 25  +- Re: Cost of handling misaligned access1Thomas Koenig
17 Feb 25  `* Re: Cost of handling misaligned access3MitchAlsup1
17 Feb 25   `* Re: Cost of handling misaligned access2Terje Mathisen
17 Feb 25    `- Re: Cost of handling misaligned access1MitchAlsup1

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal