next up previous contents
Next: Discussion of cache coherence Up: Cache Hierarchy Previous: Processing L2 data array

Cache initialization and statistics

 

Source files: src/MemSys/cache.c, src/MemSys/cache2.c, src/Processor/capconf.cc, src/MemSys/mshr.c

Header files: incl/MemSys/cache.h, incl/MemSys/stats.h, incl/Processor/capconf.h

The functions NewCache and init_cache initialize the data structures used by the cache, including the the cache-line state structures, the MSHR array, the write-back buffer, the cache pipelines, and the statistics structures.

Each data access to the cache calls StatSet to specify whether the access hit or missed, and the type of miss in the case of misses. Each cache module classifies misses into cold, conflict, capacity, and coherence misses. Capacity and conflict misses are distinguished using a structure called the CapConfDetector. The detector consists of a hash table combined with a fixed-size circular queue, both of which start empty.

Conceptually, new lines brought into the cache are put into the circular queue, which has a size equal to the number of cache lines. When the circular queue has filled up, new insertions replace the oldest element in the queue. However, before inserting a new line into the detector, the detector must first be checked to make sure that the line is not already in the queue. If it is, then a line has been brought back into the cache after being replaced in less time than its taken to refill the entire cache; consequently, it is a conflict miss. We consider a miss a capacity miss if it is not already in the queue when it is brought into the cache, as this indicates that at least as many lines as are in the cache have been brought into the cache since the last time this line was present. The hash table is used to provide a fast check of the entries available; the entries in the hash table are always the same as those in the circular queue.

The caches also keep track of the MSHR occupancy, determining the percentage of time any given number of MSHRs is in use. This statistic is calculated through an interval statistics record, described in Chapter 16.1.


next up previous contents
Next: Discussion of cache coherence Up: Cache Hierarchy Previous: Processing L2 data array

Vijay Sadananda Pai
Thu Aug 7 14:18:56 CDT 1997