Handling non-atomic requests in directory based MSI protocol (II)

In the previous post, we discussed about handling non-atomic requests in directory based MSI protocol by stalls. In cache controller transient states such as “IS-D”, “IM-A” and “SM-A”, we could allow forwarded request messages to make progress without stalling, at the expense of adding more transient states.

For example, when a cache controller has a line in State “IS-D” and receives an Inv message, it processes the request and changes the line’ state to “IS-D-I”, indicating the cache controller should change the line state to I after the “GetS” transaction completes. By not stalling the Inv message, the cache controller can improve its performance by continuing to process other forwarded request messages behind that Inv message in the queue.

Given the following assumptions:

  1. All caches implement write-back + write-allocate policy
  2. Separate networks for each message type for deadlock prevention
  3. The interconnection network / fabric enforces point-to-point ordering for forwarded request messages, i.e., if a directory sends two forwarded request messages to a cache controller, the messages arrive at that cache controller in order
  4. A complete directory accurately tracks the status and sharers of each cache line

The cache controller state transitions for directory based MSI protocol is shown below:

StateProcessor Core EventsForwarded Request MessagesResponse Messages
LoadStoreEvictionFwd-GetSFwd-GetMInvPut-AckData from DirData from OwnerInv-Ack
IIssue GetS / IS-DIssue GetM / IM-AD
IS-DStallStallStallSend Inv-Ack to Req / IS-D-IData[ack=0] / SData[ack=0] / S
IS-D-IStallStallStallData[ack=0] / IData[ack=0] / I
IM-ADStallStallStallStallStallData[ack=0] / M
Data[ack>0] / IM-A
Data[ack=0] / Mack–
IM-AStallStallStall– / IM-A-S – / IM-A-I if (last Inv-Ack)  – / M
else  ack–
IM-A-SStallStallStallSend Inv-Ack to Req / IM-A-SIif (last Inv-Ack)  Send data to Req & Dir / S
else  ack–
IM-A-SIStallStallStallif (last Inv-Ack)  Send data to Req & Dir / I
else  ack–
IM-A-IStallStallStallif (last Inv-Ack)  Send data to Req / I
else  ack–
SLoad hitIssue GetM / SM-ADIssue PutS / SI-ASend Inv-Ack to Req / I– 
SM-ADHitStallStallStallStallSend Inv-Ack to Req / IM-ADData[ack=0] / M
Data[ack>0] / SM-A
ack–
SM-AHitStallStall– / SM-A-S– / SM-A-Iif (last Inv-Ack)  – / M
else  ack–
SM-A-SStallStallStallSend Inv-Ack to Req / SM-A-SIif (last Inv-Ack)  Send data to Req & Dir / I
else  ack–
SM-A-SIStallStallStallif (last Inv-Ack)  Send data to Req & Dir / I
else  ack–
SM-A-IStallStallStallif (last Inv-Ack)  Send data to Req / I
else  ack–
MLoad hitStore hitIssue PutM, send data to Dir / MI-ASend Data[ack=0] to Req & Dir / SSend Data[ack=0] to Req / I
MI-AStallStallStallSend Data[ack=0] to Req & Dir / SI-ASend Data[ack=0] to Req / II-A– / I
SI-AStallStallStallSend Inv-Ack to Req / II-A– / I
II-AStallStallStall– / I

In the above table, for states like “IM-A-*” and “SM-A-*”, they enable forward progress when the cache controller is still gathering “Inv-Ack” messages from other caches after issuing “GetM” requests to the directory.

Note, for states like “IM-A-S*” and “SM-A-S*” (transitions caused by “Fwd-GetS” requests), the cache controller should send data response to both the requesting cache and the directory, after receiving all expected “Inv-Ack” messages; for states like “IM-A-I” and “SM-A-I” (transitions caused by “Fwd-GetM” requests), the cache controller should send data response to only the requesting cache, not the directory.

By denoting directory states from caches’ perspective, the directory state transitions for the protocol is shown accordingly:

StateRequest MessagesResponse Messages
GetSGetMPutSPutM + Data from OwnerPutM + Data from Non-OwnerData
ISend data to Req, add Req to sharer / SSend data to Req, set Owner as Req / MSend Put-Ack to ReqSend Put-Ack to Req
SSend data to Req, add Req to sharer / SSend data to req, send Inv to sharers, clear sharers, set Owner to Req / MRemove Req from sharers, send Put-Ack to Req / S (not the last PutS) or I (the last PutS)Remove Req from sharers, send Put-Ack to Req
MSend Fwd-GetS to Owner, add Req and Owner to sharer, clear Owner / S-DSend Fwd-GetM to Owner, set Owner to ReqSend Put-Ack to ReqCopy data to memory, clear Owner, send Put-Ack to Req / ISend Put-Ack to Req
S-DStallStallRemove Req from sharers, send Put-AckRemove Req from sharers, send Put-AckCopy data to memory / S

Note, we still require stalls in transient state “S-D”, otherwise we would need to add an impractically large number of states to avoid stalling in all possible cases.

Reference

A Primer on Memory Consistency and Cache Coherence (Second Edition), by Vijay Nagarajan, Daniel J. Sorin, Mark D. Hill, David A. Wood

Subscribe

Enter your email to get updates from us. You might need to check the spam folder for the confirmation email.

Leave a comment