πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #560

Re: SMR load...

#560
From: Chris M. Thomasson
Date: Thu, 15 Oct 2026 03:19
67 lines
3571 bytes
On 10/14/2026 5:55 PM, Joseph Seigh wrote:
> On 10/14/26 6:11 PM, Chris M. Thomasson wrote:
>> On 10/14/2026 2:55 PM, Chris M. Thomasson wrote:
>>> Why does the C++ memory model seem to require async SMR loads to 
>>> basically NEED std::memory_order_consume, which iirc gets folded into 
>>> acquire. on the load side of SMR?
>>
>>
>> Pure ISO C++ no longer gives you a way to express β€œthis load only 
>> needs dependency ordering, no full acquire barrier.”
>>
> Data dependent loads aren't really part of any memory model AFAIK.
> In the older intel docs, this was in the performance section.
> It would cause a stall in the pipeline which you could use
> to execute some other instruction.Β  Out of order processors
> may not have this problem so much anymore maybe.
> 
> McKenney came up with this to avoid having to use some
> more expensive memory barrier.

Almost has to be why!


> But you had to be aware that dependent loads only ordered
> subsequent loads that were dependent on that load.

shit... Well, so, in std C++ memory model what relacy simulates, I still 
need a std::memory_order_consume, which gets expressed as a damn acquire 
anyway. I am having trouble making anything better wrt the SMR loop. 
This as relaxed as I can get SMR loads for now:
_______________
per_node*
smr_load(
     unsigned long tidx
) {
     for (;;)
     {
         per_node* node0 = m_node.load(rl::mo_relaxed, $);

         if (! node0)
         {
             RL_ASSERT(0); // hould never happen in this test!
             m_threads[tidx].m_haz_0.store(nullptr, rl::mo_relaxed, $);
             break;
         }

         m_threads[tidx].m_haz_0.store(node0, rl::mo_relaxed, $);

         // actually, iirc, a single seq_cst right here should work?
         // well, this is an async test...

         per_node* node1 = m_node.load(rl::mo_consume, $);

         // uncomment below, Relacy goes berserker!
         //per_node* node1 = m_node.load(rl::mo_relaxed, $);
         if (node0 == node1)
         {
             return node0;
         }
     }

     return nullptr;
}
_______________

Any weaker and Relacy simply does not like it. Humm... I need to dig in 
a little more. Thanks Joe.
Technical Details
Message-ID: <11apgo4$224f6$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11aotod$1sm8r$1@dont-email.me> <11aoum9$1t08a$1@dont-email.me> <11ap89b$1vkih$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: comp.lang.c++
Subject: Re: SMR load...
Date: Wed, 14 Oct 2026 20:19:29 -0700
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <11apgo4$224f6$1@dont-email.me>
References: <11aotod$1sm8r$1@dont-email.me> <11aoum9$1t08a$1@dont-email.me>
 <11ap89b$1vkih$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Oct 2026 03:19:33 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2167270"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/fc58oWlzkVWmAvwOam+8GedqkP7+T6BE="; posting-host="979f69778276c51b653f13045ccea5e5"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Al75zuHjoenLMLK+5Ex2sREbDmM= sha256:n38hiXl8CX8eCZQbw2vlM7ZJh0v2ZJOnCWI15XJkEHA=
	sha1:F08KEdaAp0dq1je6aD6mJ1bXacA= sha256:wMDnTA+h962YUGk3wFvW9fwQPw6NyrNWGa1vMiFumc4=
In-Reply-To: <11ap89b$1vkih$1@dont-email.me>
Content-Language: en-US