Skip to content

AMBA CHI · Module 22 · CHI Misconceptions Engineers Have

“Coherency Guarantees Ordering”

Two properties engineers routinely fuse are distinct, and conflating them causes hard CHI reasoning errors. Coherence keeps one location consistent: agents agree on its write order. Memory ordering — the consistency model — governs the order writes to different addresses become visible. The belief promotes the per-location property into a global one — false: CHI is coherent yet weakly ordered, so two writes to two addresses can be observed in different orders. The proof is message passing: a producer writes data then a flag, and coherence lets the consumer see the flag but stale data. CHI is coherent with a relaxed memory model; cross-location ordering needs explicit barriers. The trap is assuming coherence implies sequential consistency and omitting those barriers.

Intermediate15 min readAMBA CHIMisconceptionOrderingConsistencyBarriers

Module 22 · Chapter 22.4 · CHI Misconceptions Engineers Have

Project thread — 22.3 bracketed snooping. 22.4 separates coherence from ordering; 22.5 tackles ReadUnique.

1. The Misconception

The belief: "if a system is coherent, memory operations are ordered — coherence guarantees that everyone sees operations in the same order." It fuses two distinct properties — coherence (one location, consistent) and consistency/ordering (across locations, globally ordered) — into one. It is among the hardest CHI misconceptions because the two ideas sound identical and the failure it causes — stale reads across a handoff — is subtle, intermittent, and brutal to debug.

2. Why It's Tempting

The conflation is tempting because coherence is a kind of ordering — just a narrower one.

  • Coherence really does order — per location. All agents agree on the order of writes to a single address. That is an ordering guarantee, so "coherence gives ordering" feels true.
  • "Coherent" connotes "consistent." The everyday meaning of coherent/consistent suggests everything lines up — the word oversells the technical guarantee.
  • Simple cases never expose it. Single-location, single-variable reasoning works under coherence alone — so the belief goes unchallenged until a multi-location handoff appears.

The seed is real: coherence is ordering for one location. The error is generalizing that to all locations at once — sequential consistency — which coherence does not provide.

3. Key Terms

4. Previous Chapter Connection

This chapter sharpens the ordering and memory-model material (Chapters 9–10). Coherence (Chapters 4, 8) is the per-location guarantee; the memory consistency model (Chapter 9) is the cross-location one; barriers and CompAck ordering (Chapters 9, 11) are how ordering is requested. The ordering point (the Home) serializes per address, not across addresses.

Where Chapter 9 built the memory model, 22.4 defends it against the belief that coherence makes it unnecessary. It is a natural successor to 22.1's warning about the AXI mental model — AXI's ordering rules mis-transfer here — and it grounds 22.5, where a similarly over-strong assumption (ReadUnique always fetches) also comes from over-reading what a mechanism guarantees.

5. The Claim, Precisely

State the myth falsifiably.

Claim: "A coherent system is sequentially ordered — if writes happen in some order, all agents observe them in that same global order."

Testable with a litmus test. A producer writes DATA then FLAG (two different addresses). A consumer reads FLAG, sees it set, then reads DATA. If the claim held, seeing FLAG would guarantee seeing the new DATA. Under a coherent but weakly-ordered system (CHI), it does not — the consumer can see FLAG=1 and DATA=stale. The claim fails the message-passing test.

6. Why It's Wrong — The Core

Coherence constrains one address; ordering across addresses is a separate guarantee.

  • Coherence is per-location. It guarantees agreement on writes to each single address — and nothing about the relative order of writes to different addresses.
  • CHI is weakly ordered. By default, writes to different addresses may become visible to other agents in different orders — a relaxed memory model.
  • Cross-location order must be requested. Barriers and CompAck-based ordering are the explicit mechanisms that enforce inter-address order; without them, there is none to rely on.
  • The handoff breaks silently. A producer-consumer handoff assumes the flag orders after the data — an assumption coherence does not back.

Coherence answers "do we agree on this location's history?" — yes. It does not answer "do we agree on the order of these two locations' updates?" — that is the consistency model's job.

7. Engineering Diagram — coherence holds, ordering does not

