WorksComputer Science
Do Apple M-Series Processors Enforce the Compound Memory Model? Sequential and Parallel Composition of Arm and TSO
Abstract
Apple's M-series processors can run each thread under the Arm memory model or under a TSO model, and threads of both kinds can share memory. This raises two questions of composition that Apple has not answered. Across threads, how does the machine behave as a whole? Within a thread, which Arm instructions play the roles of TSO's loads, stores and atomic read-modify-writes, and how are they ordered between themselves and across other Arm instructions? We propose that both answers are compositions of preserved program order. Across threads, each thread keeps the preserved program order of its own model: a parallel composition. Within a TSO thread, every Arm instruction keeps TSO's order and adds Arm's, and every atomic memory operation (AMO) is locked, as x86's read-modify-writes are: a sequential composition. We test both on an Apple M1 and an Apple M2 running Linux, with 936 litmus tests chosen from the two models' preserved program order, each run 6x10^8 times on each machine. Arm-mode threads follow Arm's official model, TSO-mode threads follow x86-TSO and the sequential composition, and programs that mix the two modes follow the compound model: neither machine shows an outcome these models forbid. Both machines also preserve three orders that these models do not require, and a compare-and-swap whose comparison fails behaves as if it writes back the value it read, which the Arm model does not require. All three orders held in runs up to 40 times longer.
Introduction
Apple’s M-series processors can run any thread under the Arm memory model or under a TSO memory model, and Arm threads and TSO threads can run side by side. This raises two questions of composition. Across threads, the two kinds of thread share memory, and the machine as a whole needs a memory model: a parallel composition. Within a thread, a TSO thread on an Apple core runs Arm instructions that TSO does not define, such as acquire loads, release stores and Arm’s barriers, and a rule must say how they are ordered with the thread’s other accesses: a sequential composition. Apple has specified neither: its documentation says only that the mode bit changes a core’s memory model to “the x86-64 TSO memory model” [4], which defines x86’s own operations but not the Arm instructions x86 lacks, nor threads of both kinds sharing memory.
There is demand for this specification. The Asahi Linux kernel exposes TSO mode per thread, and the x86 emulator FEX-Emu uses it [14, 9]; Apple distributes a Linux patch with the same interface for its translator, Rosetta, in Linux virtual machines [4]; the same interface was declined for mainline Linux, in part because no specification says which memory model the mode implements [13, 8]. Wrenger et al. measured the performance cost of TSO mode on an M1 Ultra [20], and Khayet and Morrison found it typically within 3% and traced the larger slowdowns to Apple’s implementation of the mode [12]; this report concerns which orders the mode preserves. This report proposes a model for each composition and tests both on an Apple M1 and an Apple M2.
Parallel composition. A number of recent works propose the compound memory model for machines on which two memory models share memory [15, 10]. A compound model is not a new memory model: each thread preserves the program order that its own memory model preserves, and the rest of the model is shared by all threads. If the machine enforces it, each ISA’s compiler mappings, and hence each language’s implementation of its synchronization primitives, stay correct after the composition [10]. The NVIDIA Grace-Hopper, which places Arm CPU cores and a PTX GPU on one coherent memory, adheres to the compound model of Arm and PTX for message-passing litmus tests [7]. Apple’s processors are a more direct test, because the same core runs a thread as Arm or as TSO. Figure 1(a) and (b) show message passing under each model alone; in (c) the producer is an Arm thread and the consumer a TSO thread. The compound model forbids the outcome by taking each thread’s order from its own model: the release orders the producer’s stores, and TSO orders the consumer’s loads. With a plain store in place of the release, or with the consumer in Arm mode, the outcome is allowed.

Figure 1. Initially ; rel is STLR, acq ld is LDAR. Columns of Arm threads are shaded blue, of TSO threads orange. Top two rows: message passing, the parallel composition. The outcome shown is forbidden by Arm in (a), by TSO in (b), and by the compound model in (c), where Thread 0 keeps Arm’s order of its two stores and Thread 1 TSO’s order of its two loads. Bottom row: store buffering on TSO threads, the sequential composition. x86-TSO allows the outcome of both, since it does not order a store before a later load. The sequential composition forbids (d), because Arm orders a release store before a later LDAR, and allows (e). Neither machine shows (a)–(d), and both show (e), times on the M1 and on the M2, in runs of the tests of sections 5 to 7; (b) and (c) are run as shown, and in (a), (d) and (e) one thread’s annotations are replaced by a DMB.
Sequential composition. A TSO thread on an Apple core runs Arm instructions. An Arm load or store, whatever its annotation, is at least a TSO load or store, and the full DMB is MFENCE. Acquire loads and release stores also carry orders x86 does not have, and the barriers DMB LD, DMB ST and DSB have no x86 counterpart. We propose that an Arm instruction on a TSO thread keeps TSO’s order and adds Arm’s: two accesses are ordered if either model orders them. TSO orders every pair of accesses except a store followed by a load, so Arm’s orders can add only to such a pair. On a TSO thread, a release store is therefore also ordered before a later LDAR, which a plain store is not. Figure 1(d) and (e) show the difference: with acquire loads, store buffering is forbidden with release stores and allowed with plain ones. We also propose that every atomic memory operation (AMO) is locked, as an x86 read-modify-write (RMW) is, and so acts as a fence. Arm’s other RMW, a load-exclusive followed by a store-exclusive (an LL/SC pair), is atomic but not locked (§ 3.1). We propose that the compound model of Arm and TSO is a parallel composition, whose TSO side is itself a sequential composition.
Questions. Whether Apple’s processors follow this model comes down to three questions: one for each mode, and one for programs that mix them.
Which TSO does TSO mode implement, and does it follow the sequential composition? First, on the operations x86 has: is it x86-TSO [19], in which a load may read its own thread’s store from the store buffer before other threads see it, or a stronger variant such as the IBM 370 model [1], in which it may not? Second, on a TSO-mode thread, do the other Arm instructions behave as the sequential composition predicts?
Do programs that mix Arm-mode and TSO-mode threads follow the compound model?
Method. These questions were first examined around 2024, on an M1 Mac mini under macOS, using the third-party TSOEnabler kernel extension to put threads into TSO mode [21], which reported the outcome forbidden by the compound model in mixed message passing in both directions: an Arm producer with DMB ST and a TSO consumer, and a TSO producer and an Arm consumer with DMB LD. Here we use the Asahi Linux interface instead, on an M1 Mac mini and an M2 MacBook Air, and run 936 litmus tests with an otherwise unmodified litmus7 [2] (§ 4). The tests are chosen from the preserved program order of Arm and of the sequential composition. Every row of each is tested in a two-thread test, with the other thread in each mode. Three- and four-thread tests run under every assignment of modes, with the doubtful mechanisms (§ 4.1): on Arm threads, dependencies, acquire loads, release stores and DMB ST; on TSO threads, plain accesses, DMB as MFENCE, and acquire loads and release stores. Further tests ask whether a thread reads its own store early, and whether RMWs are atomic and which are locked. Every test runs times on each machine. Our suite includes both tests reported in [21]. Neither machine showed the outcome in runs of either test, although it appeared in both once the barrier was removed (§ 7). The two setups differ in operating system and in how the TSO bit is set: macOS with a kernel extension there, Linux with a per-thread system call here.
Answers.
Yes. No outcome the Arm model forbids was observed in Arm mode on either machine.
TSO mode implements x86-TSO rather than a stronger variant: a load reads its own thread’s store early, as x86-TSO allows and IBM 370 does not. On a TSO-mode thread the other Arm instructions follow the sequential composition.
Yes. No outcome the compound model forbids was observed on either machine.
Both machines are stronger than these models in two ways. They preserve three orders that none of the models requires: an acquire load never reads its own thread’s store early, DMB LD and DSB LD order a store before every later access, and on Arm threads a load is ordered before a later store. A fourth order held in all runs: the write of an acquire AMO is ordered before later accesses (Figure 3(b)). In runs about 40 times longer, however, the order was violated on both machines, albeit rarely (§ 8), so we do not add it. And a CAS whose comparison fails behaves as if it writes back the value it read, which makes a failing CASAL a fence (§ 5). These describe the two machines, not what either ISA promises, so we add them to separate models of the machines (§ 3.4) and leave the proposal unchanged.

