Re: Memory ordering

Liste des GroupesRevenir à c arch 
Sujet : Re: Memory ordering
De : jseigh_es00 (at) *nospam* xemaps.com (jseigh)
Groupes : comp.arch
Date : 05. Dec 2024, 14:00:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vis85o$1k2um$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Mozilla Thunderbird
On 12/5/24 02:44, Chris M. Thomasson wrote:
On 12/4/2024 8:13 AM, jseigh wrote:
On 12/3/24 18:37, Stefan Monnier wrote:
                                           If there are places
in the code it doesn't know this can't happen it won't optimize
across it, more or less.
>
The problem is HOW to TELL the COMPILER that these memory references
are "more special" than normal--when languages give few mechanisms.
>
We could start with something like
>
     critical_region {
       ...
     }
>
such that the compiler must refrain from any code motion within
those sections but is free to move things outside of those sections as if
execution was singlethreaded.
>
>
C/C++11 already defines what lock acquire/release semantics are.
Roughly you can move stuff outside of a critical section into it
but not vice versa.
>
Java uses synchronized blocks to denote the critical section.
C++ (the society for using RAII for everything) has scoped_lock
if you want to use RAII for your critical section.  It's not
always obvious what the actual critical section is.  I usually
use it inside its own bracket section to make it more obvious.
   { std::scoped_lock m(mutex);
     // .. critical section
   }
>
I'm not a big fan of c/c++ using acquire and release memory order
directives on everything since apart from a few situations it's
not intuitively obvious what they do in all cases.  You can
look a compiler assembler output but you have to be real careful
generalizing from what you see.
 The release on the unlock can allow some following stores and things to sort of "bubble up before it?
 Acquire and release confines things to the "critical section", the release can allow for some following things to go above it, so to speak. This is making me think of Alex over on c.p.t. !
 :^)
 Did I miss anything? Sorry Joe.
 
Maybe.  For thread local non-shared data if the compiler can make that
determination but I don't know if the actual specs say that.
Joe Seigh

