Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-31 Thread Michael Matz
Hi, On Thu, 31 Mar 2011, Jeff Law wrote: > Without trip count estimates the speculative read can introduce a > performance regression. Like any other transformation. So what are you trying to say? That therefore introducing a mode in GCC disallowing any speculative reads (even if they happe

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-31 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/31/11 07:26, Richard Guenther wrote: > On Thu, Mar 31, 2011 at 3:08 PM, Jeff Law wrote: > On 03/24/11 17:57, Andrew MacLeod wrote: My fault for not being specific about it... I tend to just use data race as a catch all for all these ty

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-31 Thread Richard Guenther
On Thu, Mar 31, 2011 at 3:08 PM, Jeff Law wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 03/24/11 17:57, Andrew MacLeod wrote: >> My fault for not being specific about it... I tend to just use data race >> as a catch all for all these types of things when talking about them >> wit

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-31 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/24/11 17:57, Andrew MacLeod wrote: > My fault for not being specific about it... I tend to just use data race > as a catch all for all these types of things when talking about them > with Aldy. > > the testcase should have for (x=0; x< limi

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-29 Thread Aldy Hernandez
On 03/25/11 10:39, Richard Guenther wrote: On Fri, Mar 25, 2011 at 4:33 PM, Jakub Jelinek wrote: On Fri, Mar 25, 2011 at 09:30:22AM -0600, Jeff Law wrote: I'm not going to chime in on this specific problem; however, it is worth noting that many of the issues raised by the C++0x memory model al

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Richard Guenther
On Fri, Mar 25, 2011 at 4:33 PM, Jakub Jelinek wrote: > On Fri, Mar 25, 2011 at 09:30:22AM -0600, Jeff Law wrote: >> I'm not going to chime in on this specific problem; however, it is worth >> noting that many of the issues raised by the C++0x memory model also >> affect the linux kernel. > > But

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Jakub Jelinek
On Fri, Mar 25, 2011 at 09:30:22AM -0600, Jeff Law wrote: > I'm not going to chime in on this specific problem; however, it is worth > noting that many of the issues raised by the C++0x memory model also > affect the linux kernel. But what they are seeing are certainly store data races, not load r

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/25/11 09:20, Michael Matz wrote: > Even if there was such (IMO useless) hardware, or somebody would waste his > time in writing such (equally useless) virtual machine that can detect > fabricated problems somebody invented for some standard th

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Michael Matz
Hi, On Fri, 25 Mar 2011, Aldy Hernandez wrote: > > But speculative loads are never a problem. So I'd like to avoid > > cluttering GCC code with stuff to avoid them. I honestly don't care > > about diagnostic tools that fail to see if a value read is used or > > not. > > Frankly, I agree. T

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Aldy Hernandez
But hoisting global in this case doesn't result in a data race, since the loop always accesses global and contains no synchronisation code. If it were only accessed conditionally, as in the examples under "Avoiding Speculation" on that page, then there would be a race in hoisting it, but not fo

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-25 Thread Richard Guenther
On Fri, Mar 25, 2011 at 12:57 AM, Andrew MacLeod wrote: >> On Thu, 24 Mar 2011, Aldy Hernandez wrote: >> >>> This work is independent of the C++ memory model.  It is just to prevent >>> the >>> optimizers from introducing new data races due to code movement. This >>> initial >>> pass is just to ma

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-24 Thread Andrew MacLeod
On Thu, 24 Mar 2011, Aldy Hernandez wrote: This work is independent of the C++ memory model. It is just to prevent the optimizers from introducing new data races due to code movement. This initial pass is just to make the optimizations data race safe so that if you have a program which is prove

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-24 Thread Joseph S. Myers
On Thu, 24 Mar 2011, Aldy Hernandez wrote: > This work is independent of the C++ memory model. It is just to prevent the > optimizers from introducing new data races due to code movement. This initial > pass is just to make the optimizations data race safe so that if you have a > program which is

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-24 Thread Aldy Hernandez
On 03/24/11 14:58, Richard Henderson wrote: On 03/24/2011 10:33 AM, Aldy Hernandez wrote: In the example below we usually hoist "global" into a register or temporary to avoid reading from it at each step. This would cause a race if another thread had modified "global" in between iterations.

Re: [cxx-mem-model] disallow load data races (1 of some)

2011-03-24 Thread Richard Henderson
On 03/24/2011 10:33 AM, Aldy Hernandez wrote: > In the example below we usually hoist "global" into a register or > temporary to avoid reading from it at each step. This would cause a > race if another thread had modified "global" in between iterations. > > for (x=0; x< 5; x++) > sum[x

[cxx-mem-model] disallow load data races (1 of some)

2011-03-24 Thread Aldy Hernandez
This is my first stab at disallowing load data races that happen when we cache the value of a global. I would appreciate input before committing, especially on the RTL bits, cause it's been quite a while since I typed d-e-b-u-g-_-r-t-x. :-) In the example below we usually hoist "global" into