Figure 3. Orders that atomicity gives an RMW. (a) Release RMWs in place of the loads: Arm’s type-3 atomicity forbids the outcome, with the release orders, although no rule of preserved program order orders a store before a later RMW’s read. (b) Acquire RMWs in place of the stores: Arm allows the outcome; a type-1 RMW, such as x86’s locked RMW, forbids it. Initially all locations are 0.
Background: Arm and x86-TSO
This section recalls the Arm and x86-TSO memory models. § 3 proposes a theory of their sequential and parallel composition, and § 5 to § 7 test it.
Executions
We use the axiomatic framework of Alglave et al. [3]. An execution is a set of memory events (reads R, writes W and fences) with the usual relations: program order po, reads-from rf, coherence order co, and from-read . A suffix e restricts a relation to events of different threads, as in rfe, coe and fre. The relation rmw pairs the read and the write of a read-modify-write (RMW, § 2.4).
Preserved Program Order
Informally, Arm and x86-TSO both present the threads with an atomic memory: once a write is visible to another thread, it is visible to every thread. (Formally, both are other-multi-copy atomic, § 2.3.) What distinguishes them is which pairs of a thread’s accesses they keep in program order, their preserved program order (ppo). A pair not in ppo may appear to other threads in either order. We include in ppo every mechanism a model provides for ordering two accesses of a thread: annotations on the accesses, barriers and fences between them, dependencies, and RMWs; and, in TSO, the orders it keeps by default. Table 1 lists them for accesses to different addresses. Every model in this report, the compositions included, has the same axioms and differs from the others only in ppo.
| Order | Arm | x86-TSO |
| load load | first is acquire; DMB, DMB LD, DSB or DSB LD between; second address-dependent on first, or after a control dependency and ISB | always |
| load store | first is acquire; second is release; DMB, DMB LD, DSB or DSB LD between; second dependent on first | always |
| store store | second is release; DMB, DMB ST, DSB or DSB ST between | always |
| store load | first is release and second is LDar or LDAXr; DMB, DSB or DSB ST between | MFENCE or a locked RMW between; either is part of a locked RMW |
Table 1. Preserved program order (ppo) in Arm and x86-TSO, for a first access and a later second access to a different address. RMWs add the orders of section 2.4.
Table 2.
Arm. A release store is ordered after every earlier access, and an acquire load before every later access; a release store is also ordered before a later LDAR (an RCsc acquire), though not before a later LDAPR (an RCpc acquire) [17]. The full barriers DMB and DSB order every earlier access before every later one. DMB LD and DSB LD order earlier loads before every later access; DMB ST orders earlier stores before later stores, and DSB ST orders earlier stores before every later access. Address, data and control dependencies order a load before the dependent access, in the cases the architecture lists. Any other pair of accesses to different addresses may be reordered.
x86-TSO. Every pair is preserved except a store followed by a load [19]. An MFENCE between the two restores that order, and so does a locked RMW, between them or as one of the two (section 2.4).
The Axioms
The three axioms are the following; the third depends on ppo, which differs for x86-TSO and Arm.
(sc-per-location)
(atomicity)
(order)
The first says that the accesses to each address agree with a total order on that address. The second says that no other thread’s write comes between the read and the write of an RMW. The third says that the orders a thread preserves are the orders other threads observe: ppo, together with communication between threads, never forms a cycle. herd’s x86-TSO model writes co and fr in full in the third axiom; the internal parts are already in TSO’s ppo, so the two forms agree.
The order axiom uses rfe rather than rf, and this fixes the models’ degree of multi-copy atomicity. There are three degrees. In a multi-copy atomic model, such as the IBM 370 [1], a write becomes visible to all threads at the same time, its own thread included; the order axiom would use rf. In an other-multi-copy atomic model, a thread may read its own write early, from its store buffer, but once the write is visible to one other thread it is visible to all of them; the order axiom uses rfe. Arm and x86-TSO are both of this kind. In a non-multi-copy atomic model, such as Power, other threads may see a write at different times. We do not consider such models.
Figure 2 illustrates the two halves of other-multi-copy atomicity. IRIW asks whether two readers can see two independent writes in opposite orders. Neither model allows it once each reader’s two loads are ordered: TSO orders them by default, Arm when they are acquire loads. Arm allows the outcome with plain loads only because it may reorder them. n6 [19] asks whether a thread may read its own write before other threads see it. Thread 0 reads its own write of x and then reads y as 0, while Thread 1’s write x = 2 precedes x = 1 in coherence. Both models allow this. In TSO, Thread 0 may read x = 1 from its store buffer before the write is visible to Thread 1, and since TSO orders every other pair of accesses here, this is the only way to get the outcome. (Arm allows it even without this, since it may reorder Thread 0’s loads.) With rf in place of rfe in the order axiom, TSO forbids the outcome.