Date Sujet#  Auteur
28 Oct 24 * Arm ldaxr / stxr loop question135jseigh
31 Oct 24 +- Re: Arm ldaxr / stxr loop question1MitchAlsup1
31 Oct 24 +- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
1 Nov 24 +* Re: Arm ldaxr / stxr loop question123aph
2 Nov 24 i`* Re: Arm ldaxr / stxr loop question122Chris M. Thomasson
8 Nov 24 i `* Re: Arm ldaxr / stxr loop question121Chris M. Thomasson
9 Nov 24 i  `* Re: Arm ldaxr / stxr loop question120Chris M. Thomasson
9 Nov 24 i   +* Re: Arm ldaxr / stxr loop question117Chris M. Thomasson
9 Nov 24 i   i+- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
11 Nov 24 i   i+* Re: Arm ldaxr / stxr loop question5MitchAlsup1
11 Nov 24 i   ii+- Re: Arm ldaxr / stxr loop question1Michael S
11 Nov 24 i   ii`* Re: Arm ldaxr / stxr loop question3jseigh
11 Nov 24 i   ii `* Re: Arm ldaxr / stxr loop question2Chris M. Thomasson
13 Nov 24 i   ii  `- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
11 Nov 24 i   i+- Re: Arm ldaxr / stxr loop question1Michael S
12 Nov 24 i   i+- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
12 Nov 24 i   i+* Re: Arm ldaxr / stxr loop question22aph
13 Nov 24 i   ii+* Re: Arm ldaxr / stxr loop question18Chris M. Thomasson
13 Nov 24 i   iii`* Re: Arm ldaxr / stxr loop question17aph
13 Nov 24 i   iii +* Re: Arm ldaxr / stxr loop question3jseigh
13 Nov 24 i   iii i`* Re: Arm ldaxr / stxr loop question2aph
13 Nov 24 i   iii i `- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
13 Nov 24 i   iii +- Re: Arm ldaxr / stxr loop question1MitchAlsup1
13 Nov 24 i   iii +* Re: Arm ldaxr / stxr loop question2Chris M. Thomasson
13 Nov 24 i   iii i`- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
13 Nov 24 i   iii +* Re: Arm ldaxr / stxr loop question2Chris M. Thomasson
13 Nov 24 i   iii i`- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
13 Nov 24 i   iii `* Re: Arm ldaxr / stxr loop question8Terje Mathisen
13 Nov 24 i   iii  +* Brilliance (was: Arm ldaxr / stxr loop question)4Anton Ertl
13 Nov 24 i   iii  i+- Re: Brilliance1BGB
14 Nov 24 i   iii  i`* Re: Brilliance2Terje Mathisen
17 Nov 24 i   iii  i `- Re: Brilliance1Thomas Koenig
13 Nov 24 i   iii  `* Re: Arm ldaxr / stxr loop question3aph
14 Nov 24 i   iii   `* Re: Arm ldaxr / stxr loop question2Terje Mathisen
15 Nov 24 i   iii    `- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
13 Nov 24 i   ii`* Re: Arm ldaxr / stxr loop question3BGB
13 Nov 24 i   ii `* Re: Arm ldaxr / stxr loop question2Chris M. Thomasson
13 Nov 24 i   ii  `- Re: Arm ldaxr / stxr loop question1Robert Finch
14 Nov 24 i   i`* Re: Arm ldaxr / stxr loop question86Kent Dickey
14 Nov 24 i   i `* Re: Arm ldaxr / stxr loop question85aph
15 Nov 24 i   i  +* Re: Arm ldaxr / stxr loop question81Chris M. Thomasson
15 Nov 24 i   i  i`* Re: Arm ldaxr / stxr loop question80aph
15 Nov 24 i   i  i +- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson
15 Nov 24 i   i  i `* Memory ordering (was: Arm ldaxr / stxr loop question)78Anton Ertl
15 Nov 24 i   i  i  +* Re: Memory ordering44Chris M. Thomasson
15 Nov 24 i   i  i  i`* Re: Memory ordering43Michael S
15 Nov 24 i   i  i  i `* Re: Memory ordering42Chris M. Thomasson
16 Nov 24 i   i  i  i  `* Re: Memory ordering41Chris M. Thomasson
16 Nov 24 i   i  i  i   +- Re: Memory ordering1Chris M. Thomasson
17 Nov 24 i   i  i  i   `* Re: Memory ordering39jseigh
17 Nov 24 i   i  i  i    +* Re: Memory ordering33Anton Ertl
19 Nov 24 i   i  i  i    i`* Re: Memory ordering32Chris M. Thomasson
3 Dec 24 i   i  i  i    i `* Re: Memory ordering31Anton Ertl
3 Dec 24 i   i  i  i    i  `* Re: Memory ordering30jseigh
3 Dec 24 i   i  i  i    i   `* Re: Memory ordering29MitchAlsup1
4 Dec 24 i   i  i  i    i    +* Re: Memory ordering22Stefan Monnier
4 Dec 24 i   i  i  i    i    i+* Re: Memory ordering3MitchAlsup1
4 Dec 24 i   i  i  i    i    ii`* Re: Memory ordering2Stefan Monnier
4 Dec 24 i   i  i  i    i    ii `- Re: Memory ordering1MitchAlsup1
4 Dec 24 i   i  i  i    i    i`* Re: Memory ordering18jseigh
5 Dec 24 i   i  i  i    i    i `* Re: Memory ordering17Chris M. Thomasson
5 Dec 24 i   i  i  i    i    i  +* Re: Memory ordering8jseigh
16 Dec22:48 i   i  i  i    i    i  i`* Re: Memory ordering7Chris M. Thomasson
17 Dec13:33 i   i  i  i    i    i  i `* Re: Memory ordering6jseigh
17 Dec21:38 i   i  i  i    i    i  i  +- Re: Memory ordering1aph
17 Dec21:41 i   i  i  i    i    i  i  `* Re: Memory ordering4Chris M. Thomasson
17 Dec22:45 i   i  i  i    i    i  i   +- Re: Memory ordering1MitchAlsup1
18 Dec12:43 i   i  i  i    i    i  i   `* Re: Memory ordering2jseigh
19 Dec03:48 i   i  i  i    i    i  i    `- Re: Memory ordering1Chris M. Thomasson
19 Dec19:33 i   i  i  i    i    i  `* Re: Memory ordering8MitchAlsup1
19 Dec22:19 i   i  i  i    i    i   `* Re: Memory ordering7Chris M. Thomasson
20 Dec00:59 i   i  i  i    i    i    +* Re: Memory ordering5MitchAlsup1
20 Dec01:21 i   i  i  i    i    i    i+* Re: Memory ordering2Chris M. Thomasson
20 Dec01:25 i   i  i  i    i    i    ii`- Re: Memory ordering1Chris M. Thomasson
20 Dec01:48 i   i  i  i    i    i    i`* Re: Memory ordering2Chris M. Thomasson
20 Dec01:58 i   i  i  i    i    i    i `- Re: Memory ordering1Chris M. Thomasson
20 Dec21:17 i   i  i  i    i    i    `- Re: Memory ordering1Chris M. Thomasson
4 Dec 24 i   i  i  i    i    +- Re: Memory ordering1Chris M. Thomasson
4 Dec 24 i   i  i  i    i    +- Re: Memory ordering1MitchAlsup1
5 Dec 24 i   i  i  i    i    `* Re: Memory ordering4Tim Rentsch
6 Dec 24 i   i  i  i    i     +* Re: Memory ordering2Terje Mathisen
6 Dec 24 i   i  i  i    i     i`- Re: Memory ordering1Tim Rentsch
20 Dec06:08 i   i  i  i    i     `- Re: Memory ordering1Chris M. Thomasson
17 Nov 24 i   i  i  i    +* Re: Memory ordering2Chris M. Thomasson
19 Nov 24 i   i  i  i    i`- Re: Memory ordering1Chris M. Thomasson
18 Nov 24 i   i  i  i    +- Re: Memory ordering1aph
21 Nov 24 i   i  i  i    +- Re: Memory ordering1Chris M. Thomasson
21 Nov 24 i   i  i  i    `- Re: Memory ordering1Chris M. Thomasson
15 Nov 24 i   i  i  +* Re: Memory ordering (was: Arm ldaxr / stxr loop question)2Michael S
15 Nov 24 i   i  i  i`- Re: Memory ordering (was: Arm ldaxr / stxr loop question)1Anton Ertl
15 Nov 24 i   i  i  +* Re: Memory ordering28jseigh
15 Nov 24 i   i  i  i`* Re: Memory ordering27Anton Ertl
15 Nov 24 i   i  i  i +* Re: Memory ordering18Chris M. Thomasson
16 Nov 24 i   i  i  i i`* Re: Memory ordering17Anton Ertl
17 Nov 24 i   i  i  i i `* Re: Memory ordering16Chris M. Thomasson
17 Nov 24 i   i  i  i i  `* Re: Memory ordering15Anton Ertl
18 Nov 24 i   i  i  i i   `* Re: Memory ordering14Chris M. Thomasson
18 Nov 24 i   i  i  i i    `* Re: Memory ordering13Anton Ertl
19 Nov 24 i   i  i  i i     `* Re: Memory ordering12Chris M. Thomasson
19 Nov 24 i   i  i  i i      `* Re: Memory ordering11Chris M. Thomasson
26 Nov 24 i   i  i  i i       +* Re: Memory ordering4Chris M. Thomasson
3 Dec 24 i   i  i  i i       `* Re: Memory ordering6Anton Ertl
15 Nov 24 i   i  i  i +* Re: Memory ordering7BGB
17 Nov 24 i   i  i  i `- Re: Memory ordering1Tim Rentsch
16 Nov 24 i   i  i  +- Re: Memory ordering (was: Arm ldaxr / stxr loop question)1Anton Ertl
16 Nov 24 i   i  i  +- Re: Memory ordering (was: Arm ldaxr / stxr loop question)1Lawrence D'Oliveiro
18 Nov 24 i   i  i  `- Re: Memory ordering1aph
21 Nov 24 i   i  `* Re: Arm ldaxr / stxr loop question3Kent Dickey
9 Nov 24 i   `* Re: Arm ldaxr / stxr loop question2jseigh
8 Nov 24 +* Re: Arm ldaxr / stxr loop question8Lawrence D'Oliveiro
20 Dec10:11 `- Re: Arm ldaxr / stxr loop question1Chris M. Thomasson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal