Sujet : Re: Memory ordering
De : jseigh_es00 (at) *nospam* xemaps.com (jseigh)
Groupes : comp.archDate : 17. Nov 2024, 15:03:06
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vhct2q$lk1b$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Mozilla Thunderbird
On 11/16/24 16:21, Chris M. Thomasson wrote:
Fwiw, in C++ std::memory_order_consume is useful for traversing a node based stack of something in RCU. In most systems it only acts like a compiler barrier. On the Alpha, it must emit a membar instruction. Iirc, mb for alpha? Cannot remember that one right now.
That got deprecated. Too hard for compilers to deal with. It's now
same as memory_order_acquire.
Which brings up an interesting point. Even if the hardware memory
memory model is strongly ordered, compilers can reorder stuff,
so you still have to program as if a weak memory model was in
effect. Or maybe disable reordering or optimization altogether
for those target architectures.
Joe Seigh