The producer writes DATA then sets FLAG, two different addresses. The consumer spins until it observes FLAG set, then reads DATA, and under a coherent but weakly-ordered protocol it can observe the new FLAG yet still read stale DATA, because the two writes are to different addresses and nothing orders them. Each address is individually coherent but coherence alone gives no cross-address order; an explicit barrier between the two writes makes the handoff correct.Message passing — FLAG seen, DATA stale (coherent, weakly ordered)ProducerMemory (coherent)Consumerwrite DATA = 42write FLAG = 1(other address)read FLAG → 1 (seesit set)read DATA → 0(STALE!)fix: barrier betweenthe two writes
Figure 1 — the message-passing litmus test. The producer writes DATA then sets FLAG, two different addresses. The consumer spins until it observes FLAG set, then reads DATA — and under a coherent but weakly-ordered protocol it can observe the new FLAG yet still read stale DATA, because the two writes are to different addresses and nothing orders them. Each address is individually coherent, but coherence alone gives no cross-address order. An explicit barrier between the two writes makes the handoff correct.

Each address is coherent — the consumer will eventually see DATA=42. But coherence alone does not order FLAG after DATA, so the consumer can see FLAG=1 with DATA=0. A barrier between the writes is what enforces the order coherence does not.

8. The Mechanism

Coherence vs consistency, precisely.

PropertyCoherenceConsistency (memory model)
Scopea single addressacross addresses
Guaranteesagreed write order per locationwhen writes become visible together
CHI defaultalways providedrelaxed / weak
Cross-address ordernoneonly via barriers / CompAck
Litmusone variable, always consistentmessage-passing can see stale data

The rule to carry: coherence orders each location; the memory consistency model orders across locations, and CHI's is weak — so cross-address ordering is opt-in, via barriers. Coherence is necessary but not sufficient for the ordering a multi-location handoff needs.

9. The Kernel of Truth

Steelman the belief.

  • Coherence genuinely is ordering — for one location. The per-address coherence order is a real, total order every agent respects. The belief correctly perceives ordering here.
  • Single-variable reasoning is safe. For a single shared location (e.g. one atomic counter with the right access type), coherence does give you the order you expect.
  • The strong-model intuition isn't crazy. Under sequential consistency, coherence would compose into global order — the belief is describing the strong model it assumes by default.

The truth: coherence is ordering per location, and under a strong memory model the intuition would hold. The myth is only wrong for CHI's actual, weak model across locations — where it must be made explicit.

10. A Concrete Counterexample

The message-passing handoff, step by step.

  1. Producer writes DATA. DATA = 42 to address X. Coherent — everyone will agree X's history.
  2. Producer writes FLAG. FLAG = 1 to address Y (a different address). Coherent for Y.
  3. No barrier between them. The producer assumed coherence orders Y after X. It does not — they are different addresses.
  4. Consumer observes FLAG=1. It reads Y, sees 1, concludes "data is ready".
  5. Consumer reads DATA=0. It reads X — and can get the stale value, because nothing ordered the X write before the Y write as observed by the consumer. Bug.
  6. The fix. A barrier (or ordered write / CompAck ordering) between steps 1 and 2 forces X visible before Y — now FLAG=1 implies DATA=42.

Each address was perfectly coherent; the handoff still broke — because coherence never promised cross-address order. That gap is the refutation.

11. What's Actually True

The correct model.

  • Coherence is per-location; consistency is cross-location — different properties.
  • CHI is coherent but weakly ordered by default.
  • Writes to different addresses may be observed in different orders without explicit ordering.
  • Cross-location order is opt-in — via barriers and CompAck-based ordering.
  • Coherence is necessary, not sufficient, for a correct multi-location handoff.

12. Why The Distinction Matters

