8ec Subj : Re: Memory visibility and MS Interlocked instructions To : comp.programming.threads From : Joe Seigh Date : Fri Aug 26 2005 09:25 am Alexander Terekhov wrote: > Joe Seigh wrote: > [...] > >>Sun has #LoadLoad, #LoadStore, etc... which gives you all the different >>memory ordering that you would need. > > > Sun has a whole bunch of (compound) bidirectional fences. A subset > of Sun's fences can be used to implement unidirectional hoist/sink > stuff and also barrier(msync) intrinsic with "true == (msync & > msync_rel) && (msync & msync_acq)" precondition Whoa! Define bidirectional and unidirectional first. > > ssb|hsb -> StoreStore // eieio or {lw}sync > ssb|hlb -> StoreLoad // sync > slb|hsb -> LoadStore // {lw}sync > slb|hlb -> LoadLoad // {lw}sync > rel|hsb -> StoreStore+LoadStore // {lw}sync > rel|hlb -> StoreLoad+LoadLoad // sync > ssb|acq -> StoreStore+StoreLoad // sync > slb|acq -> LoadStore+LoadLoad // {lw}sync Suns mnemonics seem more intuitive than pirate mnemonics. Unless you're trying to get ready for Talk Like a Pirate Day, which is Sept. 19, BTW. > rel|acq -> Sledgehammer proper // sync LoadLoad+LoadStore+StoreStore+StoreLoad I assume. > > on Sun's hardware, but Sun's model sucks because bidirectional > constraints are just way too heavy. As for cc/dd stuff, go read > D.3.3. It says that cchsb (in somewaht dumb incarnation) is implied > on Sparc hardware (for load{-modify-store} stuff) just like ddhlb, > ddhsb, and ddacq (ddhlb+ddhsb). But cchlb does require a fence (in > RMO): the same (trailing) MEMBAR #LoadLoad as ccacq (cchlb + cchsb). > > That does NOT mean that compilers can't be more effecient than > Sun's hardware regarding reordering constraints (I mean compiler > reordering). What do compilers have to do with anything, other then you need to address ordering issues with them also, i.e. the "membar" api needs to address both. For example a "LoadLoad" api would need a hardware LoadLoad membar and LoadLoad ordering by the compiler. > > regards, > alexander. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. . 0