[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250107100618.GK20870@noisy.programming.kicks-ass.net>
Date: Tue, 7 Jan 2025 11:06:18 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Jonas Oberhauser <jonas.oberhauser@...weicloud.com>
Cc: paulmck@...nel.org, stern@...land.harvard.edu, parri.andrea@...il.com,
will@...nel.org, boqun.feng@...il.com, npiggin@...il.com,
dhowells@...hat.com, j.alglave@....ac.uk, luc.maranget@...ia.fr,
akiyks@...il.com, dlustig@...dia.com, joel@...lfernandes.org,
urezki@...il.com, quic_neeraju@...cinc.com, frederic@...nel.org,
linux-kernel@...r.kernel.org, lkmm@...ts.linux.dev,
hernan.poncedeleon@...weicloud.com
Subject: Re: [RFC] tools/memory-model: Rule out OOTA
On Mon, Jan 06, 2025 at 10:40:03PM +0100, Jonas Oberhauser wrote:
> We first discuss why the more standard definition does not work well for
> language models like LKMM. For example, consider
>
> r1 = *a;
> *b = 1;
> if (*a == 1)
if (r1 == 1)
?
> *b = 1;
> *c = *b;
>
> In the execution where r1 == 1, there is a control dependency from
> the load of *a to the second store to *b, from which the load to *b reads,
> and the store to *c has a data dependency on this load from *b. Nevertheless
> there is no semantic dependency from the load of *a to the store to *c; the
> compiler could easily replace the last line with *c = 1 and move this line to
> the top as follows:
>
> *c = 1;
> r1 = *a;
> *b = 1;
>
> Since there is no order imposed by this sequence of syntactic dependencies
> and reads, syntactic dependencies can not by themselves form an acyclic
> relation.
>
> In turn, there are some sequences of syntactic dependencies and reads that do
> form semantic dependencies, such as
>
> r1 = *a;
> *b = 2;
> if (*a == 1)
r1 again?
> *b = 1;
> *c = *b;
>
> Here we would consider that the store to *c has a semantic data dependency on
> the read from *a, given that depending on the result of that read, we store
> either the value 1 or 2 to *c.
Powered by blists - more mailing lists