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.

4.5.2 Mapping from Base to CRF<br />

We de ne a mapping function that maps terms <strong>of</strong> Base to terms <strong>of</strong> CRF. For Base terms in<br />

which the message queues are all empty, it is straightforward to nd the corresponding CRF<br />

terms. We call such Base terms drained terms. There is a one-to-one correspondence between<br />

the drained terms <strong>of</strong> Base <strong>and</strong> the terms <strong>of</strong> CRF. For Base terms that contain non-empty<br />

message queues, we apply a set <strong>of</strong> draining rules so that all the messages in transit will be<br />

removed from the queues eventually.<br />

The intuition behind the draining rules is that message queues can always be drained via<br />

forward or backward draining. With forward draining, we canmove a message to its destination<br />

<strong>and</strong> consume the message at the destination with backward draining, we canmove a message<br />

back to its source <strong>and</strong> reclaim the message at the source. While forward draining is preferred<br />

since it can be achieved by employing some existing rules, backward draining is needed when<br />

forward draining would lead to non-deterministic results. This can happen, for example, when<br />

multiple Wb messages (from di erent caches) regarding the same address are in transit to the<br />

memory.<br />

There are many di erentways to drain messages from the network. We use forward draining<br />

for messages from the memory to caches, <strong>and</strong> backward draining for messages from caches to<br />

the memory. For example, to drain a <strong>Cache</strong> message in the memory's outgoing queue, we rst<br />

pass the message to the destination's incoming queue, <strong>and</strong> then cache the data in the cache.<br />

To drain a Wb message in the memory's incoming queue, we rst pass the message back to the<br />

source's outgoing queue <strong>and</strong> then restore the cache state.<br />

Backward Rules: The Backward-Message-<strong>Cache</strong>-to-Mem rule passes a message from the<br />

incoming queue <strong>of</strong> the memory back to the outgoing queue <strong>of</strong> the source cache. The Backward-<br />

C-Send-Wb <strong>and</strong> Backward-C-Send-<strong>Cache</strong>Req rules allow acache to retrieve Wb <strong>and</strong> <strong>Cache</strong>Req<br />

messages from the network <strong>and</strong> recover corresponding cache cells.<br />

Backward-Message-<strong>Cache</strong>-to-Mem Rule<br />

Sys(Msite(mem, min msg, mout), Site(id , cache, cin, cout, pmb, mpb, proc) j sites)<br />

if Src(msg)=id<br />

! Sys(Msite(mem, min, mout), Site(id , cache, cin, msg cout, pmb, mpb, proc) j sites)<br />

Backward-C-Send-Wb Rule<br />

Site(id , Cell(a,v,WbPending) j cache, in, out Msg(id ,H,Wb,a,v), pmb, mpb, proc)<br />

! Site(id , Cell(a,v,Dirty) j cache, in, out, pmb, mpb, proc)<br />

Backward-C-Send-<strong>Cache</strong>Req Rule<br />

Site(id , Cell(a,-,<strong>Cache</strong>Pending) j cache, in, out Msg(id ,H,<strong>Cache</strong>Req,a), pmb, mpb, proc)<br />

! Site(id , cache, in, out, pmb, mpb, proc)<br />

The backward rules above are the backward version <strong>of</strong> the Message-<strong>Cache</strong>-to-Mem, C-Send-<br />

Wb <strong>and</strong> C-Send-<strong>Cache</strong>Req rules, <strong>and</strong> can be used to drain the Wb <strong>and</strong> <strong>Cache</strong>Req messages. It<br />

is trivial to show that Lemmas 1 <strong>and</strong> 2 still hold in the presence <strong>of</strong> the backward rules.<br />

77

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

Saved successfully!

Ooh no, something went wrong!