


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



ECE497MF Multithreaded Computer Architecture March 3, 2004
Lecturer: Matt Frank Scribe: Ben Tappel
In this lecture we look at various methods for handling memory dependencies at runtime, including methods for dynmically predicting memory dependences.
Assuming a typical superscalar architecture broken down as follows:
One approach to handle memory dependencies would be to have an inorder FIFO load/store queue in the scoreboard. As stores are issued (inorder) they are placed into a store buffer. Each store buffer holds the address and data of the store instruction. The store buffer keeps track of all stores issued but not yet sent to the cache. At retire stores are removed from the store buffer and cached. When a load is executed the idea is to grab the data it needs from the store buffer, if there is an address match, rather than from the cache which would have old data. This approach is extremely conservative as it forces stores to issue inorder.
Because there may be several stores in the store buffer at a time, comparing a load address against all stores in the buffer may be time consuming. This can be over- come by using a store hash. In this approach a store hash table is created, possibly with a small queue for each hash entry. When a load is encountered it is simply hashed into the table, and only one hash entry is examined. This reduces the num- ber of comparison neccesary.
Typically there are about 500 instructions between mispredicts. This means that it would be reasonable to use a 9 or 10 bit counter to generate an ID for each instruc- tion between a mispredict.
Using timestamp information we can relax the requirement that we have a FIFO queue in the scoreboard. Instead it is assumed that no loads or stores conflict. When a store is issued its address, data, and timestamp (instruction ID) are placed in the store buffer. If the IDs in the store buffer are inorder there has been no violation, if not a violation may exist. A load with a particular address can check its ID against the IDs of stores in the store buffer with the same address. For example
In this case if we see a load with ID 28, we want it to wait for the store with the next lowest ID. In the above picture we thus place the load after the store with ID 27. Given the same setup if we encounter a store with ID 20 we may have a problem. The load instruction with ID 26 may have already read from the store with ID 17, when it really wanted the data produced by the load with ID 20. If this occurs we have to treat the load 26 as a mispredict and squash any instructions behind the load since there is no good way to determine who depended on the load 26. One potential problem with this approach is caused by load and stores to the same address that happend close together. This occurance, which is not uncom- mon, will be treated as a mispredict if the load issues head of the store it is sup- posed to follow. This could occur often as loads only have one operand to wait on while a store has several.
the store takes the load ID. If both the load and store are in the table with different IDs the IDs are merged. This can be done by either picking the lower or higher ID, as long as the same choice is made each time. Entries are removed from the table after a certain time has passed.
[1] George Z. Chrysos and Joel S. Emer. Memory dependence prediction using store sets. ISCA , pages 142โ153, 1998.