Figure 2. Other-multi-copy atomicity. (a) Once each reader’s loads are ordered, every thread sees the two writes in one order. (b) A thread may read its own write before other threads see it, which full multi-copy atomicity forbids. Initially all locations are 0; in (b) the final value of x is 1.
Read-Modify-Writes
An RMW is an instruction, or a pair of instructions, that reads a location and writes it atomically. It contributes a read and a write related by rmw.
x86. The RMWs are the locked instructions: XCHG with a memory operand, and the read-modify-write instructions that take a LOCK prefix (LOCK CMPXCHG, LOCK XADD, LOCK ADD, etc.). The prefix is allowed only on instructions that both read and write memory, so there is no locked load or locked store, and every locked instruction writes: a CMPXCHG whose comparison fails writes back the value it read [11]. In the terms of [18], a locked RMW is type-1: no memory event comes between its read and its write. With TSO’s ppo this makes it a full fence.
Arm. There are two kinds, each with optional acquire, release, or both. An AMO (atomic memory operation) is a single instruction: SWP, CAS, or one of the LDop instructions (LDADD, LDSET, LDCLR, etc.). An LL/SC pair is a load-exclusive followed by a store-exclusive (LDXR and STXR, with LDAXR and STLXR as the acquire and release forms); the store-exclusive fails if another write to the location may have intervened, and the program then usually retries the pair. SWP and LDop always write. A CAS whose comparison fails either writes back the value it read or does not write at all; Arm leaves the choice to the implementation [5].
Arm gives both kinds the same atomicity axiom, above, which in the terms of [18] is type-3: other threads’ writes to the location cannot come between the read and the write, but their reads can. Arm adds three orders for RMWs. The read of an RMW is ordered before its write. If a later acquire load of the same thread reads the RMW’s own write, the RMW’s read is ordered before that load. And the write of an AMO with both acquire and release (SWPAL, LDADDAL, etc.) is ordered before every later access, which with the release order makes such an AMO a full fence.
Atomicity also orders accesses that no rule of preserved program order names. Rajaram et al. [18] first observed such orders, for TSO, and they matter for Arm too, as Figure 3 shows. In (a), each thread stores and then runs a release RMW that reads 0. The release orders the store before the RMW’s write. Because the RMW read 0, atomicity puts the other thread’s store to that location after the RMW’s write in coherence. The two release orders and the two coherence edges form a cycle, so the outcome is forbidden, although no rule orders the store before the RMW’s read. The same holds whenever something orders a store before an RMW’s write, such as a DMB ST between them or, on a TSO thread, TSO’s order of two stores; for an LL/SC pair, only if the store-exclusive succeeds. In (b), each thread runs an acquire RMW and then a load. The acquire orders the RMW’s read before the load but not its write, and type-3 atomicity does not help, since it keeps other threads’ writes, not their reads, out from between the RMW’s read and write. Arm therefore allows the outcome. Recall that in a type-1 RMW, such as x86’s locked RMWs, nothing comes between the read and the write, so the load, ordered after the read, is also ordered after the write, and the outcome is forbidden.
Throughout the report, means either kind, and and distinguish them.
Composing Arm and TSO
On a thread in TSO mode, an Apple core runs plain loads and stores, which presumably have their x86-TSO meaning, but also Arm instructions x86 does not have, such as acquire loads and release stores. How are these ordered with respect to the plain accesses and to each other? And how do the instructions of a thread in Arm mode interact with those of a thread in TSO mode? We answer the first with the sequential composition, which gives the preserved program order of a TSO thread, and the second with the parallel composition, the compound model, which gives the behavior of a program whose threads run in both modes. We then describe how the models are encoded in herd. We also encode the Apple models, which add the orders both machines are found to preserve (three orders and the failing CAS, section 3.4).
Sequential Composition: Arm Instructions on a TSO Thread
x86-TSO is defined for four operations: loads, stores, locked RMWs and MFENCE. A TSO thread on an Apple core runs Arm instructions instead. Each of the four has Arm instructions that play its role: Arm’s loads and stores are TSO loads and stores, an AMO plays the role of a locked RMW, and the full DMB is MFENCE. Some of these instructions also carry orders that x86 does not have: acquire loads (LDAPR, LDAR, LDAXR) and release stores (STLR, STLXR). Others have no x86 role at all: the barriers DMB LD, DMB ST and DSB. Neither TSO nor Apple says how these combine with TSO’s orders. For every pair of accesses of a TSO thread, in program order, the sequential composition says whether other threads observe the two in that order. It has three parts: 1) every access keeps TSO’s order, 2) an AMO is locked, and 3) Arm’s orders are added.
TSO’s orders. First, every access of a TSO thread is a TSO access, whatever its annotation. An instruction that reads memory performs a load and one that writes memory performs a store: LDR, LDAPR, LDAR and the load-exclusives are loads, and STR, STLR and the store-exclusives are stores. TSO orders every pair of these loads and stores except a store followed by a load. Locked AMOs. Second, an AMO performs a load followed by a store to the same location, and is locked, as x86’s RMWs are. Because TSO already orders every pair of accesses except a store followed by a load, locking adds two orders: every access before the AMO is ordered before the AMO’s load, and the AMO’s store is ordered before every access after it. Every access before the AMO is then ordered before every access after it, so the AMO acts as a fence. A CAS whose comparison fails is also locked. On x86, a failed LOCK CMPXCHG writes back the value it read, so it is an ordinary locked RMW. An Arm CAS whose comparison fails need not write (§ 2.4), but on a TSO thread it is still a fence: a store before it is ordered before its load because it is locked, and its load is ordered before every later access because TSO orders a load before every later access.
An LL/SC pair is a load and a store, atomic as Arm defines it, but not locked. Atomicity still forbids one more outcome. Recall from § 2.4 that if a store is ordered before the write of an RMW, the RMW’s read behaves as if it were ordered after the store. TSO orders a store before the store-exclusive of a later pair, so when the store-exclusive succeeds, the pair’s load cannot be observed before the earlier store. It is not an order of , and it does not make the pair a fence: a load after the pair can still be observed before the earlier store (§ 6).
Arm’s orders. Third, we add every order that Arm gives the same instructions (Table 1 and § 2.4). A pair of accesses of a TSO thread is ordered if TSO orders it or Arm orders it, and otherwise it is not:
where is TSO’s order above: every pair of accesses except a store followed by a load, together with a store before a later AMO and an AMO before a later load, and a store before a later load across a full DMB (MFENCE). We call this the sequential composition of x86-TSO and Arm: the two models are composed within one thread, whereas the compound model (§ 3.2) composes them across threads.
TSO already orders every pair except a store followed by a load, so Arm’s orders can add only to such a pair. Arm orders a store before a later load in two ways: by a full DMB, a DSB or a DSB ST between them, or when the store is a release (STLR, STLXR) and the load an RCsc acquire (LDAR, LDAXR). Of these, only the full DMB has an x86 counterpart, MFENCE, so x86-TSO already has its order. The sequential composition therefore adds to x86-TSO the order of a store before a later load across a DSB or a DSB ST, and of a release store before a later LDAR or LDAXR.
The release case needs care, because Arm’s release and acquire each give two orders. A release store is ordered after every earlier access, and also before a later LDAR or LDAXR. An acquire load is ordered before every later access, and, if it is LDAR or LDAXR, also after an earlier release store. On a TSO thread every store already has the first order of a release, and every load the first order of an acquire. Neither has the second order unless it is annotated, since TSO never orders a store before a later load. So STLR followed by LDAR is ordered, but STR followed by LDAR is not, and neither is STLR followed by LDR or LDAPR. tbl:2 lists every case.
The composition is a union of orders, not a reinterpretation of instructions. Two other readings are possible, and both machines reject them (§ 6). In one, a TSO store is a release, since TSO orders it after every earlier access; Arm would then order STR before a later LDAR. In the other, an annotated access follows Arm alone; a load could then be reordered with a later LDAR, which Arm allows. Neither holds: a TSO store has only the first order of a release, and an annotation adds Arm’s orders without removing TSO’s.
In summary, the sequential composition orders every Arm instruction on a TSO thread by the union of the preserved program orders of x86-TSO and Arm, with one addition: every AMO is
| First access, then second | Ordered | By |
| load load, load store, store store, any annotations | always | TSO |
| store load, either an AMO or an AMO between | yes | TSO: AMOs are locked |
| store load, STLR or STLXR then LDAR or LDAXR | yes | Arm: release, RCsc acquire |
| store load, DMB, DSB or DSB ST between | yes | Arm: barrier |
| store load, otherwise (e.g. STR then LDAR; STLR then LDR or LDAPR; DMB LD or DMB ST between) | no |
caption: tbl:2: The sequential composition: preserved program order on a TSO thread, for a first access and a later second access to a different address.
:::
locked, as an x86 RMW is. On an Arm thread only an AMO with both acquire and release, and only if it writes, is a fence; on a TSO thread every AMO is.
Parallel Composition: The Compound Model
The compound model of Arm and TSO keeps each thread’s own preserved program order and shares everything else [15, 10]. Let be Arm’s ppo restricted to pairs of events on Arm threads, and the sequential composition above restricted to pairs on TSO threads. The compound model has the same three axioms, with
as the order axiom. Sc-per-location and atomicity are unchanged and apply to all threads. The parallel composition is thus built on the sequential one: each TSO thread of the compound model runs Arm instructions under the sequential composition.
Figure 4 shows the compound model on mixed versions of the tests of fig. 2. In IRIW with TSO writers and Arm readers, the readers need acquire loads for the outcome to be forbidden, exactly as when every thread is Arm; with plain Arm readers it is allowed. In n6 with a TSO reader and an Arm writer whose second store is a release, the outcome remains allowed: the TSO thread may still read its own write early, and this is the only way to reach the outcome.
| Test | Threads | Compound model |
| IRIW | writers TSO, readers Arm with acquire loads | forbidden |
| IRIW | writers TSO, readers Arm with plain loads | allowed |
| IRIW | writers Arm, readers TSO with plain loads | forbidden |
| n6 | Thread 0 TSO, Thread 1 Arm with a release store | allowed |
Table 4. Figure 4: The compound model on mixed tests. Verdicts are from herd.
Encoding in herd
Herd ships an Arm model and an x86-TSO model, but they are written in different styles over different instruction sets, and the compound model has to choose a ppo per thread. We therefore re-encode both in the three-axiom form of section 2.3, over AArch64 instructions, so that the models differ only in ppo (fig. 5). Arm’s ppo (arm-ppo.cat, following [17]) and the sequential composition (tso-ppo.cat) are each written once, as relations over all events. tso-ppo.cat writes the composition literally, as the union of TSO’s orders over every load and store, with AMOs locked, and Arm’s.
Three short files then say which ppo applies where: arm.cat applies Arm’s to every thread, tso.cat applies the sequential composition to every thread, and compound.cat applies Arm’s to Arm threads and the sequential composition to TSO threads. Tests are written in AArch64 syntax, and a thread whose first instruction is ISB runs under TSO.
Because the encoding is our own, we checked it against herd’s models. On all 135 tests whose threads all run in Arm mode, arm.cat gives the same verdict as herd’s own Arm model (aarch64.cat). The 18 tests whose threads all run in TSO mode and whose instructions are only LDR, STR and DMB are x86 programs; we translate each into x86 syntax (MOV for loads and stores, MFENCE for DMB), and herd’s x86-TSO model (x86tso.cat) on the translation gives the same verdict as tso.cat on the original. On tests whose threads all run in one mode, compound.cat gives the same verdict as arm.cat or tso.cat.
let CASR = domain([Exp & R]; iico_data+; [PRED]) (* read of a CAS, failed or not *)
let Locked = M & (domain(amo) | range(amo) | CASR)
let x86-ppo = [M]; (po \ (W * R)); [M] (* all but W->R *)
| [M]; po; [DMB-FULL]; po; [M] (* MFENCE *)
| [W]; po; [Locked & R] (* locked RMW *)
| [Locked & W]; po; [R] (* acts as a fence *)
let tso-ppo-all = x86-ppo | arm-ppo-all
let obs = rfe | coe | fre (* communication *)
acyclic po-loc | rf | co | fr as sc-per-location
empty rmw & (fre; coe) as atomicity
acyclic ppo | obs as order
let MARK = ISB & ~range(po) (* a thread starting with ISB runs TSO *)
let TSO = MARK | range([MARK]; po)
let ARM = ~TSO
let ppo = [ARM]; arm-ppo-all; [ARM] | [TSO]; tso-ppo-all; [TSO]

Figure 5. The herd encoding of the proposal, against which every verdict in sections 5 to 7 is computed. Top: the sequential composition (tso-ppo.cat), x86-TSO’s order with every AMO and every CAS read locked, united with Arm’s. Middle: the three axioms of section 2.3, shared by every model (axioms.cat). Bottom: the compound model (compound.cat), which applies Arm’s order to Arm threads and the sequential composition to TSO threads. Table 2 states the same orders in prose; the listing is the exact definition, for readers who want to check it or run herd. Arm’s preserved program order (arm-ppo.cat) follows [17]; all model files are in the artifact (section 10).
The Apple Models
The experiments of sections 5 to 7 find that both machines preserve three orders that neither Arm nor the sequential composition requires. We define them here, so that all the models are in one place; the evidence for each is in those sections. We keep an order only if both machines enforce it, and add each to every thread, Arm or TSO:
A1 a store and a later acquire load (LDAPR, LDAR, LDAXR) of the same address are ordered: an acquire load never reads its own thread’s store early (LDAXR tested on TSO threads only);
A2 DMB LD and DSB LD order a store before every later access;
A3 a load is ordered before a later store. Arm already orders a load before every access after a DMB LD, so with A2 a DMB LD is a full barrier. A3 adds nothing on a TSO thread, where TSO already preserves load store; it matters only on Arm threads. The Apple models also treat a CAS as an AMO that always writes: one whose comparison fails writes back the value it read (section 5.3). This too adds nothing on a TSO thread, where a failing CAS is already locked. arm-apple.cat, tso-apple.cat and compound-apple.cat are arm.cat, tso.cat and compound.cat with the three added to each thread’s ppo and a failing CAS writing back; nothing else changes (Figure 6). On tests whose threads all run in one mode, compound-apple.cat gives the same verdict as arm-apple.cat or tso-apple.cat. The first three models are the proposal; the last three describe the two machines.

