09.08.2013 Views

Design and Verification of Adaptive Cache Coherence Protocols ...

Design and Verification of Adaptive Cache Coherence Protocols ...

Design and Verification of Adaptive Cache Coherence Protocols ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.4 Universality <strong>of</strong> the CRF Model<br />

Most relaxed or weaker memory models have arisen as a consequence <strong>of</strong> speci c architectural<br />

optimizations in the implementation <strong>of</strong> memory access instructions, rather than from some<br />

high-level design. Di erent manufacturers have di erent memory models even the same man-<br />

ufacturer can have di erent memory models for di erent generations <strong>of</strong> machines. The CRF<br />

model can be used to eliminate the modele de l'annee aspect <strong>of</strong> many existing memory mod-<br />

els. Programs written under sequential consistency <strong>and</strong> various weaker memory models can be<br />

translated into CRF programs without incurring unnecessary overhead. The translations can<br />

be taken as precise de nitions <strong>of</strong> the <strong>of</strong>ten imprecise descriptions <strong>of</strong> the semantics <strong>of</strong> memory in-<br />

structions given by the manufacturers. On the other h<strong>and</strong>, CRF programs can be mapped back<br />

to programs that can run e ciently on existing microprocessors. This section demonstrates the<br />

upward <strong>and</strong> downward compatibility <strong>of</strong> the CRF model.<br />

The upward compatibility refersto the the ability to run existing programs correctly <strong>and</strong><br />

e ciently on a CRF machine. As an example, we show translation schemes for SC, Sparc's TSO,<br />

PSO <strong>and</strong> RMO models <strong>and</strong> the IBM 370's model. Weaker memory models that allow memory<br />

instructions to be reordered usually provide memory barrier or fence instructions that can be<br />

used to enforce necessary ordering. Some machines such as IBM 370 have no explicit barrier<br />

instructions but instead rely on the implicit barrier-like semantics <strong>of</strong> some special instructions.<br />

We still refer to such instructions as memory barriers (Membar) in the translation schemes.<br />

The translation from SC to CRF is simple because SC requires strict in-order <strong>and</strong> atomic<br />

execution <strong>of</strong> load <strong>and</strong> store instructions.<br />

Loadsc(a) Fencerr( ,a) Fencewr( ,a) Reconcile(a) Loadl(a)<br />

Storesc(a,v) Fencerw( ,a) Fenceww( ,a) Storel(a,v) Commit(a)<br />

The translation guarantees that the resulting CRF program has exactly the same behavior<br />

as the SC program. Note that each fence can be replaced by a coarse-grain instruction<br />

Fence( , ) without eliminating any program behavior.<br />

TSO allows a load to be performed before outst<strong>and</strong>ing stores complete, which virtually<br />

models FIFO write-bu ers. It also allows a load to retrieve the data from an outst<strong>and</strong>ing<br />

store to the same address before the data is observable to other processors.<br />

Loadtso(a) Fencerr( ,a) Reconcile(a) Loadl(a)<br />

Storetso(a,v) Fencerw( ,a) Fenceww( ,a) Storel(a,v) Commit(a)<br />

Membar-liketso Fencewr( , )<br />

The translation places a Fencerr before each Reconcile-Loadl pair to ensure the load-load<br />

ordering, <strong>and</strong> a Fencerw <strong>and</strong> a Fenceww before each Storel-Commit pair to ensure the<br />

load-store <strong>and</strong> store-store ordering. The Membar instruction is simply translated into a<br />

write-read fence for all the addresses.<br />

PSO allows a load to overtake outst<strong>and</strong>ing stores <strong>and</strong> in addition, a store to overtake<br />

other outst<strong>and</strong>ing stores. This models non-FIFO write bu ers. The short-circuiting is<br />

59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!