Re: portable proxy collector test...

Liste des GroupesRevenir à c arch 
Sujet : Re: portable proxy collector test...
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.arch
Date : 09. Dec 2024, 22:01:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vj7lqk$im6l$2@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 12/9/2024 4:34 AM, jseigh wrote:
On 12/9/24 07:28, jseigh wrote:
On 12/8/24 18:31, Chris M. Thomasson wrote:
 
Well, for a ARM64 gcc 14.2.0 a relaxed fetch_add I get __aarch64_ldadd8_acq_rel in the asm.
>
https://godbolt.org/z/YzPdM8j33
>
acq_rel barrier for a relaxed membar? Well, that makes me go grrrrrr!
>
It has to be akin to the LOCK prefix over on x86. I want it relaxed damn it! ;^)
>
Apart of the memory ordering, if you are using atomic_fetch_add you
are going to get an interlocked instruction which is probably
overkill and has more overhead than you want.   Atomic ops
assume other cpus might be trying atomic rmw ops on other
cpus which is not the case for userspace rcu.  You want
an atomic relaxed load, and atomic relaxed store of the
incrmented value.  It will be faster.
>
 I should add, you will need a store/load memory barrier
after that unless you use an asymetric memory barrier.
I haven't worked that logic out yet since I'm not working
on any userspace RCU (qsbr) implementations. Probably
the same number of grace periods.
Wrt this simple code here for ARM64 gcc 14.2.0 on GodBolt gives me a __aarch64_ldadd8_acq_rel:
_______________________
#include <atomic>
int
main()
{
     {
         std::atomic<unsigned long> g_state_0(123);
         g_state_0.fetch_add(1, std::memory_order_relaxed);
     }
     return 0;
}
_______________________
Okay. So, when I use -O2 -march=armv8.1-a, I get:
https://godbolt.org/z/KrGvodb51
______________________
main:
         sub     sp, sp, #16
         mov     x0, 123
         mov     x1, 1
         str     x0, [sp, 8]
         add     x0, sp, 8
         ldadd   x1, x1, [x0]
         add     sp, sp, 16
         mov     w0, 0
         ret
______________________
Ahhh! Much better.
Thanks! I don't have much experience with ARM.

Date Sujet#  Auteur
5 Dec 24 * portable proxy collector test...16Chris M. Thomasson
6 Dec 24 `* Re: portable proxy collector test...15Brett
6 Dec 24  +- Re: portable proxy collector test...1Chris M. Thomasson
6 Dec 24  +- Re: portable proxy collector test...1Chris M. Thomasson
6 Dec 24  `* Re: portable proxy collector test...12Chris M. Thomasson
6 Dec 24   `* Re: portable proxy collector test...11jseigh
8 Dec 24    +- Re: portable proxy collector test...1Chris M. Thomasson
8 Dec 24    +* Re: portable proxy collector test...2Chris M. Thomasson
8 Dec 24    i`- Re: portable proxy collector test...1Chris M. Thomasson
9 Dec 24    `* Re: portable proxy collector test...7Chris M. Thomasson
9 Dec 24     +* Re: portable proxy collector test...2aph
9 Dec 24     i`- Re: portable proxy collector test...1Chris M. Thomasson
9 Dec 24     `* Re: portable proxy collector test...4jseigh
9 Dec 24      +* Re: portable proxy collector test...2jseigh
9 Dec 24      i`- Re: portable proxy collector test...1Chris M. Thomasson
9 Dec 24      `- Re: portable proxy collector test...1Chris M. Thomasson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal