Docsity

Multithreaded Computer Architecture: Dynamic Memory Analysis, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE497MF Multithreaded Computer Architecture March 3, 2004
Lecture 12
Lecturer: Matt Frank Scribe: Ben Tappel
1 Dynamic Memory Analysis
In this lecture we look at various methods for handling memory dependencies at
runtime, including methods for dynmically predicting memory dependences.
2 Conservative Approach
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.
2.1 Store Hash
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.
12-1
pf3
pf4

Partial preview of the text

Download Multithreaded Computer Architecture: Dynamic Memory Analysis and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

ECE497MF Multithreaded Computer Architecture March 3, 2004

Lecture 12

Lecturer: Matt Frank Scribe: Ben Tappel

1 Dynamic Memory Analysis

In this lecture we look at various methods for handling memory dependencies at runtime, including methods for dynmically predicting memory dependences.

2 Conservative Approach

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.

2.1 Store Hash

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.

3 Timestamp Trick

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.

If we timestamp instructions, they are inorder iff ta tb and a is after b

they are out of order iff ta  tb and a is after b

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.

References

[1] George Z. Chrysos and Joel S. Emer. Memory dependence prediction using store sets. ISCA , pages 142โ€“153, 1998.