Benefit of dynamic hammock predication

By: Linus Torvalds (torvalds.delete@this.linux-foundation.org),
Room: Moderated Discussions
dmcq (dmcq.delete@this.fano.co.uk) on July 7, 2015 2:38 pm wrote:
>
> I think ARM would have been better off without those rules at all and just depended on memory barrier instructions.
> I guess they were left in because of having to cope with systems like Linux which were written for x86 and
> don't properly describe for the hardware what is really required.

Bzzt, wrong.

Linux actually copes with weak memory ordering fine. Even the lack of data dependencies. We support alpha, after all, which has exactly that "only memory barriers" model.

And that model is pure and utter garbage. All it results in is software having to add insane memory barriers that don't actually matter 99% of the time (because it's actually hard for hardware to screw up a dependency ordering), which in turn just makes normal code go slower - because the piece of crap hardware that doesn't normally do memory orderings usually goes much slower when you say "uhhuh, now you need to be careful".

Plus it results in bugs, because code that works on one microarchutecture may not work on another.

Now, the weak memory ordering people go "but that code was buggy to begin with", which just shows that they don't understand software. Show me a piece of bugfree software, and I will show you a piece of useless software. Seriously. Bugs happen. Even when you're careful. The way those bugs get noticed is by testing. If you cannot accept that, then you should take up another vocation. Maybe farming.

If your architecture model is designed so that testing is basically meaningless because your architecture under-defines behavior, then your architecture is objectively inferior. Really. It's that simple. It's not a "balance between software and hardware" or a matter of opinion. It's a cold hard fact.

The whole objectively inferior thing has some really nasty interaction at a high level too. The broken ARM and Power memory model causes pain right now for the C standards committee that is trying to come up with ways to do efficient threading. Those people are sadly bending over backwards to make things architecture-neutral, resulting in an objectively worse standard. Oh well.

Anyway, one big reason why the whole "data dependency is an implicit ordering" happens is that (a) it's fairly hard for hardware to screw that up (although it's been done, see alpha), and (b) it turns out that languages like Java actually required some memory ordering. You screw up too badly, and you screw Java (object construction in particular).

But there are other reasons, and debugging is a major one.

Weak memory ordering really is bad.

