Support for the TSO memory model on Arm CPUs
Support for the TSO memory model on Arm CPUs
Posted Apr 28, 2024 5:42 UTC (Sun) by anton (subscriber, #25547)Parent article: Support for the TSO memory model on Arm CPUs
You are too lenient on the CPU designers here. They are prone to throw problems over the wall to the software people. E.g., Alpha gave use imprecise exceptions "because of performance". But IA-32 implementations with OoO execution gave us better performance and precise exceptions (and OoO implementations would not become faster if the requirement for precise exceptions was dropped).
I call this attitude of throwing problems over to the software people the "supercomputer attitude", because it's especially rampant in supercomputing where hardware costs still exceed software costs.
Weak memory ordering is just another example of throwing a problem over to software. The hardware people would have loved to have no cache coherency between different CPUs at all. But that was so unusable that they did the next-best thing: weak ordering, where software has to insert synchronizing instructions (that are slow if the hardware is designed to be essentially incoherent) at various places. And then people from the same company that gave us Alpha with not just imprecise exceptions but also an especially weak memory model wrote an advocacy piece that justifies the lack of architectural quality with performance (the magic word that makes lots of people overlook any misfeature).
Now we have CPUs from Intel and AMD which mostly use TSO that are in machines with hundreds of cores. Do they suffer from bad performance? Fujitsu actually designed its A64FX for a supercomputer and implemented TSO, so they obviously know how to implement TSO efficiently (they did not even bother with a weakly ordered mode; they have decades of experience implementing SPARC CPUs which offered both TSO and weak ordering, switchable). Apparently Apple is not quite there yet, as according to the numbers they have an implementation where weak ordering still provides a performance advantage, but at least they offer a TSO mode. I hope that they will improve their implementation such that the performance penalty of TSO mode vanishes. And if ARM really wants to be competition to Intel and AMD in laptops and servers, they need to implement TSO, too, and implement it efficiently.
To come back to the Alpha: On the 21264 they actually implemented precise exceptions AFAICT (it's natural for an OoO implementation and the trapb instruction was as cheap as a noop, because it then was a noop). But Alpha was canceled before they saw the light and made precise exceptions an official feature of a new version of the architecture.
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