Conflating the two has concrete costs.

  • You omit barriers. Assuming coherence orders everything, you skip the barrier a producer-consumer handoff needs — a stale-data bug (this chapter's core).
  • The bug is intermittent. It appears only on the timing where the reorder is observed — passing most runs, failing rarely (Chapter 21.5's non-locality).
  • You mis-port strong-model code. Software assuming x86-like strong ordering breaks on CHI's weak model without added barriers.
  • You mis-review RTL/DV. Not distinguishing the properties, you don't test the reorder — a coverage hole (Chapter 21.3).

13. Design Implications

What to do once the properties are separated.

  • Insert barriers for cross-location ordering — never rely on coherence to order different addresses.
  • Treat CHI as weakly ordered — design and verify for relaxed visibility, add ordering explicitly.
  • Use CompAck / ordered writes where the protocol offers ordering hooks (Chapters 9, 11).
  • Cover the reorder in DV — test that a handoff without a barrier can be caught failing (Chapter 21.3).
  • Reason per-location for coherence, per-model for ordering — two separate questions.

14. The Trap

  • Coherence = consistency. No — coherence is per-location; consistency is the cross-location memory model.
  • CHI is sequentially consistent. No — CHI is coherent but weakly ordered by default.
  • A read after a coherent write always sees it. For the same address, yes; across addresses, not without ordering.
  • Barriers are optional nice-to-haves. No — they are required for correct cross-location handoffs.
  • This is an AXI-style ordering question. No — don't import AXI ordering rules (Chapter 22.1); use CHI's memory model.

16. Answering It In An Interview

If asked "does coherence guarantee ordering?" — the strong answer:

  1. Split the properties. "Coherence is per-location — agreement on one address's writes. Ordering is the cross-location memory model. They are different."
  2. State CHI's model. "CHI is coherent but weakly ordered — writes to different addresses can be seen in different orders."
  3. Give the litmus. "Message passing: producer writes data then flag; coherence alone lets the consumer see the flag but stale data — you need a barrier."
  4. Concede the kernel. "Coherence is ordering — but only per location; it doesn't compose into global order under a weak model."

That splits the properties, names the model, gives the litmus, and concedes the kernel — reasoning, not recital (Chapter 21.6).

17. Key Takeaways

  • Coherence and ordering are different — per-location vs cross-location.
  • Coherence guarantees agreement on one address's write order — a real but narrow ordering.
  • CHI is coherent but weakly ordered — cross-address order is not free.
  • Message passing proves it: FLAG seen, DATA stale, without a barrier.
  • Cross-location ordering is opt-in — via barriers / CompAck.
  • The trap: assuming coherence ⇒ sequential consistency and omitting barriers.

18. Quick Revision

"Coherency Guarantees Ordering" — refuted. Two distinct properties are being fused. Coherence is a single-location guarantee: every agent agrees on the order of writes to one address (a per-address coherence order), and a read eventually returns the latest write to that address. The memory consistency model is a different, cross-location guarantee: it governs the order in which writes to different addresses become visible to other agents. The belief silently promotes the per-location property into a global one — false, because a coherent system can be weakly ordered, and CHI is: writes to two different addresses may be observed in different orders by different agents, even while each address is perfectly coherent. The proof is the message-passing litmus: a producer writes DATA then sets FLAG (different addresses); a consumer sees FLAG=1 but can still read stale DATA, because nothing ordered the two writes as the consumer observes them. CHI provides coherence + a relaxed memory model; cross-location ordering is opt-in, via barriers and CompAck-based ordering. The kernel of truth: coherence is a form of ordering — a total order per location — which is exactly why over-generalizing to global order is tempting; under a strong (sequentially consistent) model the intuition would even hold. The trap is assuming coherence ⇒ sequential consistency and omitting the barrier a producer-consumer handoff needs — producing an intermittent stale-read bug that passes simple, single-variable tests and fails rarely on a multi-location handoff, and that looks impossible because "coherent" feels like it should preclude stale reads. Separate the two: coherence = one location; ordering = across locations, weak in CHI, made explicit with barriers. Next, 22.5 refutes that ReadUnique always fetches data.

Coming Next

Chapter 22.5 — "ReadUnique Always Fetches Data". Another over-reading of what a transaction guarantees. Chapter 22.5 refutes "ReadUnique always fetches data" — why a ReadUnique's purpose is to obtain a line in the Unique (writable) state, not necessarily to transfer data, why the requester may already hold the line or intend to overwrite it wholesale, and how CHI can grant ownership without a data payload — an efficiency the "always fetches" assumption hides.