Re: Cost of handling misaligned access

Liste des GroupesRevenir à c arch 
Sujet : Re: Cost of handling misaligned access
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.arch
Date : 04. Feb 2025, 01:57:46
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vnromb$1hnoi$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 2/2/2025 2:44 PM, Chris M. Thomasson wrote:
On 2/2/2025 10:51 AM, MitchAlsup1 wrote:
On Sun, 2 Feb 2025 16:45:19 +0000, EricP wrote:
>
As you can see in the article below, the cost of NOT handling misaligned
accesses in hardware is quite high in cpu clocks.
>
To my eye, the incremental cost of adding hardware support for
misaligned
to the AGU and cache data path should be quite low. The alignment
shifter
is basically the same: assuming a 64-byte cache line, LD still has to
shift any of the 64 bytes into position 0, and reverse for ST.
>
A handful of gates to detect misalignedness and recognize the line and
page crossing misalignments.
>
The alignment shifters are twice as big.
>
Now, while I accept these costs, I accept that others may not. I accept
these costs because of the performance issues when I don't.
>
The incremental cost is in a sequencer in the AGU for handling cache
line and possibly virtual page straddles, and a small byte shifter to
left shift the high order bytes. The AGU sequencer needs to know if the
line straddles a page boundary, if not then increment the 6-bit physical
line number within the 4 kB physical frame number, if yes then increment
virtual page number and TLB lookup again and access the first line.
(Slightly more if multiple page sizes are supported, but same idea.)
For a load AGU merges the low and high fragments and forwards.
>
I don't think there are line straddle consequences for coherence because
there is no ordering guarantees for misaligned accesses.
>
Generally stated as:: Misaligned accesses cannot be considered ATOMIC.
 Try it on an x86/x64. Straddle a l2 cache line and use it with a LOCK'ed RMW. It should assert the BUS lock.
Afaict, it needs to assert the bus lock here to try to make it (the misaligned address) atomic.
[...]

Date Sujet#  Auteur
2 Feb 25 * Re: Cost of handling misaligned access7MitchAlsup1
2 Feb 25 +* Re: Cost of handling misaligned access5Chris M. Thomasson
3 Feb 25 i+* Re: Cost of handling misaligned access3MitchAlsup1
3 Feb 25 ii+- Re: Cost of handling misaligned access1Michael S
4 Feb 25 ii`- Re: Cost of handling misaligned access1Chris M. Thomasson
4 Feb 25 i`- Re: Cost of handling misaligned access1Chris M. Thomasson
3 Feb 25 `- Re: Cost of handling misaligned access1MitchAlsup1

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal