Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch > #33369 > unrolled thread
| Started by | Ivan Godard <ivan@millcomputing.com> |
|---|---|
| First post | 2016-01-31 17:10 -0800 |
| Last post | 2016-02-15 11:41 +0000 |
| Articles | 20 on this page of 35 — 10 participants |
Back to article view | Back to comp.arch
"volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-01-31 17:10 -0800
Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-01 07:48 +0000
Re: "volatile" on the Mill William Edwards <willvarfar@gmail.com> - 2016-01-31 23:53 -0800
Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-01 08:47 +0000
Re: "volatile" on the Mill "Paul A. Clayton" <paaronclayton@gmail.com> - 2016-02-01 20:34 -0800
Re: "volatile" on the Mill already5chosen@yahoo.com - 2016-02-02 01:36 -0800
Re: "volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-02-02 04:19 -0800
Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-02 12:55 +0000
Re: "volatile" on the Mill already5chosen@yahoo.com - 2016-02-02 05:16 -0800
Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-03 11:55 -0800
Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-08 11:10 -0800
Re: "volatile" on the Mill gpderetta <gpderetta@gmail.com> - 2016-02-15 02:27 -0800
Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-21 14:05 -0800
Re: "volatile" on the Mill gpderetta <gpderetta@gmail.com> - 2016-02-29 07:37 -0800
Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-03-07 15:24 -0800
Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-03 12:30 -0800
Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-02 11:16 -0800
Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-02 11:18 -0800
Re: "volatile" on the Mill already5chosen@yahoo.com - 2016-02-02 11:30 -0800
Re: "volatile" on the Mill "Paul A. Clayton" <paaronclayton@gmail.com> - 2016-02-02 11:37 -0800
Re: "volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-02-02 15:22 -0800
Re: "volatile" on the Mill MitchAlsup <MitchAlsup@aol.com> - 2016-02-02 16:54 -0800
Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-03 10:53 +0000
Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 07:19 -0800
Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 07:49 -0800
Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-03 16:17 +0000
Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 12:41 -0800
Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-04 17:03 +0000
Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 12:47 -0800
Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-04 17:20 +0000
Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-03 09:59 +0000
Re: "volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-02-03 02:34 -0800
Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-03 11:01 +0000
Re: "volatile" on the Mill gpderetta <gpderetta@gmail.com> - 2016-02-15 02:18 -0800
Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-15 11:41 +0000
Page 1 of 2 [1] 2 Next page →
| From | Ivan Godard <ivan@millcomputing.com> |
|---|---|
| Date | 2016-01-31 17:10 -0800 |
| Subject | "volatile" on the Mill |
| Message-ID | <n8mb5k$27c$1@dont-email.me> |
Several people here have expressed interest in informal information about the Mill. Currently there is much posting (and consternation) about the related subjects of memory ordering, volatile, and compiler optimization. Here is the Present Most Recent Final Word about such issues on the Mill. Subject to change without notice. The Mill is hardware. While we are retargeting the clang/llvm compiler to the Mill, and no doubt will retarget GCC and others in time, we have no control over what the compiler does with your program before our code generator gets it, and even less control over what the languages define or don't define. This note describes our intentions in the hardware and code generator, only portions of which are as yet implemented. It is not canon. Mill hardware is inherently sequentially consistent. That is a technical term and does not mean that it imposes a global ordering; see https://en.wikipedia.org/wiki/Sequential_consistency. Sequential consistency is a stronger model than that offered by other commercial CPUs. Active agents (in practice cores) see memory changes they and other agents make in each mutator's program order, arbitrarily interleaved. The Mill does not have memory-op, op-memory, read-modify-write, membar, or bus-locking operations (or busses to lock). It uses cache-based optimistic concurrency control. There are some caveats to this, which are defined in our (incomplete, not published) ABI: "volatile" is an attribute attached to particular memory-reference actions in the intermediate representation (genAsm) provided by the compiler to the code generator. It then becomes a flag bit attached to memory reference operations in the member-specific binary encoding (conAsm). The flag is in turn attached to requests created by the load/store functional units and passed down the hierarchy. A "volatile access" is such a request with the volatile bit set. A volatile access that crosses a cache line boundary will fault. Naturally-aligned access never crosses a line boundary. A volatile access to an object larger than the largest supported on a target Mill member will receive a code-generator diagnostic, for example a volatile access to a quad (16 byte) object on a target that does not support native quad. A volatile access using a deferred load (of either kind) is generally uncodeable and will receive a code-generator diagnostic, but if codeable on a particular member will fault. A volatile access that is part of the participant set of an optimistic-atomic group (sometimes called a transaction) is generally uncodeable and will receive a code-generator diagnostic, but if codeable on a particular member will fault. A volatile access that is a within an optimistic-atomic group but is not a participant will execute as a normal volatile access on each retry. Volatile accesses are not reordered by the code generator, which honors the compiler-supplied ordering. They may be arbitrarily reordered with respect to other operations, consistent with the dataflow and control flow of the program. Volatile accesses are not speculated, and will not be executed unless actual program control flow requires. Volatile accesses may issue across a misprediction, but without hardware-visible side effects until the prediction is verified. A volatile access to a virtual address within the target-member-defined MMIO space behaves the same as a non-volatile access, namely a store is not cached and a load does not check for a cached value. Individual entities within MMIO space may constrain the access beyond the usual alignment restrictions. A volatile access is cacheable normally unless the access is marked uncacheable or is to MMIO space. Both cacheable and uncacheable volatile accesses act identically to the corresponding non-volatile access, i.e. an uncacheable store updates cache normally followed by a succession of evicts to memory, thereby removing the line from all caches, while an uncacheable load invalidates the requested bytes at each cache level followed by satisfaction from memory and normal caching. Volatile accesses to different virtual addresses that alias by page mapping are ordered as if they used the same virtual address. A volatile load of backless memory that is not satisfied in cache receives a zero normally. The effect of these rules is that a Mill volatile access is guaranteed to comprise a single atomic action that is executed in program order and iff required by actual program control flow. Volatile is not required to safely access devices (determined by an address in the MMIO region), nor does it alone guarantee that external memory is actually accessed (determined by the "uncached" flag).
[toc] | [next] | [standalone]
| From | nmm@wheeler.UUCP (Nick Maclaren) |
|---|---|
| Date | 2016-02-01 07:48 +0000 |
| Message-ID | <n8n2jg$a42$1@dont-email.me> |
| In reply to | #33369 |
In article <n8mb5k$27c$1@dont-email.me>, Ivan Godard <ivan@millcomputing.com> wrote: >Several people here have expressed interest in informal information >about the Mill. Currently there is much posting (and consternation) >about the related subjects of memory ordering, volatile, and compiler >optimization. Here is the Present Most Recent Final Word about such >issues on the Mill. Subject to change without notice. Interesting. It seems very reasonable, and still is going to be something that 99% of programmers should avoid like the plague, because using it correctly will not be easy. Regards, Nick Maclaren.
[toc] | [prev] | [next] | [standalone]
| From | William Edwards <willvarfar@gmail.com> |
|---|---|
| Date | 2016-01-31 23:53 -0800 |
| Message-ID | <3a9ab0f1-6683-4b35-8464-20ac15b9dcf6@googlegroups.com> |
| In reply to | #33377 |
On Monday, 1 February 2016 08:50:52 UTC+1, Nick Maclaren wrote: > In article <@dont-email.me>, > Ivan Godard <@millcomputing.com> wrote: > >Several people here have expressed interest in informal information > >about the Mill. Currently there is much posting (and consternation) > >about the related subjects of memory ordering, volatile, and compiler > >optimization. Here is the Present Most Recent Final Word about such > >issues on the Mill. Subject to change without notice. > > Interesting. It seems very reasonable, and still is going to be > something that 99% of programmers should avoid like the plague, > because using it correctly will not be easy. > If it were easy to use correctly, what would 99% of programmers start using it for? ;)
[toc] | [prev] | [next] | [standalone]
| From | nmm@wheeler.UUCP (Nick Maclaren) |
|---|---|
| Date | 2016-02-01 08:47 +0000 |
| Message-ID | <n8n63o$km9$1@dont-email.me> |
| In reply to | #33378 |
In article <3a9ab0f1-6683-4b35-8464-20ac15b9dcf6@googlegroups.com>, William Edwards <willvarfar@gmail.com> wrote: >> >> >Several people here have expressed interest in informal information >> >about the Mill. Currently there is much posting (and consternation) >> >about the related subjects of memory ordering, volatile, and compiler >> >optimization. Here is the Present Most Recent Final Word about such >> >issues on the Mill. Subject to change without notice. >> >> Interesting. It seems very reasonable, and still is going to be >> something that 99% of programmers should avoid like the plague, >> because using it correctly will not be easy. > >If it were easy to use correctly, what would 99% of programmers start >using it for? ;) Well, there is that :-) More seriously, it does have its uses, and 'ordinary' programmers do occasionally need to write such code. Setting and testing flags between asynchronous code (e.g. signal handlers) and the main code. Playing 'interesting' numerical tricks, because most compilers do not follow the C standard - this use is outside the C standard. Kahan summation is the best-known example, and compilers often recognise that as a special case, but don't recognise the others. Various uses in debugging difficult problems - this use is also outside the C standard. Regards, Nick Maclaren.
[toc] | [prev] | [next] | [standalone]
| From | "Paul A. Clayton" <paaronclayton@gmail.com> |
|---|---|
| Date | 2016-02-01 20:34 -0800 |
| Message-ID | <ad013940-d620-47af-851e-3b93866a9544@googlegroups.com> |
| In reply to | #33369 |
On Sunday, January 31, 2016 at 8:10:56 PM UTC-5, Ivan Godard wrote: [snip] > Mill hardware is inherently sequentially consistent. That is a technical > term and does not mean that it imposes a global ordering; see > https://en.wikipedia.org/wiki/Sequential_consistency. Sequential > consistency is a stronger model than that offered by other commercial > CPUs. Active agents (in practice cores) see memory changes they and > other agents make in each mutator's program order, arbitrarily interleaved. Historical note: PA-RISC *implementations* provided sequential consistency even though the *architecture* defined a relaxed ordering model. (Paul E. McKenney's "Memory Barriers: a Hardware View for Software Hackers": «Although the PA-RISC architecture permits full reordering of loads and stores, actual CPUs run fully ordered») Also, SGI R10000-based Origin servers provided sequential consistency (https://www.linux-mips.org/wiki/Memory_consistency#Consistency_models_on_MIPS_systems ). If one took the statement "than that offered" to mean "than that ever offered" (rather than the somewhat obviously intended "than that currently offered"), it would not be true.
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2016-02-02 01:36 -0800 |
| Message-ID | <3579f4fd-086a-4f44-a9cd-785b4b84f3c2@googlegroups.com> |
| In reply to | #33403 |
On Tuesday, February 2, 2016 at 6:34:24 AM UTC+2, Paul A. Clayton wrote: > On Sunday, January 31, 2016 at 8:10:56 PM UTC-5, Ivan Godard wrote: > [snip] > > Mill hardware is inherently sequentially consistent. That is a technical > > term and does not mean that it imposes a global ordering; see > > https://en.wikipedia.org/wiki/Sequential_consistency. Sequential > > consistency is a stronger model than that offered by other commercial > > CPUs. Active agents (in practice cores) see memory changes they and > > other agents make in each mutator's program order, arbitrarily interleaved. > > Historical note: PA-RISC *implementations* provided sequential > consistency even though the *architecture* defined a relaxed > ordering model. (Paul E. McKenney's "Memory Barriers: a > Hardware View for Software Hackers": «Although the PA-RISC > architecture permits full reordering of loads and stores, actual > CPUs run fully ordered») Also, SGI R10000-based Origin servers > provided sequential consistency (https://www.linux-mips.org/wiki/Memory_consistency#Consistency_models_on_MIPS_systems ). > > If one took the statement "than that offered" to mean "than > that ever offered" (rather than the somewhat obviously > intended "than that currently offered"), it would not be true. Do not SPARC and zArch servers *currently* offer sequential consistency? I'm not 100% sure about SPARC, but zArch surely fits the bill, no? Of course, as a matter of argument, Ivan can say that Oracle, Fujitsu and IBM are not in business of selling *CPUs* :-)
[toc] | [prev] | [next] | [standalone]
| From | Ivan Godard <ivan@millcomputing.com> |
|---|---|
| Date | 2016-02-02 04:19 -0800 |
| Message-ID | <n8q6ml$umb$1@dont-email.me> |
| In reply to | #33408 |
On 2/2/2016 1:36 AM, already5chosen@yahoo.com wrote: > On Tuesday, February 2, 2016 at 6:34:24 AM UTC+2, Paul A. Clayton > wrote: >> On Sunday, January 31, 2016 at 8:10:56 PM UTC-5, Ivan Godard >> wrote: [snip] >>> Mill hardware is inherently sequentially consistent. That is a >>> technical term and does not mean that it imposes a global >>> ordering; see >>> https://en.wikipedia.org/wiki/Sequential_consistency. Sequential >>> consistency is a stronger model than that offered by other >>> commercial CPUs. Active agents (in practice cores) see memory >>> changes they and other agents make in each mutator's program >>> order, arbitrarily interleaved. >> >> Historical note: PA-RISC *implementations* provided sequential >> consistency even though the *architecture* defined a relaxed >> ordering model. (Paul E. McKenney's "Memory Barriers: a Hardware >> View for Software Hackers": «Although the PA-RISC architecture >> permits full reordering of loads and stores, actual CPUs run fully >> ordered») Also, SGI R10000-based Origin servers provided sequential >> consistency >> (https://www.linux-mips.org/wiki/Memory_consistency#Consistency_models_on_MIPS_systems >> ). >> >> If one took the statement "than that offered" to mean "than that >> ever offered" (rather than the somewhat obviously intended "than >> that currently offered"), it would not be true. > > Do not SPARC and zArch servers *currently* offer sequential > consistency? I'm not 100% sure about SPARC, but zArch surely fits the > bill, no? > > Of course, as a matter of argument, Ivan can say that Oracle, Fujitsu > and IBM are not in business of selling *CPUs* :-) > To the best of my knowledge none offer sequential consistency as strictly defined; there's a lot of marketing and confusion though. Please correct me, with cites, if you know a counterexample. It's a safe bet that any ISA that has membar operations is not SC, because membars are not necessary with SC. Supposedly x86 comes as close to SC as any, but not quite all the way.
[toc] | [prev] | [next] | [standalone]
| From | nmm@wheeler.UUCP (Nick Maclaren) |
|---|---|
| Date | 2016-02-02 12:55 +0000 |
| Message-ID | <n8q8v5$6pd$1@dont-email.me> |
| In reply to | #33414 |
In article <n8q6ml$umb$1@dont-email.me>, Ivan Godard <ivan@millcomputing.com> wrote: > >To the best of my knowledge none offer sequential consistency as >strictly defined; there's a lot of marketing and confusion though. >Please correct me, with cites, if you know a counterexample. It's a safe >bet that any ISA that has membar operations is not SC, because membars >are not necessary with SC. Supposedly x86 comes as close to SC as any, >but not quite all the way. I have some C++ code that tests that, if anyone is interested, but it has been run only on x86, and isn't ideally portable. It is not well documented, but there are enough comments to use it. Please send Email if interested. Yes, x86 is pretty close, and its main omission is store buffering. http://www.cl.cam.ac.uk/~pes20/weakmemory/index.html Regards, Nick Maclaren.
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2016-02-02 05:16 -0800 |
| Message-ID | <7cc44bb1-8136-4901-8f2c-471a0ed7f0fc@googlegroups.com> |
| In reply to | #33414 |
On Tuesday, February 2, 2016 at 2:19:13 PM UTC+2, Ivan Godard wrote: > On 2/2/2016 1:36 AM, already5chosen@yahoo.com wrote: > > On Tuesday, February 2, 2016 at 6:34:24 AM UTC+2, Paul A. Clayton > > wrote: > >> On Sunday, January 31, 2016 at 8:10:56 PM UTC-5, Ivan Godard > >> wrote: [snip] > >>> Mill hardware is inherently sequentially consistent. That is a > >>> technical term and does not mean that it imposes a global > >>> ordering; see > >>> https://en.wikipedia.org/wiki/Sequential_consistency. Sequential > >>> consistency is a stronger model than that offered by other > >>> commercial CPUs. Active agents (in practice cores) see memory > >>> changes they and other agents make in each mutator's program > >>> order, arbitrarily interleaved. > >> > >> Historical note: PA-RISC *implementations* provided sequential > >> consistency even though the *architecture* defined a relaxed > >> ordering model. (Paul E. McKenney's "Memory Barriers: a Hardware > >> View for Software Hackers": «Although the PA-RISC architecture > >> permits full reordering of loads and stores, actual CPUs run fully > >> ordered») Also, SGI R10000-based Origin servers provided sequential > >> consistency > >> (https://www.linux-mips.org/wiki/Memory_consistency#Consistency_models_on_MIPS_systems > >> ). > >> > >> If one took the statement "than that offered" to mean "than that > >> ever offered" (rather than the somewhat obviously intended "than > >> that currently offered"), it would not be true. > > > > Do not SPARC and zArch servers *currently* offer sequential > > consistency? I'm not 100% sure about SPARC, but zArch surely fits the > > bill, no? > > > > Of course, as a matter of argument, Ivan can say that Oracle, Fujitsu > > and IBM are not in business of selling *CPUs* :-) > > > > To the best of my knowledge none offer sequential consistency as > strictly defined; there's a lot of marketing and confusion though. > Please correct me, with cites, if you know a counterexample. > It's a safe > bet that any ISA that has membar operations is not SC, because membars > are not necessary with SC. Supposedly, special membars can be needed for synchronization between "normal" loads/store and loads/stores to I/O devices. As to "normal" memory, the matters around "lockless" programming are too complex to my brain. Practically, for use that does not involve I/O, I can't imagine a situation in which I may want to use membar on SPARC TSO, but don't want to use the same membar on SC-by-default machine. But if I can't imagine something, it does not mean that Chris M. Thomasson and his friends also can not. ------------ * - Lockless not in more common sense of not using OS semaphores, but in literal sense that inter-processor synchronization does not rely at all on special, a.k.a. "locked" synchronization instructions, either pessimistic, like compare-and-swap and fetch-and-add or optimistic, like LL/SC. > Supposedly x86 comes as close to SC as any, > but not quite all the way. x86 memory ordering is the weakest among strong. Or the strongest above weak, if you prefer it that way. I like to describe it as sequential consistency for 3rd parties. But x86 atomics, i.e. RMW/CAS/XCHG with LOCK prefix, are sequentially consistent with no compromises.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <nospam@nospam.nospam> |
|---|---|
| Date | 2016-02-03 11:55 -0800 |
| Message-ID | <n8tlvq$1did$1@gioia.aioe.org> |
| In reply to | #33417 |
> already5chosen@yahoo.com > wrote in message > news:7cc44bb1-8136-4901-8f2c-471a0ed7f0fc@googlegroups.com... [...] > As to "normal" memory, the matters around "loAs to > "normal" memory, the matters around "lockless" > programming are too complex to my brain. Practically, > for use that does not involve I/O, I can't imagine a > situation in which I may want to use membar on SPARC > TSO, but don't want to use the same membar on > SC-by-default machine. > But if I can't imagine something, it does no mean > that Chris M. Thomasson and his friends also can not. FWIW, both SPARC TSO and x86 require a #StoreLoad style memory barrier to implement the SMR and eventcount algorithms. Or, basically any algorithm that depends on a load followed by a store to another location. This would be the MFENCE instruction on x86. You could use an actual LOCK'ed atomic to get things right, but its more expensive. https://www.research.ibm.com/people/m/michael/ieeetpds-2004.pdf https://groups.google.com/d/topic/comp.programming.threads/qoxirQbbs4A/discussion (Joe Seigh points out the required membars in that thread) One could also use an asynchronous like technique to get around the “explicit” membar, but its more complicated and has some caveats. WRT SMR, you basically only check hazard pointers after a point of "quiescence" has occurred, like RCU. One can "force" a quiescence point by doing a “system” wide memory barrier. Something like: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683148(v=vs.85).aspx TSO is simply not strong enough to handle this by itself.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <nospam@nospam.nospam> |
|---|---|
| Date | 2016-02-08 11:10 -0800 |
| Message-ID | <n9ap82$kjb$1@gioia.aioe.org> |
| In reply to | #33454 |
> "Chris M. Thomasson" wrote in message > news:n8tlvq$1did$1@gioia.aioe.org... [...] > Or, basically any algorithm that depends on > a load followed by a store to another location. [...] Ummm.... The above should read as: "Or, basically any algorithm that depends on a STORE followed by a LOAD to another location." Damn it! I am very sorry for this massive error in my wording. I got it exactly backwards! ARGHGGHGHGHGH! ;^o Can Dyslexia appear later in life? DAMN! The SMR and EventCount algorithms depend on the #StoreLoad relationship which needs a membar on SPARC TSO and current Intel processors.
[toc] | [prev] | [next] | [standalone]
| From | gpderetta <gpderetta@gmail.com> |
|---|---|
| Date | 2016-02-15 02:27 -0800 |
| Message-ID | <c4b44c75-685e-42e2-9c8b-17956a7dbccd@googlegroups.com> |
| In reply to | #33454 |
On Wednesday, February 3, 2016 at 7:55:44 PM UTC, Chris M. Thomasson wrote: > > already5chosen@yahoo.com > > wrote in message > > news:7cc44bb1-8136-4901-8f2c-471a0ed7f0fc@googlegroups.com... > > [...] > > > As to "normal" memory, the matters around "loAs to > > "normal" memory, the matters around "lockless" > > programming are too complex to my brain. Practically, > > for use that does not involve I/O, I can't imagine a > > situation in which I may want to use membar on SPARC > > TSO, but don't want to use the same membar on > > SC-by-default machine. > > But if I can't imagine something, it does no mean > > that Chris M. Thomasson and his friends also can not. > > FWIW, both SPARC TSO and x86 require a #StoreLoad style > memory barrier to implement the SMR and eventcount > algorithms. Or, basically any algorithm that depends on > a load followed by a store to another location. This > would be the MFENCE instruction on x86. You could use > an actual LOCK'ed atomic to get things right, but its > more expensive. > Hi Chris, big fan of your work! Just a small clarification, I believe that locked instructions (possibly on a dummy memory location) are actually preferred to MFENCE as a store-load as they have a slightly higher throughput/lower latency, at least on current x86 cpus (core2 was the exception with a faster mfence). There might be second order effects of course. For examples many compilers lower sequential consistency stores to an XCHG instead of MFENCE+MOV. During the C++ MM development it was argued that MFENCE would not be enough to guarantee SC, but this was later clarified by intel (by slightly strengthening the memory order to TSO) to have the same fencing effect of a locked instruction. -- gpd
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <nospam@nospam.nospam> |
|---|---|
| Date | 2016-02-21 14:05 -0800 |
| Message-ID | <nadcbv$sms$1@gioia.aioe.org> |
| In reply to | #33664 |
> "gpderetta" wrote in message > news:c4b44c75-685e-42e2-9c8b-17956a7dbccd@googlegroups.com... > > On Wednesday, February 3, 2016 at 7:55:44 PM UTC, Chris M. Thomasson > > wrote: > > [...] > Hi Chris, big fan of your work! > Just a small clarification, I believe that locked instructions > (possibly on a dummy memory location) are actually preferred to > MFENCE as a store-load as they have a slightly higher throughput/lower > latency, at least on current x86 cpus (core2 was the exception with > a faster mfence). There might be second order effects of course. > For examples many compilers lower sequential consistency stores to > an XCHG instead of MFENCE+MOV. > During the C++ MM development it was argued that MFENCE would not > be enough to guarantee SC, but this was later clarified by intel > (by slightly strengthening the memory order to TSO) to have the > same fencing effect of a locked instruction. Thank you for the heads up about MFENCE. However, I still worry about side-effects. So, if its a dummy location for the LOCK'ed op, well, it better be aligned on a cache line, and padded to the size of said cache line! That should reduce any side-effects... Humm... Any thoughts? MFENCE might be better... ;^)
[toc] | [prev] | [next] | [standalone]
| From | gpderetta <gpderetta@gmail.com> |
|---|---|
| Date | 2016-02-29 07:37 -0800 |
| Message-ID | <9a2d1491-0251-4a88-b124-b86c955cdcce@googlegroups.com> |
| In reply to | #33757 |
On Sunday, February 21, 2016 at 10:05:56 PM UTC, Chris M. Thomasson wrote: > > "gpderetta" wrote in message > > news:c4b44c75-685e-42e2-9c8b-17956a7dbccd@googlegroups.com... > > > > On Wednesday, February 3, 2016 at 7:55:44 PM UTC, Chris M. Thomasson > > > wrote: > > > [...] > > > Hi Chris, big fan of your work! > > > Just a small clarification, I believe that locked instructions > > (possibly on a dummy memory location) are actually preferred to > > MFENCE as a store-load as they have a slightly higher throughput/lower > > latency, at least on current x86 cpus (core2 was the exception with > > a faster mfence). There might be second order effects of course. > > For examples many compilers lower sequential consistency stores to > > an XCHG instead of MFENCE+MOV. > > > During the C++ MM development it was argued that MFENCE would not > > be enough to guarantee SC, but this was later clarified by intel > > (by slightly strengthening the memory order to TSO) to have the > > same fencing effect of a locked instruction. > > Thank you for the heads up about MFENCE. However, I still worry > about side-effects. So, if its a dummy location for the LOCK'ed > op, well, it better be aligned on a cache line, and padded to > the size of said cache line! That should reduce any side-effects... > > Humm... Any thoughts? MFENCE might be better... ;^) I believe that the usual [1] solution is simply to do an xchg on a 64 or 128 bit aligned dummy location at the top of the current stack frame. That cache line is unlikely to be shared (otherwise you will have bigger problems) and very likely to be in cache. [1] i.e. what the jvm does.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <nospam@nospam.nospam> |
|---|---|
| Date | 2016-03-07 15:24 -0800 |
| Message-ID | <nbl2ip$1p2o$1@gioia.aioe.org> |
| In reply to | #33810 |
> "gpderetta" wrote in message > news:9a2d1491-0251-4a88-b124-b86c955cdcce@googlegroups.com... > > On Sunday, February 21, 2016 at 10:05:56 PM UTC, Chris M. Thomasson > > wrote: [...] > > Humm... Any thoughts? MFENCE might be better... ;^) > I believe that the usual [1] solution is simply to do an > xchg on a 64 or 128 bit aligned dummy location at the top of > the current stack frame. That cache line is unlikely to be > shared (otherwise you will have bigger problems) and very > likely to be in cache. > [1] i.e. what the jvm does. Hopefully its in cache! Humm, IMVHO it still seems that MFENCE is a bit more “natural” than a (pseudo-RMW?) LOCK'ed op on dummy location wrt per-thread stack locations... Streaming functions aside for a moment... ;^)
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <nospam@nospam.nospam> |
|---|---|
| Date | 2016-02-03 12:30 -0800 |
| Message-ID | <n8to16$1h3c$1@gioia.aioe.org> |
| In reply to | #33417 |
> already5chosen@yahoo.com > wrote in message > news:7cc44bb1-8136-4901-8f2c-471a0ed7f0fc@googlegroups.com... [...] IIRC, there was a "problem" with one of Intels processors that broke spinlocks. I believe it was called the “Plan 9” problem. All the spinlock's that used a simple MOV instruction to unlock them were busted...
[toc] | [prev] | [next] | [standalone]
| From | Quadibloc <jsavard@ecn.ab.ca> |
|---|---|
| Date | 2016-02-02 11:16 -0800 |
| Message-ID | <ee26894e-046f-47a5-a6f0-a55325a26988@googlegroups.com> |
| In reply to | #33414 |
On Tuesday, February 2, 2016 at 5:19:13 AM UTC-7, Ivan Godard wrote: > To the best of my knowledge none offer sequential consistency as > strictly defined; there's a lot of marketing and confusion though. > Please correct me, with cites, if you know a counterexample. It's a safe > bet that any ISA that has membar operations is not SC, because membars > are not necessary with SC. Supposedly x86 comes as close to SC as any, > but not quite all the way. I had thought that z/Architecture would be likely to out-do x86 in this department, and indeed my guess _there_ was right, but you are indeed correct that it, too, does not offer true sequential consistency. A paper from 2006, "Memory Ordering in Modern Microprocessors", by Paul E. McKenny, available on IBM's web site, provided information on this topic. A table showed, as someone noted, that while the PA-RISC architecture allowed four of eight departures from sequential consistency, the actual chips did not permit any of them. (In contrast, the Itanium engaged in seven of the eight.) The z/Architecture only allowed two: stores reordered after loads, and an incoherent cache/pipeline. John Savard
[toc] | [prev] | [next] | [standalone]
| From | Quadibloc <jsavard@ecn.ab.ca> |
|---|---|
| Date | 2016-02-02 11:18 -0800 |
| Message-ID | <4da56fa6-1a7b-475d-8e59-15bd1427e77a@googlegroups.com> |
| In reply to | #33433 |
On Tuesday, February 2, 2016 at 12:16:42 PM UTC-7, Quadibloc wrote: > I had thought that z/Architecture would be likely to out-do x86 in this > department, and indeed my guess _there_ was right, but you are indeed correct > that it, too, does not offer true sequential consistency. As for SPARC, "SPARC TSO", whatever that is, matches z/Architecture, while other versions of SPARC are less consistent. John Savard
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2016-02-02 11:30 -0800 |
| Message-ID | <da320535-12cf-41d4-9d4f-6497e61be1a3@googlegroups.com> |
| In reply to | #33434 |
On Tuesday, February 2, 2016 at 9:18:58 PM UTC+2, Quadibloc wrote: > On Tuesday, February 2, 2016 at 12:16:42 PM UTC-7, Quadibloc wrote: > > > I had thought that z/Architecture would be likely to out-do x86 in this > > department, and indeed my guess _there_ was right, but you are indeed correct > > that it, too, does not offer true sequential consistency. > > As for SPARC, "SPARC TSO", whatever that is, matches z/Architecture, while other > versions of SPARC are less consistent. > > John Savard SPARC-TSO is the only variant of SPARC that is implemented [by Sun/Oracle and Fujitsu, not sure about other parties] in last 15+ years. I don't think that Solaris still supports SPARC-RMO hardware, but I could be wrong about it.
[toc] | [prev] | [next] | [standalone]
| From | "Paul A. Clayton" <paaronclayton@gmail.com> |
|---|---|
| Date | 2016-02-02 11:37 -0800 |
| Message-ID | <4cb123d8-8a5c-41a1-9f6b-fd39665a717d@googlegroups.com> |
| In reply to | #33414 |
On Tuesday, February 2, 2016 at 7:19:13 AM UTC-5, Ivan Godard wrote: > On 2/2/2016 1:36 AM, already5chosen@yahoo.com wrote: [snip] >> Do not SPARC and zArch servers *currently* offer sequential >> consistency? I'm not 100% sure about SPARC, but zArch surely fits the >> bill, no? SPARC's Total Store Order allows stores to be reordered after loads (according to McKenney's paper). The same source indicates that zArch also allows stores to be reordered after loads, but somewhat confusingly also states "It also has comparatively strong memory-ordering semantics, as shown in Table 5, which should allow the smp_wmb() primitive to be a nop (and by the time you read this, this change may well have happened).The table actually understates the situation, as the zSeries memory model is otherwise sequentially consistent, meaning that all CPUs will agree on the order of unrelated stores from different CPUs." >> Of course, as a matter of argument, Ivan can say that Oracle, Fujitsu >> and IBM are not in business of selling *CPUs* :-) >> > > To the best of my knowledge none offer sequential consistency as > strictly defined; there's a lot of marketing and confusion though. > Please correct me, with cites, if you know a counterexample. It's a safe > bet that any ISA that has membar operations is not SC, because membars > are not necessary with SC. Supposedly x86 comes as close to SC as any, > but not quite all the way. Having architectural membar operations does not mean that no systems support sequential consistency. It would be possible to have systems that support SC but provide software compatibility across a larger range (defined by the ISA). PA-RISC is an example. It would also be possible for the ISA to define a concept of consistency regions within which stronger consistency is provided. Such would allow avoiding membar when all active memory is constrained within the region. (The closest that I am aware to such might be Itanium's TLB coherence domains which allow one to avoid interprocessor interrupts for TLB coherence within a domain. Hardware partitioning systems could perhaps be reasonably extended to support such features.) Of course, this could be provided as a microarchitectural feature to support lower overhead membar. It might even be practical to support larger consistency domains in higher-end systems with the same core microarchitecture. Supporting SC might be easy enough in a group of four cores to allow such in a low-end implementation, but with more hardware adequately performing SC might be supported at higher core counts or otherwise across natural partition boundaries. One could also imagine an architecture where membar is *architecturally* a hint operation, allowing software to indicate sequencing points to reduce overheads. A code sequence without the membars would execute correctly but potentially at lower performance (or energy-efficiency or other metric of value). In this case the ISA would still provide SC, but would also have membar instructions (though they would probably be called something else since they are hints). (Obviously, one could combine hint membar and consistency domain features such that membars are useless hints within a consistency domain and not semantically necessary in a larger context but are still architecturally defined and useful.) I also wonder if membar is the best interface for ensuring consistency. Such seems to substantially overspecify the ordering requirements both in what storage addresses (names) participate and what agents are involved. Transactional memory implementations limit the name space and agent space at significant cost (and membar could use similar hardware to reduce latency -- using TM hardware to detect ordering violations has already been proposed academically), typically not supporting not-participating names (much less something like the name removal in AMD's ASF). Transactional memory also somewhat overspecifies in that the entire operation is atomic (name removal provides some non-atomic behavior). This is not an area where I understand the considerations, but even so it seems obvious that there are tradeoffs. Even the pay-for-what-you-use philosophy is not obviously the best way to proceed in all cases.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.arch
csiph-web