By: Wilco (Wilco.Dijkstra.delete@this.ntlworld.com), July 13, 2015 4:36 pm
Room: Moderated Discussions
sylt (no.delete@this.thanks.com) on July 13, 2015 2:19 pm wrote:
> dmcq (dmcq.delete@this.fano.co.uk) on July 13, 2015 12:20 pm wrote:
> > You simply don't seem to be able to acknowledge that supporting that is causing more problems,
> > that Linux is part of a feedback loop leading to more buggy programs being produced and your
> > attitude is part of a problem not a solution. Yes supporting old buggy programs is nice and
> > that is what Intel has done, and it can disavow all responsibility for the problems they encourage
> > by saying they have put in very strong support for the sort of thing you want.
> >
>
> I'm not sure I understand what you are arguing here. If people write software for systems with
> strict memory models and takes advantage of that it can hardly be called a bug right?
The point is, you can't. Ignoring the fact most people wouldn't understand the intricate details of say the x86 memory model and its various gotcha's, there is something called a "compiler". And a compiler will reorder loads and stores according to the language rules, typically assuming no multithreading unless special annotations are added (eg. volatile, intrinsics or the C++11 atomics).
Whatever memory model you're targeting, you always need those annotations. When annotated correctly there is actually little difference between the different memory models - some annotations cause special loads/stores to be emitted, some become barriers, some are just nops and only compiler optimization barriers. So it is more correct to say that compilers will automatically take advantage of the memory model when supplied with correct annotations. They can even optimize away redundant barriers when they can prove they aren't required.
Wilco
> dmcq (dmcq.delete@this.fano.co.uk) on July 13, 2015 12:20 pm wrote:
> > You simply don't seem to be able to acknowledge that supporting that is causing more problems,
> > that Linux is part of a feedback loop leading to more buggy programs being produced and your
> > attitude is part of a problem not a solution. Yes supporting old buggy programs is nice and
> > that is what Intel has done, and it can disavow all responsibility for the problems they encourage
> > by saying they have put in very strong support for the sort of thing you want.
> >
>
> I'm not sure I understand what you are arguing here. If people write software for systems with
> strict memory models and takes advantage of that it can hardly be called a bug right?
The point is, you can't. Ignoring the fact most people wouldn't understand the intricate details of say the x86 memory model and its various gotcha's, there is something called a "compiler". And a compiler will reorder loads and stores according to the language rules, typically assuming no multithreading unless special annotations are added (eg. volatile, intrinsics or the C++11 atomics).
Whatever memory model you're targeting, you always need those annotations. When annotated correctly there is actually little difference between the different memory models - some annotations cause special loads/stores to be emitted, some become barriers, some are just nops and only compiler optimization barriers. So it is more correct to say that compilers will automatically take advantage of the memory model when supplied with correct annotations. They can even optimize away redundant barriers when they can prove they aren't required.
Wilco