Figure 6. The orders both machines preserve beyond the models (apple-ppo.cat). The Apple models add apple-all to each thread’s ppo, and add to the axioms the rule cas-writes, which says that a CAS writes even when its comparison fails, writing back the value it read.
let apple-all = [W]; po-loc; [R & (A | Q)] (* A1 *)
| [W]; po; [DMB-LD | DSB-LD]; po; [M] (* A2 *)
| [R]; po; [W] (* A3 *)
(* A CAS is an AMO that always writes:
one whose comparison fails writes back the value it read. *)
let CASR = domain([Exp & R]; iico_data+; [PRED])
empty CASR \ domain(amo) as cas-writes
Methodology
The machines. We test two machines. The first is an Apple Mac mini (M1, 2020) in the GCC Compile Farm, running Debian with an Asahi Linux 6.5 kernel. The M1 has four performance cores (Firestorm, up to 3.2 GHz) and four efficiency cores (Icestorm, up to 2.06 GHz), and 8 GB of memory. The second is an Apple MacBook Air (M2), running Fedora Asahi Linux with a 7.2 kernel. The M2 has four performance cores (Avalanche) and four efficiency cores (Blizzard). For the long runs of sections 5.3 and 8 we also use macOS 13.5, on the M2 and on a Mac Studio (M2 Max, 2023). macOS offers no call to set a thread’s mode or to pin a thread, so under macOS we run only tests whose threads are all in Arm mode, with threads unpinned.
The TSO bit. Apple cores have a control bit that switches the core’s memory model to TSO. Linux exposes it per thread through a prctl call, PR_SET_MEM_MODEL, and saves and restores it when it switches threads. Each test thread sets its mode as its first action and reads it back with PR_GET_MEM_MODEL; a mismatch aborts the run. As a check that the bit takes effect, message passing with plain accesses never appears between two TSO threads, but appears as soon as either thread is in Arm mode.
Choosing the Tests
The models of sections 2 and 3 differ only in each thread’s preserved program order, and share three axioms (section 2.3). The tests ask three questions. Does each thread keep the preserved program order of its mode? Do writes propagate as the order axiom says? Are RMWs atomic, and which are locked?
Preserved program order. We expand the preserved program order of Arm and of the sequential composition into a table. A row is a mode, a kind of pair (store store, load load, load store or store load) and a mechanism: the forms of the two accesses (LDR, LDAPR, LDAR; STR, STLR), a barrier between plain accesses (DMB, DSB or their LD and ST forms), or a dependency (address, data, control, or control and ISB). Both modes run the same Arm instructions, so each has the same 56 mechanisms, 112 rows in all. In Arm mode their verdicts are those of the Arm column of table 1; in TSO mode, those of table 2. Each row is tested in the two-thread test in which its pair is one thread’s two accesses: MP for store store (the writer) and load load (the reader), LB for load store, and SB for store load. The row’s pair is one edge of the cycle, and the other thread’s edge gets a mechanism its model orders for certain: a full DMB on an Arm thread; on a TSO thread nothing, since TSO already orders it, except in SB, where that edge is a store followed by a load and gets a DMB. The outcome is thus forbidden exactly when the row orders its pair. The other thread runs once in each mode.
Propagation. The order axiom fixes how writes propagate between threads, and three properties follow from it. First, a write seen by one other thread is seen by all, the first half of other-multi-copy atomicity (§ 2.3); WRC, RWC and IRIW test it. Second, order carries along a chain of threads, which Power calls cumulativity; ISA2, message passing through three threads, tests it. We run each of the four shapes under every assignment of modes to its threads, including threads that only write. Each edge is ordered by one of the doubtful mechanisms, the weakest that should order it, and every combination is run. On an Arm thread the doubtful mechanisms are a dependency, LDAPR, STLR or DMB ST, and for a store followed by a load, STLR then LDAR. On a TSO thread they are TSO’s own order or the annotations LDAPR and STLR, which x86 does not have, and for a store followed by a load, DMB (as MFENCE) or STLR then LDAR. Full barriers are not among the doubtful mechanisms: they are built to order other threads’ writes, so a weaker mechanism would fail first. Each edge also has a control, in which that edge is plain and the other edges are ordered.
Third, a thread may read its own store early, the other half of other-multi-copy atomicity, as x86-TSO allows and the multi-copy-atomic IBM 370 does not. We test it with n6 [19] and n7 [16], written by hand, in which a thread reads back its own store. We vary the store (STR, STLR, STXR) and the load that reads it back (LDR, LDAPR, LDAR), and run the reading thread in Arm mode and in TSO mode.
RMWs. Atomicity and locking act on a store followed by a load, so the RMW tests are Dekker tests: SB with RMWs. On a TSO thread we test every store load pair in which either access is an exclusive or an AMO, 100 pairs in all, each in SB as the store load rows are. In six of them a store precedes an LL/SC pair that no release orders; atomicity, not preserved program order, forbids their outcome (§ 3.1). In each mode, hand-written Dekker tests replace each thread’s load, its store, or neither by an RMW, the last as a candidate fence, in each AMO and LL/SC form.
Controls. A forbidden outcome that never appears is evidence only if the test could have shown it. Each generated forbidden test therefore has a control, an allowed test that differs from it only at one pair: that pair left plain or, where TSO orders the pair whatever the mechanism, that thread in Arm mode. A machine enforces the pair if the forbidden outcome never appears and the control’s does.
Coverage and verdicts. A script checks coverage: every row and every RMW pair has a test with a partner of each mode, every combination of the doubtful mechanisms runs under every assignment of modes, every generated forbidden test names an allowed control, and herd’s verdict for every test agrees with its row. In all there are 936 tests, 658 generated and 278 written by hand. herd gives each the verdict of the Arm model, the sequential composition, the compound model and herd’s own Arm model, and, for the x86 programs, whose TSO threads use only plain accesses and DMB, of herd’s x86-TSO model, after translating them to x86. The results are reported by mode: section 5 all Arm, section 6 all TSO, and section 7 mixed.
Running the Tests
We run every test with litmus7 [2], unmodified except for the per-thread mode call, in six configurations: two synchronization modes of litmus7, user and timebase, times three placements of the threads, all on performance cores, all on efficiency cores, and spread across both clusters. Each configuration runs iterations, so every test runs times on each machine. No configuration is redundant: most outcomes seen ten times or fewer appeared in only one of them, and which one differs from shape to shape. For LL/SC pairs we count only the iterations in which every store-exclusive succeeds. One difference in method concerns the M2. When a test’s threads may run on both clusters, the Linux scheduler on the M2 placed two of litmus7’s spinning threads on one core, which slowed those runs by two to three orders of magnitude. On the M2 we therefore pin each thread of such a run to the least loaded core of the run’s set, breaking ties at random, so that which thread runs on which kind of core varies between runs. Runs on a single cluster are not pinned, and the M1 runs are not pinned. One script runs the whole set on either machine.
Reading the Results
The rarest outcomes we observe occur about once in runs, so a zero is not proof that an outcome is forbidden. A zero for a forbidden outcome therefore counts only if its control was observed on the same machine (for a hand-written test, the closest allowed test of its shape); otherwise we report the test as not exercised. The exception is load buffering, which neither machine shows in any form. Its tests have no control, so we report their outcomes as forbidden by A3 (§ 3.4), which rests not on a control but on how cores are typically built: they commit instructions in order and make a store visible only after it commits, so a store cannot be seen before an earlier load. In runs 40 times longer, load buffering still never appeared, although in millions of iterations its two threads ran their accesses at the same time, as shown by both loads reading 0 (§ 8). A control that never appears is either explained by an order the machines add or reported as rare. Rare counts vary sevenfold between runs of the same test, so the tables give only orders of magnitude.
Arm Mode
Does Arm mode follow the Arm model? It does: on neither machine was an outcome the Arm model forbids observed, in any of the 135 tests whose threads all run in Arm mode. Both machines are slightly stronger than the model, in the three orders A1–A3 of § 3.4 and in how a failing CAS behaves. We take the three questions of § 4.1 in turn: preserved program order, propagation, and RMWs.
Preserved Program Order
Table 3 gives every Arm row of preserved program order, each in its two-thread test (§ 4.1) with the other thread also in Arm mode. In every row that Arm orders, the outcome never appeared on either machine. A zero is evidence only if the row’s control (last column) appears (section 4.3). The rows that Arm does not order show how often each kind of pair is reordered. A store and a later load are reordered to times in . Two loads are reordered tens to hundreds of times on the M1 and at most tens of times on the M2. Two stores are reordered hundreds of times on the M1 and at most tens of times on the M2 (section 7.1). A load and a later store are never reordered, in any row of either mode; this is why we add A3, a load ordered before a later store. Load buffering thus has no control, and that it never appears rests on the microarchitectural argument of section 4.3: cores typically commit instructions in order and make a store visible only after it commits, so a store cannot be seen before an earlier load.
A barrier that orders loads only. Arm’s DMB LD and DSB LD order earlier loads before later accesses, and nothing else. With either barrier between a store and a later load, the outcome never appears, while every other unordered store load row appears times or more. We therefore add A2: these barriers also order a store before every later access, which makes them full barriers. With either barrier between two stores the outcome never appears either, as A2 predicts.
Reading a thread’s own store. The last rows of table 3 are n7 tests of Owens et al. [16]: a thread stores x, reads it back, and then reads y, with the two loads ordered by an acquire or an address dependency; an observer reads y and then x. The outcome appears only if the read-back takes its value from the thread’s own store before the store is visible to other threads, that is, if the load reads its own store early. Arm forbids this only for a release store followed by an LDAR, and allows it for every other pair. With a plain load, both machines show it, whether the store is plain, a release or a store-exclusive, to times. With an acquire load, LDAPR or LDAR, they never do, whatever the store. We therefore add A1: a store is ordered before a later acquire load of the same address, so that an acquire load never reads its own thread’s store early.
Zeros we do not explain. Two unordered rows never appear and A1–A3 do not account for them: STLR followed by STR, and DSB ST between two loads. Both are pairs the machines rarely reorder even when they are plain: two plain stores at most hundreds of times on the M1 and at most tens on the M2, and two plain loads hundreds of times on the M1 and at most tens on the M2. A zero in a row whose plain form is this rare could be chance, so we do not add an order for either row.
Three and Four Threads
| Shape | Forbidden tests | Forbidden seen | Allowed tests | controls M1 | controls M2 |
| RWC | 2 | 0 | 2 | – | – |
| IRIW | 4 | 0 | 2 | – | – |
| WRC | 5 | 0 | 1 | ||
| ISA2 | 9 | 0 | 2 | – |
Table 4 (PDF p. 15). WRC, ISA2, RWC and IRIW with every thread in Arm mode, under every combination of the doubtful mechanisms (§ 4.1), iterations of each test on each machine. Forbidden by the Arm model with A1–A3. A control is a forbidden test with one edge left unordered; controls that A3 forbids are omitted, and the range spans the shape’s controls. Entries as in table 3.
Table 4 gives WRC, ISA2, RWC and IRIW with every thread in Arm mode, under every combination of the doubtful mechanisms: address and data dependencies, LDAPR, STLR and DMB ST (§ 4.1). None of the forbidden outcomes was observed. RWC and IRIW are well exercised: with one edge left unordered, the outcome appears to times. WRC and ISA2 are exercised far less: their controls appeared only a few times, WRC only on the M1 and ISA2 only on the M2.
RMWs
Recall from section 2.4 and Figure 3 the two orders atomicity gives an RMW: Arm’s type-3 atomicity orders a store before a later release RMW’s read, and type-1 atomicity would also order an acquire RMW’s write before later accesses, which Arm states only for AMOs with both acquire and release. We test RMWs in three forms of Dekker (Table 5): the RMW replaces each thread’s load, or its store, or it accesses a third location between the store and the load, as a candidate fence.
| Dekker: the RMW | Ordering | AMO | AMO | AMO | LL/SC pair | LL/SC pair | LL/SC pair |
| Arm | M1 | M2 | Arm | M1 | M2 | ||
| replaces the load | release | forbidden | 0 | 0 | forbidden | 0 | 0 |
| acquire | allowed | allowed | |||||
| replaces the store | release | allowed | allowed | ||||
| acquire | allowed | allowed | |||||
| both | forbidden | 0 | 0 | allowed | |||
| as a fence | release | allowed | allowed | ||||
| acquire | allowed | allowed | |||||
| both | forbidden | 0 | 0 | allowed |
Table 5. Dekker with RMWs, both threads in Arm mode: the RMW replaces each thread’s load (STR x; RMW y), its store (RMW x; LDR y), or a third location between the two (STR x; RMW z; LDR y). The AMO is SWP; where the RMW replaces the store, also LDADD and CAS, whose rows agree. The LL/SC pair is LDXR/STXR, with LDAXR for acquire and STLXR for release. For LL/SC pairs only runs in which both store-exclusives succeed are counted, to . Entries as in Table 3.
| Pair | Mechanism | Shape | Arm | M1 | M2 | Control: M1 / M2 |
| store → store | STR;STLR, STLR;STLR, DMB, DMB ST, DSB, DSB ST (6) | MP | ordered | plain: / {sup}†`; TSO partner: / | ||
| plain | MP | not ordered | {sup}†` | |||
| STLR;STR | MP | not ordered | {sup}†` | {sup}†` | ||
| DMB LD, DSB LD | MP | not ordered | (A2) | (A2) | ||
| load → load | acquire first, DMB, DMB LD, DSB, DSB LD, address dependency, control dependency and ISB (12) | MP | ordered | plain: / | ||
| plain; LDR;LDAPR; LDR;LDAR; DMB ST | MP | not ordered | – | |||
| control dependency | MP | not ordered | ||||
| DSB ST | MP | not ordered | {sup}†` | {sup}†` | ||
| load → store | release or acquire, DMB, DMB LD, DSB, DSB LD, dependencies (13) | LB | ordered | plain: (A3) / (A3) | ||
| plain, DMB ST, DSB ST | LB | not ordered | (A3) | (A3) | ||
| store → load | STLR;LDAR, DMB, DSB, DSB ST (4) | SB | ordered | plain: / | ||
| plain; STR;LDAPR; STR;LDAR; DMB ST | SB | not ordered | – | |||
| STLR;LDR; STLR;LDAPR | SB | not ordered | – | – | ||
| DMB LD, DSB LD | SB | not ordered | (A2) | (A2) | ||
| store → read-back | STLR;LDAR | n7 | ordered | STLR;LDR: / | ||
| STR;LDR | n7 | not ordered | ||||
| STLR;LDR | n7 | not ordered | ||||
| STXR;LDR | n7 | not ordered | – | |||
| STR, STLR or STXR, then LDAPR or LDAR | n7 | not ordered | (A1) | (A1) |
Table 3. Table 3: The Arm rows of preserved program order, every thread in Arm mode, each test run times on each machine. An entry is the order of magnitude of the number of times the outcome appeared (: from to ; a range spans the row’s tests). An ordered row’s control is the same test without its ordering: plain accesses, with no barrier or dependency; for n7, LDR in place of LDAR. The store → store control is also given with a TSO-mode partner, the only partner with which it appeared on the M2 (section 7.1). Shading: and , the machines agree with the model; (A2), allowed by the model but never seen, and forbidden by A2 (section 3.4); {sup}†`, allowed but never seen, and no order of the machines forbids it.
The release case. With a release RMW in place of each load, as in Figure 3(a), the outcome is forbidden by the Arm model through atomicity (§ 2.4). Removing the atomicity axiom from herd’s Arm model makes the outcome allowed, for both SWPL and LDXR/STLXR. For the LL/SC pair this holds only when both store-exclusives succeed; if one fails it writes nothing, and Arm allows the outcome. Both machines respect the order for both kinds of RMW, in the runs in which both store-exclusives succeed (Table 5).
The acquire case. Now let an acquire RMW replace each thread’s store, as in Figure 3(b). The Arm model allows the outcome for both kinds of RMW, and a type-1 RMW would forbid it (§ 2.4). With the release AMOs SWPL, LDADDL or CASL, or the acquire LL/SC pair LDAXR/STXR, the outcome appears about times on both machines. With the acquire AMOs SWPA, LDADDA or CASA it never appears in iterations, which suggests an order. But the outcome is rare, not forbidden. In iterations on the M2 with unpinned threads, SWPA showed it 34 times under macOS and 4 times under Linux, and under macOS LDADDA and CASA showed it in iterations each. It also appears on the M1 and the M2 Max (§ 8). The machines therefore do not order the write of an acquire AMO before later accesses, and we add no order for it.
RMWs as fences. An acquire AMO is not a fence either. Between a store and a load, SWPA shows the outcome times on both machines, and the release AMO and every LL/SC pair to times; only SWPAL, which has both orderings, prevents it, as Arm specifies.
A failing CAS. A CAS whose comparison fails need not write (§ 2.4), and the Arm model then does not order an earlier store before it, so it allows Dekker with a failing CASAL between the store and the load. Neither machine shows the outcome, while a failing CAS, CASA or CASL in the same place shows it to times on the M1 and times on the M2. The machines behave as if a CAS were an AMO like any other, writing back the value it read when its comparison fails; Arm’s own rule then makes a failing CASAL a full fence.
An allowed outcome never observed. Dekker with SWPA in place of the loads is allowed even with A1–A3, and neither machine shows it. We do not add an order to forbid it. The outcome needs the store to become visible after the RMW’s write, two stores reordered, which is rare on both machines; with the acquire LL/SC pair in place of the loads it appears hundreds of times on the M1 and tens of times on the M2.
Summary. Arm mode follows the Arm model. Both machines are stronger in three ways: an acquire load never reads its own thread’s store early (A1); DMB LD and DSB LD are full barriers (A2); and a load is never reordered with a later store (A3). A failing CAS also behaves as if it writes, which makes a failing CASAL a fence. A1, A2 and the failing CASAL rest on zeros next to observed neighbours; A3 has no control, since no test in either mode shows load buffering. Run again at up to 40 times the iterations, all four zeros held (§ 8). A fifth zero did not: Dekker with an acquire AMO in place of the store is rare rather than forbidden, and we add no order for it.
TSO Mode
We ask two questions of TSO mode. The first concerns programs that use only what x86 also has, plain loads and stores and the full DMB: does TSO mode implement x86-TSO, in which a load may read its own thread’s store before other threads see it, or a stronger model such as the IBM 370’s, in which it may not? The second concerns the Arm instructions whose meaning goes beyond x86’s, acquire loads, release stores, the other barriers and the RMWs: does a TSO thread follow the sequential composition (§ 3.1)?
TSO mode implements x86-TSO: a load reads its own thread’s store early, and often. With the other Arm instructions it follows the sequential composition: on neither machine was an outcome the sequential composition forbids observed, in any of the 272 tests whose threads all run in TSO mode. TSO mode is stronger than the sequential composition in two of the orders Arm mode adds, A1 and A2 (§ 3.4); the third, A3, orders a load before a later store, which TSO already does. As in § 5, we take the three questions of § 4.1 in turn: preserved program order, propagation, and RMWs.
Preserved Program Order
Table 6 gives every row of the sequential composition, with both threads in TSO mode, followed by the read-back rows. In every row that the sequential composition orders, the outcome never appeared on either machine. As in § 5, a zero is evidence only if the row’s control (last column) appears.
| Pair | Mechanism | Shape | TSO | M1 | M2 | Control: M1 / M2 |
| store → store | every mechanism (10) | MP | ordered | 0 | 0 | Arm-mode writer, plain: / ; STLR;STR: / ; DMB LD, DSB LD: (A2) / (A2) |
| load → load | every mechanism (18) | MP | ordered | 0 | 0 | Arm-mode reader: – / –; DSB ST: / |
| load → store | every mechanism (16) | LB | ordered | 0 | 0 | Arm-mode thread: (A3) / (A3) |
| store → load | STLR;LDAR, DMB, DSB, DSB ST (4) | SB | ordered | 0 | 0 | plain: / |
| plain; STR;LDAP[R]; STR;LDAR; STLR;LDR; STLR;LDAP[R]; DMB ST | SB | not ordered | – | – | ||
| DMB LD, DSB LD | SB | not ordered | (A2) | (A2) | ||
| store → read-back | STR;LDR | n7 | not ordered | |||
| STLR;LDR | n7 | not ordered | ||||
| STXR;LDR | n7 | not ordered | – | |||
| STLXR;LDR | n7 | not ordered | ||||
| STR or STLR, then LDXR | n7 | not ordered | – | – | ||
| STLXR;LDXR | n7 | not ordered | ||||
| STR, STLR, STXR or STLXR, then an acquire load | n7 | not ordered | (A1) | (A1) | ||
| a release, then LDAR or LDAXR | n7 | ordered | 0 | 0 | ||
| an AMO, then any load | n7 | ordered | 0 | 0 | ||
| DMB LD after the read-back | n7 | not ordered | (A2) | (A2) |
Table 6. The rows of the sequential composition on the two machines, every thread in TSO mode, iterations of each test on each machine. Entries as in Table 3. TSO orders every store → store, load → load and load → store row whatever the mechanism; their control is the same test with that thread in Arm mode, where the pair is not ordered. The store → load control is SB with plain accesses. A number in parentheses counts the mechanisms of a row. The read-back rows are n7, in which a thread stores x and reads it back; each row gives the forms of that store and load.
TSO’s orders are kept. The sequential composition keeps TSO’s order on every store store, load load and load store pair, whatever the annotation or barrier, for example a load before a later LDAR. None of these 44 rows was observed. Their control is the same test with that thread in Arm mode, where Arm does not order the pair, and the controls are as uneven as in Arm mode: an Arm-mode reader reorders two loads to times on the M1 and 10 to times on the M2, and an Arm-mode writer reorders two stores tens of times on each machine. Load store has no control, since no thread in either mode reorders a load with a later store (§ 5). Four other rows have no observed control: STLR before STR, DMB LD or DSB LD between two stores, and DSB ST between two loads. Where the control appears, an Arm annotation or barrier on a TSO thread never weakens TSO’s order.
Store → load. The sequential composition adds Arm’s orders to TSO only on store → load, and there only a release store followed by an LDAR, and the full barriers, order the pair. The machines agree. The four ordered rows were never observed, and every unordered row but two shows the outcome to times. In particular, a plain store is not a release here, although TSO orders it after earlier accesses as it would a release: STR followed by LDAR shows the outcome to times, as two plain accesses do. The two exceptions are DMB LD and DSB LD. They have no x86 counterpart, and on Arm they order earlier loads only, so the rule allows the outcome with them; neither machine shows it. This is the same strengthening as in Arm mode, A2: on both machines these barriers are full barriers in either mode.
x86’s operations. Plain loads and stores, and the full DMB, which is MFENCE, are x86’s own operations. Eighteen of the tests use only these on every thread, so they are x86 programs; among them are MP, SB, LB, WRC, ISA2, RWC, IRIW, n6 and n7. We translated each to x86, and herd’s x86-TSO model gives each the verdict of the sequential composition. Both machines agree with it on every one: the twelve outcomes it forbids never appear, and the six it allows appear on both machines.
Reading a thread’s own store. The read-back rows answer the first question. In n7 [16] a thread stores , reads it back and then reads , while an observer reads and then . x86-TSO allows the outcome, because the thread may read from its store buffer before the store is visible to other threads; a TSO without that rule, such as the IBM 370’s, forbids it. With every thread in TSO mode and plain accesses, it appears times on the M1 and on the M2. So does n6 [19], the two-thread test of the same question ( and times), while n6 with an MFENCE never does. TSO mode thus implements x86-TSO, not a stronger TSO.
Which loads read their own store early. The second question asks the same of the Arm instructions: on a TSO thread, which loads may read their own thread’s store before other threads see it? We ran n7 with every combination of a store form and a load form for the store and the read-back (Table 6). The sequential composition lets every load read early except in two cases: LDAR or LDAXR after a release store, and any load after an AMO. Neither case was observed.
A plain load reads early after a plain or release store, to times. An acquire load, LDAPR, LDAR or LDAXR, never reads early, after any store, on either machine, while the same test with a plain load does. The sequential composition does not require this; it is A1, the order the machines add in Arm mode. A load-exclusive reads early only rarely, at most tens of times. It never does after STLXR, but with an outcome this rare, that zero is not evidence of an order.
A release store-exclusive. One row differs between the machines. On the M1, a plain load never reads its own store early after STLXR, while it does after STXR, about ten times. On the M1 alone we would have added this order. The M2 shows the outcome, 78 times in iterations, more often than after STXR, so we do not. This is why the model of the machines keeps only the orders both machines enforce.
Three and Four Threads
| Shape | Forbidden tests | Forbidden seen | Allowed controls tests | Allowed controls M1 | Allowed controls M2 |
| RWC | 4 | 0 | 2 | – | – |
| IRIW | 4 | 0 | 2 | ||
| WRC | 4 | 0 | 1 | ||
| ISA2 | 8 | 0 | 2 | – |
Table 7. Table 7: WRC, ISA2, RWC and IRIW with every thread in TSO mode, under every combination of the doubtful mechanisms (§ 4.1), iterations of each test on each machine. TSO orders every edge but store load, so a control puts one thread in Arm mode, with plain accesses; RWC also has a control with every thread in TSO mode and its store load edge unordered. Format as in table 4.
Table 7 gives WRC, ISA2, RWC and IRIW with every thread in TSO mode, under every combination of the doubtful mechanisms of a TSO thread: TSO’s own order and the annotations LDAPR and STLR, which x86 does not have (§ 4.1). None of the forbidden outcomes was observed: TSO mode keeps x86-TSO’s propagation, also when its accesses carry Arm’s annotations. TSO orders every edge of these shapes but store load, so a control puts one thread in Arm mode, with plain accesses, except for one control of RWC. RWC and IRIW are well exercised, 10 to times. WRC is well exercised on the M1 ( times) and less on the M2 (tens of times). ISA2 is barely exercised: its controls appear between one and twelve times.
RMWs
The sequential composition treats the two kinds of Arm RMW differently. Every AMO is locked, as an x86 RMW is: it is a type-1 RMW (§ 2.4), and with TSO’s order this makes it a full fence. An LL/SC pair is a TSO load followed by a TSO store, with Arm’s type-3 atomicity, and is not locked. Both machines behave this way (Table 8).
| Store load pairs with an RMW, both threads in TSO mode | Sequential composition | M1 | M2 |
| an AMO as the store, as the load, or between (86) | locked | 0 | 0 |
| a store, then a successful LL/SC pair (6) | atomicity | 0 | 0 |
| STLR, then LDAXR; or an LL/SC pair with STLXR, then LDAR or LDAXR (3) | release, acquire | 0 | 0 |
| an LL/SC pair, then LDR, LDAPR or LDAR (5) | not ordered | – | – |
| Dekker, an AMO between store and load, every form and ordering, and a failing CAS (13) | locked | 0 | 0 |
| Dekker, an LL/SC pair between store and load, each annotation (3) | not ordered |
Table 8. RMWs on TSO threads, iterations of each test on each machine. The first four rows are every store load pair with an exclusive or an AMO access, each in SB with DMB on the other thread. The last two rows are hand-written, with the RMW on a third location between each thread’s store and load. The controls are SB without the RMW ( on the M1, on the M2) and Dekker without the RMW (, ). For LL/SC pairs only runs in which the store-exclusives succeed are counted. Entries as in Table 3.
AMOs. No test with an AMO shows the outcome, whether the AMO takes the place of the store, takes the place of the load, or lies between them, for SWP, LDADD and CAS with each of the four orderings. The reason is the same in every case. The AMO is locked, so a store before it is ordered before its read, and its write is ordered before a later load; with TSO’s other orders, the AMO is a full fence. A CAS whose comparison fails is no exception: as § 3.1 explains, it is locked whether or not it writes, and neither machine shows the outcome with one.
LL/SC pairs. An LL/SC pair orders much less. A store followed by an LL/SC pair is ordered by atomicity, as a store followed by a release RMW is in Arm mode (Figure 3(a)); because TSO orders every store before a later store, this holds for every LL/SC pair, not only a release one. It holds only when the store-exclusive succeeds: one that fails writes nothing, and the outcome then appears times on both machines, so the table counts only runs in which the store-exclusives succeed. The rule that orders STLR before LDAR (§ 6.1) also orders STLXR before LDAR or LDAXR, and STLR before LDAXR. None of these pairs shows the outcome. Otherwise an LL/SC pair orders nothing. Followed by a load, or between a store and a load, it shows the outcome to times.
What this means. TSO mode thus has an RMW that x86 does not. An x86 RMW is locked, and so is a fence. An LL/SC pair on a TSO thread is atomic, but a later load may read memory before the pair’s store-exclusive, or an earlier store, is visible to other threads.
Summary. Table 9 summarizes how each Arm instruction behaves on a TSO thread. Both machines follow the sequential composition, except in two places where both are stronger: A1 and A2.
| Instructions on a TSO thread | Behaviour | Beyond the rule |
| LDR, STR, DMB SY | x86 load, store, MFENCE | |
| LDAPR | TSO load | not read early (A1) |
| LDAR | TSO load; ordered after a release store | not read early (A1) |
| STLR | TSO store; ordered before LDAR | |
| LDXR/STXR, any annotation | TSO load and store, atomic, not locked | |
| SWP, LDADD, CAS (any form, or failing) | locked RMW, a fence | |
| DSB SY, DSB ST | full fence | |
| DMB ST | no store load order | |
| DMB LD, DSB LD | no store load order | orders store load (A2) |
Table 9. Arm instructions on a TSO thread. The middle column is what the sequential composition of x86-TSO and Arm gives, and what TSO mode does on both machines; the last column, shaded, is where both machines are stronger.
Mixed Programs
Do programs whose threads run in both modes follow the compound model? The compound model says two things: each thread keeps the preserved program order of its own mode (whatever the modes of the other threads), and the three axioms (which govern how writes propagate) are shared by all threads. We ran 529 tests that mix Arm and TSO threads. The compound model forbids the outcome of 348 of them, and the model of the machines, which adds A1–A3, forbids 377. Neither machine showed any of these 377. We first ask whether a thread’s order depends on the mode of its partner, and then whether writes propagate across modes as the axioms require. Last, we take the read-back tests, the tests with RMWs, and the three orders A1–A3 that the machines add.
Does a Thread’s Order Depend on Its Partner’s Mode?
Every row of tables 3 and 6 was run twice: once with an Arm-mode partner and once with a TSO-mode partner. If a thread’s order does not depend on its partner’s mode, the two runs should agree: the outcome appears in both or in neither. They agree in 423 of the 424 pairs of runs, 212 on each machine. The exception is two plain stores on an Arm thread on the M2: never reordered with an Arm-mode reader, and reordered 67 times in with a TSO-mode reader. A second run of the Arm-mode test showed the outcome 26 times, so the exception is variation between runs, not a dependence on the partner’s mode.
Propagation Across Modes
| Shape | Forbidden tests | Forbidden seen | Allowed tests | controls M1 | controls M2 |
| RWC | 18 | 0 | 10 | – | – |
| IRIW | 56 | 0 | 16 | – | – |
| WRC | 27 | 0 | 4 | – | – |
| ISA2 | 51 | 0 | 8 | – | – |
Table 10. WRC, ISA2, RWC and IRIW under every assignment of modes that mixes Arm and TSO, iterations of each test on each machine. Format as in table 4. Where TSO orders the edge that a control leaves unordered, the control puts that thread in Arm mode, so a few controls have every thread in Arm mode.
Table 10 gives the four propagation shapes, WRC, ISA2, RWC and IRIW, under every assignment of modes that mixes Arm and TSO threads (§ 4.1). No forbidden outcome was observed. In the shapes whose controls appear, a write of a thread in one mode thus becomes visible to all threads of the other mode at the same time. This is what the compound model mandates (§ 2.3): the preserved program order of each thread, in its own mode, together with communication between threads, never forms a cycle.
The controls show how well each shape is exercised. RWC controls appear 10 to times. WRC controls appear up to times on the M1 but at most tens of times on the M2. ISA2 controls are rare on both machines, at most times on the M1 and eight times on the M2, as when all threads run in one mode. IRIW controls appear in all but one test on the M1 and all but three on the M2. One of these, with both writers in TSO mode and both readers in Arm mode, one ordered by an address dependency and the other not, never appears on either machine; with every thread in Arm mode it appears to times. We do not know why.
Read-Back Tests, RMWs, and A1–A3
Reading a thread’s own store. Section 6.1 decides which loads on a TSO thread read their own store early, with every thread in TSO mode. We also ran the same tests with Arm observers: 62 tests, n6, n7 and each store and load form. The model of the machines forbids 33 of them, and neither machine showed any. Of the 29 it allows, 27 appeared on both machines, and the other two behave as with every thread in TSO mode (Table 6).
RMWs. We also ran the store load pairs of Table 8 with the RMW on a TSO thread and an Arm partner, 100 tests. The compound model forbids 95 of the outcomes, and neither machine showed any; the five it allows, an LL/SC pair followed by a load, appeared on both machines, to times. In the 65 hand-written Dekker tests, an RMW on an Arm thread meets an RMW on a TSO thread. The compound model forbids one of their outcomes, and it was not observed.
A1–A3. The three orders the machines add also hold in mixed programs. In 29 mixed tests, an order added on one thread closes a cycle with the order of a thread of the other mode. The compound model allows these outcomes and the model of the machines forbids them. None of the 29 was observed.
Allowed outcomes never observed. Nine outcomes that the model of the machines allows never appeared in mixed programs. One is the IRIW case of § 7.2. The other eight are mixed forms of outcomes that are rare, or never seen, when all threads run in one mode. We add no order for any of them.
Long Runs of the Added Orders
Each order of § 3.4, and the rule that a failing CAS writes, rests on outcomes that never appeared in iterations, next to controls that did (A3 has none; § 4.3). Such a zero does not distinguish a forbidden outcome from a rare one; the acquire-AMO outcome of § 5.3 was such a zero and turned out to be rare. We therefore ran each of these tests times, about 40 times as often as in the suite ( times for the three-thread tests), on three setups: the M2 and the M1 under Linux, and an M2 Max under macOS. macOS cannot put a thread in TSO mode (§ 4), so the M2 Max runs only the tests whose threads are all in Arm mode. Threads are not pinned, and litmus7 scans memory with stride seven (-st 7), the setting under which the acquire-AMO outcome appeared most often.
In a two-thread Dekker, SB or LB test the outcome is possible only in iterations in which the two threads run their accesses at the same time, and in most iterations they do not. We call these iterations overlapping, and count those in which both loads read 1 (in LB, both read 0).
Two checks show that the long runs are sound. Outcomes that Arm forbids never appeared, in to overlapping iterations per test. The acquire-AMO outcome did appear, on every setup: 12 times on the M2 Max, in overlapping iterations; 4 times on the M2 under Linux, in ; and twice on the M1 under Linux, in . Every other zero held, in both modes and on every setup on which it ran, and every control appeared (Table 11).
| Test | Control | M2 Max, macOS | M2, Linux | M1, Linux | |
| Arm forbids | Dekker, SWPAL replaces the store | SWPL | 0 / 5.2 | 0 / 8.6 | 0 / 4.9 |
| Dekker, SWPL replaces the load | SWPL as store | 0 / 2.4 | 0 / 0.6 | 0 / 0.9 | |
| SB, DMB | SB, one DMB | 0 / 5.6 | 0 / 3.2 | 0 / 4.9 | |
| Rare | Dekker, SWPA replaces the store | SWPL | 12 / 3.2 | 4 / 15 | 2 / 5.0 |
| A2, Arm | SB, DMB LD | SB, one DMB | 0 / 4.6 | 0 / 4.2 | 0 / 3.0 |
| SB, DSB LD | SB, one DMB | 0 / 4.7 | 0 / 5.1 | 0 / 2.5 | |
| A2, TSO | SB, DMB LD | SB, one DMB | – | 0 / 5.7 | 0 / 4.9 |
| SB, DSB LD | SB, one DMB | – | 0 / 6.3 | 0 / 81 | |
| A3 | LB, DMB on one thread | none | 0 / 16 | 0 / 4.2 | 0 / 3.4 |
| CAS | Dekker, failing CASAL between | failing CAS | 0 / 5.5 | 0 / 5.3 | 0 / 133 |
| A1, Arm | n7, LDAPR | address dep. | 0 | 0 | 0 |
| n7, LDAR | address dep. | 0 | 0 | 0 | |
| n6, LDAPR, Arm partner | plain load | 0 | 0 | 0 | |
| n6, LDAPR, TSO partner | plain load | – | 0 | 0 | |
| A1, TSO | n7, LDAPR | plain load | – | 0 | 0 |
| n7, LDAR | plain load | – | 0 | 0 |
Table 11. The tests behind the added orders, run with unpinned threads, times each ( for n7, which has three threads). A cell / gives the times the outcome appeared () and the overlapping iterations in millions (); the n6 and n7 rows have no overlap count. Every control appeared on every setup on which it ran. –: not run; macOS cannot set TSO mode, so the M2 Max runs only Arm-mode tests.
We use the acquire-AMO outcome as a yardstick, assuming that a broken order would fail about as often per overlapping iteration. It appeared about once in overlapping iterations on the M2 Max, and once in under Linux. An outcome as rare would have appeared 17 to 60 times in each Arm-mode test of the added orders on the M2 Max, and about 27 and 44 times in the M1 runs of DSB LD on TSO threads and the failing CASAL; none appeared. The other Linux runs would have shown such an outcome only once or twice, so they add little evidence for DMB LD on TSO threads. The yardstick does not apply to A1, whose n6 and n7 tests have no overlap count.
Conclusion
Apple’s processors let a thread switch between the Arm and TSO memory models while keeping the Arm instruction set. Specifying such a processor takes two compositions. The first is across threads: when threads run under different models, a single model must govern how they interact. The second is within a thread: a TSO thread can run Arm instructions that x86-TSO does not have, such as LDAPR, DMB LD and the LL/SC pair, and the model must say how each of them is ordered. We proposed the compound model for the first and a sequential composition for the second. Under the sequential composition, every access of a TSO thread is a TSO load or store, whatever its annotation, and keeps TSO’s order; AMOs are locked; and Arm’s orders are added. This gives every instruction a meaning. Everything else follows from the two models; the one choice we made is to lock AMOs.
We tested the proposal on an Apple M1 and an Apple M2. Arm mode follows Arm’s official model. TSO mode follows x86-TSO on the operations x86 has, and the sequential composition on the other instructions. Programs that mix the two modes follow the compound model. Neither machine showed an outcome that any of these models forbids. Both machines are also stronger than the models in two ways. They preserve three orders that the models do not require, A1–A3, and a CAS whose comparison fails behaves as if it writes back the value it read, which makes a failing CASAL a fence. All of these held in runs up to 40 times longer (§ 8; an apparent order of an acquire AMO’s write before a later load did not, as the machines do reorder them, though rarely). A1–A3 and the failing CAS describe the two machines, not what the two modes require, so we keep them out of the proposed models (§ 3.4).
Last, the Arm model itself orders more than its preserved program order states. A successful release RMW orders earlier stores before its read. The Arm model implies this through its atomicity axiom, although no rule of preserved program order states it.
Artifacts
The artifact contains the 936 litmus tests, in litmus7 and herd form, and 18 programs in x86 assembly. A list gives, for each test, what it tests, its verdict under each model and, where it has one, its control. The artifact also contains the script that generates the tests; the herd models, arm.cat, tso.cat, compound.cat and their -apple versions; the scripts that run the tests on Apple machines; and the raw results and litmus7 output of every run.
One command checks the results. It recomputes every table and the counts quoted in the text from the raw results, recomputes every herd verdict, checks our models against herd’s own Arm and x86-TSO models, and checks that each compound model reduces to its single-mode models on single-mode tests. The run scripts rerun the tests on an M1 or M2 under Asahi Linux, and the long runs also on an M2 Max under macOS. The artifact is available at https://github.com/vijay-nagarajan/apple-tso-litmus.
Acknowledgements
The M1 runs used cfarm103 of the GCC Compile Farm; we thank its maintainers. The per-thread TSO interface used here is the work of the Asahi Linux developers. This work is supported in part by the National Science Foundation under grant CCF-2525270, and by Arm. This work was carried out with substantial assistance from Claude (Anthropic) in preparing and running the tests, writing the herd models, developing the tables and figures, and writing the report. The author takes full responsibility for the contents of this report.
References
- [1]Adve and Kouroshe Gharachorloo. Shared memory consistency models: A tutorial. IEEE Computer, 29(12):66–76, 1996.
- [2]Jade Alglave, Luc Maranget, Susmit Sarkar, and Peter Sewell. Litmus: Running tests against hardware. In Tools and Algorithms for the Construction and Analysis of Systems (TACAS), volume 6605 of LNCS, pages 41–44, 2011.
- [3]Jade Alglave, Luc Maranget, and Michael Tautschnig. Herding cats: Modelling, simulation, testing, and data mining for weak memory. ACM Transactions on Programming Languages and Systems, 36(2), 2014.
- [4]Apple. Accelerating the performance of Rosetta. Virtualization framework documentation, https://developer.apple.com/documentation/virtualization/accelerating-the-performance-of-rosetta. Accessed November 2026.
- [5]Arm. Arm A-profile A64 Instruction Set Architecture, 2026. Release 2026-06, instruction page CAS, CASA, CASAL, CASL and shared pseudocode MemAtomic.
- [6]Arm. Arm Architecture Reference Manual for A-profile architecture, 2026. Issue M.d, Chapter B2, The AArch64 Application Level Memory Model.
- [7]Soham Bagchi, Sanya Srivastava, Reese Levine, Tyler Sorensen, Ryan Stutsman, and Vijay Nagarajan. Consistency and coherence of the NVIDIA Grace-Hopper superchip. In ACM SIGPLAN International Symposium on Memory Management (ISMM), pages 66–79, 2026.DOI
- [8]Ard Biesheuvel. Re: [PATCH 0/4] arm64: Support the TSO memory model. linux-arm-kernel mailing list, https://lists.infradead.org/pipermail/linux-arm-kernel/2024-May/926618.html, May 2024.
- [9]FEX-Emu. FEX-2306 tagged. https://fex-emu.com/FEX-2306/, June 2023.
- [10]Andrés Goens, Soham Chakraborty, Susmit Sarkar, Sukarn Agarwal, Nicolai Oswald, and Vijay Nagarajan. Compound memory models. Proc. ACM Program. Lang., 7(PLDI):1145–1168, 2023.DOI
- [11]Intel. Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 2: Instruction Set Reference, A-Z, 2026. Version 093, September 2026; instruction pages CMPXCHG, CMPXCHG8B/CMPXCHG16B, LOCK and XCHG.
- [12]Yossi Khayet and Adam Morrison. Arm weak memory consistency on Apple silicon: What is it good for? In ACM International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), pages 191–207, 2026.DOI
- [13]Catalin Marinas. Re: [PATCH 0/4] arm64: Support the TSO memory model. Linux kernel mailing list, https://lkml.iu.edu/2404.2/05657.html, April 2024.
- [14]Hector Martin. [PATCH 0/4] arm64: Support the TSO memory model. Linux kernel mailing list, https://lkml.iu.edu/hypermail/linux/kernel/2404.1/04825.html, April 2024.
- [15]Nicolai Oswald, Vijay Nagarajan, Daniel J. Sorin, Vasilis Gavrielatos, Theo Olausson, and Reece Carr. HeteroGen: Automatic synthesis of heterogeneous cache coherence protocols. In IEEE International Symposium on High-Performance Computer Architecture (HPCA), pages 756–771, 2022.
- [16]Scott Owens, Susmit Sarkar, and Peter Sewell. A better x86 memory model: x86-TSO. In Theorem Proving in Higher Order Logics (TPHOLs), volume 5674 of LNCS, pages 391–407, 2009.DOI
- [17]Christopher Pulte, Shaked Flur, Will Deacon, Jon French, Susmit Sarkar, and Peter Sewell. Simplifying ARM concurrency: Multicopy-atomic and operational models for ARMv8. Proc. ACM Programm. Lang., 2(POPL), 2018.
- [18]Bhargava Rajaram, Vijay Nagarajan, Susmit Sarkar, and Marco Elver. Fast RMWs for TSO: Semantics and implementation. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 61–72, 2013.
- [19]Peter Sewell, Susmit Sarkar, Scott Owens, Francesco Zappa Nardelli, and Magnus O. Myreen. x86-TSO: A rigorous and usable programmer’s model for x86 multiprocessors. Communications of the ACM, 53(7):89–97, 2010.DOI
- [20]Lars Wrenger, Dominik Töllner, and Daniel Lohmann. Analyzing the memory ordering models of the Apple M1. Journal of Systems Architecture, 149:103102, 2024.DOI
- [21]An Qi Zhang, Andrés Goens, Daniel J. Sorin, and Vijay Nagarajan. A formally verified foundation for compositional heterogeneous coherence. Proc. ACM Programm. Lang., 10(PLDI):2573–2597, 2026.