Linus
< Previous Post in ThreadNext Post in Thread >
Thread (202 posts)
TopicPosted ByPosted
Cyclone Macro-op fusionMaynard Handley
  Cyclone Macro-op fusionGabriele Svelto
    Cyclone Macro-op fusionMaynard Handley
      Cyclone Macro-op fusionWilco
        Cyclone Macro-op fusionMaynard Handley
          Cyclone Macro-op fusionMaynard Handley
            Cyclone Macro-op fusionGabriele Svelto
      Power8 branch conversionSHK
        Power8 branch conversionMaynard Handley
          Power8 branch conversionMaynard Handley
        Benefit of dynamic hammock predicationPaul A. Clayton
          Benefit of dynamic hammock predicationMaynard Handley
            Benefit of dynamic hammock predicationEduardoS
            Benefit of dynamic hammock predicationPatrick Chase
          Benefit of dynamic hammock predicationLinus Torvalds
            Benefit of dynamic hammock predicationWilco
              Benefit of dynamic hammock predicationLinus Torvalds
                Benefit of dynamic hammock predicationanon
            Benefit of dynamic hammock predicationPatrick Chase
              Benefit of dynamic hammock predicationanon
              Benefit of dynamic hammock predicationMichael S
              Benefit of dynamic hammock predicationLinus Torvalds
                Benefit of dynamic hammock predicationPatrick Chase
                  Benefit of dynamic hammock predicationSHK
                  Benefit of dynamic hammock predicationMaynard Handley
                    Benefit of dynamic hammock predicationExophase
                      Benefit of dynamic hammock predicationWilco
                      Benefit of dynamic hammock predicationMaynard Handley
                    Benefit of dynamic hammock predicationPatrick Chase
                    Benefit of dynamic hammock predicationMichael S
                  Benefit of dynamic hammock predicationSylvain Collange
                    Benefit of dynamic hammock predicationMaynard Handley
                      Benefit of dynamic hammock predicationSylvain Collange
                        Benefit of dynamic hammock predicationMaynard Handley
                        Sadly, skewed associativity has not been broadly adoptedPaul A. Clayton
                        Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Maynard Handley
                          Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)David Kanter
                            Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Maynard Handley
                              Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Tim McCaffrey
                                Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Patrick Chase
                                  Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Sylvain Collange
                              Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)David Kanter
                                Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Maynard Handley
                            Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Patrick Chase
                          Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)Patrick Chase
                          Prediction quality of A8 and Intel (was Benefit of dynamic hammock predication)someone
            Benefit of dynamic hammock predicationKonrad Schwarz
            Benefit of dynamic hammock predicationdmcq
              Benefit of dynamic hammock predicationLinus Torvalds
                Benefit of dynamic hammock predicationdmcq
                  Benefit of dynamic hammock predicationLinus Torvalds
                    Example of memory ordering causing excitement in the real worldMark Roulo
                      Example of memory ordering causing excitement in the real worlddmcq
                        Example of memory ordering causing excitement in the real worldMark Roulo
                          Example of memory ordering causing excitement in the real worlddmcq
                          Example of memory ordering causing excitement in the real worldMaynard Handley
                            Example of memory ordering causing excitement in the real worldLinus Torvalds
                              Example of memory ordering causing excitement in the real worlddmcq
                                Example of memory ordering causing excitement in the real worldSimon Farnsworth
                                  Example of memory ordering causing excitement in the real worlddmcq
                                    Example of memory ordering causing excitement in the real worldSimon Farnsworth
                                      Example of memory ordering causing excitement in the real worlddmcq
                                        Example of memory ordering causing excitement in the real worldMichael S
                                        Example of memory ordering causing excitement in the real worldSimon Farnsworth
                                          Example of memory ordering causing excitement in the real worlddmcq
                                            Example of memory ordering causing excitement in the real worldSimon Farnsworth
                                              Example of memory ordering causing excitement in the real worlddmcq
                                                Example of memory ordering causing excitement in the real worldSimon Farnsworth
                                                  Example of memory ordering causing excitement in the real worldWilco
                                                    Example of memory ordering causing excitement in the real worldLinus Torvalds
                                                      Example of memory ordering causing excitement in the real worlddmcq
                                          Example of memory ordering causing excitement in the real worldJouni Osmala
                                            Example of memory ordering causing excitement in the real worldSimon Farnsworth
                                              Example of memory ordering causing excitement in the real worldJouni Osmala
                                                ISA support for bound checkingMichael S
                                                  ISA support for bound checkingEtienne
                                                  MPX on SkylakeMark Roulo
                                                    MPX on SkylakeMichael S
                                                      MPX on SkylakeMark Roulo
                                  Example of memory ordering causing excitement in the real worldanon
                                    Example of memory ordering causing excitement in the real worlddmcq
                                    Example of memory ordering causing excitement in the real worldLinus Torvalds
                                      Example of memory ordering causing excitement in the real worldEduardoS
                                        Example of memory ordering causing excitement in the real worldLinus Torvalds
                                          Example of memory ordering causing excitement in the real worldanon
                                            Example of memory ordering causing excitement in the real worldLinus Torvalds
                                              Example of memory ordering causing excitement in the real worlddmcq
                                                Example of memory ordering causing excitement in the real worldLinus Torvalds
                                                  Example of memory ordering causing excitement in the real worldMaynard Handley
                                                    Example of memory ordering causing excitement in the real worldanon
                                                    Simple cores justifying weak ordering?Paul A. Clayton
                                                      David's Paul A. Clayton
                                                      David's 2015-07-12 10:34 post confirmed some of that (NT)Paul A. Clayton
                                                    Example of memory ordering causing excitement in the real worldEtienne
                                                  Example of memory ordering causing excitement in the real worlddmcq
                                                  Reality is even worseTerry Gray
                                                    Reality is even worseKonrad Schwarz
                                                  A simple CAS/MCAS semanticsβš›
                                                    A simple CAS/MCAS semanticsLinus Torvalds
                                                    A simple CAS/MCAS semanticsEduardoS
                                                Example of memory ordering causing excitement in the real worldsylt
                                                  Example of memory ordering causing excitement in the real worlddmcq
                                                    Example of memory ordering causing excitement in the real worldEduardoS
                                                      Example of memory ordering causing excitement in the real worldMaynard Handley
                                                        Example of memory ordering causing excitement in the real worldEduardoS
                                                      Example of memory ordering causing excitement in the real worldanon
                                                    What high level languages do you have in mind?Mark Roulo
                                                      What high level languages do you have in mind?dmcq
                                                  Example of memory ordering causing excitement in the real worldWilco
                                                    Example of memory ordering causing excitement in the real worldEduardoS
                                                      Example of memory ordering causing excitement in the real worldanon
                                                        Example of memory ordering causing excitement in the real worldEduardoS
                                                          Example of memory ordering causing excitement in the real worldanon
                                      Example of memory ordering causing excitement in the real worldMaynard Handley
                                        Example of memory ordering causing excitement in the real worldEduardoS
                                        Example of memory ordering causing excitement in the real worldLinus Torvalds
                                          Example of memory ordering causing excitement in the real worldEduardoS
                                            Example of memory ordering causing excitement in the real worldNoSpammer
                                              Example of memory ordering causing excitement in the real worldWilco
                                                Example of memory ordering causing excitement in the real worldNoSpammer
                                                  Example of memory ordering causing excitement in the real worldanon
                                                    Example of memory ordering causing excitement in the real worldMichael S
                                                      Example of memory ordering causing excitement in the real worldanon
                                                        Example of memory ordering causing excitement in the real worldNoSpammer
                                                          Example of memory ordering causing excitement in the real worlddmcq
                                                            Example of memory ordering causing excitement in the real worldMichael S
                                                              Example of memory ordering causing excitement in the real worlddmcq
                                                              Can string ops use microarchitectural state?Paul A. Clayton
                                                                Can string ops use microarchitectural state?rwessel
                                                                  Can string ops use microarchitectural state?Paul A. Clayton
                                                                    Can string ops use microarchitectural state?rwessel
                                                                      Can string ops use microarchitectural state?Michael S
                                                                        Can string ops use microarchitectural state?rwessel
                                                                Consider interrupt followed by task preemptionMichael S
                                                                  Consider interrupt followed by task preemptionPaul A. Clayton
                                                            Example of memory ordering causing excitement in the real worldNoSpammer
                                                              Example of memory ordering causing excitement in the real worldLinus Torvalds
                                                                Example of memory ordering causing excitement in the real worldNoSpammer
                                                                  Example of memory ordering causing excitement in the real worldLinus Torvalds
                                                      Example of memory ordering causing excitement in the real worldNoSpammer
                                                    Example of memory ordering causing excitement in the real worldLinus Torvalds
                                                      Example of memory ordering causing excitement in the real worldWilco
                                                        Example of memory ordering causing excitement in the real worldanon
                                                        Example of memory ordering causing excitement in the real worldLinus Torvalds
                                                          Example of memory ordering causing excitement in the real worlddmcq
                                                            Example of memory ordering causing excitement in the real worlddmcq
                                        Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                      Example of memory ordering causing excitement in the real worldanon
                                        Example of memory ordering causing excitement in the real worldanon
                                        Example of memory ordering causing excitement in the real worldDavid Kanter
                                          Example of memory ordering causing excitement in the real worldMichael S
                                            Example of memory ordering causing excitement in the real worldDavid Kanter
                                          Example of memory ordering causing excitement in the real worldanon
                                            Example of memory ordering causing excitement in the real worldGabriele Svelto
                                          Example of memory ordering causing excitement in the real worlddmcq
                                        Example of memory ordering causing excitement in the real worldanon
                                          Example of memory ordering causing excitement in the real worldanon
                                        Example of memory ordering causing excitement in the real worlddmcq
                                          Example of memory ordering causing excitement in the real worldanon
                                            Example of memory ordering causing excitement in the real worlddmcq
                                      Store queues in POWER/PowerPC processorsGabriele Svelto
                                        Not sure about that conclusionDavid Kanter
                                          The POWER4 had the same structureGabriele Svelto
                                        Committing stores in program orderPaul A. Clayton
                                          Committing stores in program orderMaynard Handley
                                      Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                        Example of memory ordering causing excitement in the real worldanon
                                          Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                            Example of memory ordering causing excitement in the real worlddmcq
                                            Example of memory ordering causing excitement in the real worldMichael S
                                              Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                            Example of memory ordering causing excitement in the real worldanon
                                              Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                                Example of memory ordering causing excitement in the real worldanon
                                              Example of memory ordering causing excitement in the real worldanon
                                                Example of memory ordering causing excitement in the real worldanon
                                                Example of memory ordering causing excitement in the real worldGabriele Svelto
                                                Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                                  Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                                  Example of memory ordering causing excitement in the real worldanon
                                                    Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                                      Example of memory ordering causing excitement in the real worldMichael S
                                                        Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                                          Example of memory ordering causing excitement in the real worldKonrad Schwarz
                                                            Example of memory ordering causing excitement in the real worlddmcq
                                    Example of memory ordering causing excitement in the real worlddmcq
                          Example of memory ordering causing excitement in the real worldKonrad Schwarz
                      Example of memory ordering causing excitement in the real worldAnonymousse
          Benefit of dynamic hammock predicationsomeotherdude
            Benefit of dynamic hammock predicationMichael S
          Benefit of dynamic hammock predicationPatrick Chase
            SIMD predication is also helpful, of course (NT)Paul A. Clayton
        Power8 branch conversionGabriele Svelto
          isel works for storesPaul A. Clayton
            isel works for storesPatrick Chase
            isel DOES NOT work for storessomeotherdude
              isel DOES NOT work for storesWilco
              Yes it doesPatrick Chase
                Yes it doesvvid
            You don't need isel eitherGabriele Svelto
              You don't need isel eitherPaul A. Clayton
                You don't need isel eitherGabriele Svelto