Using peLIFOLite interface with LLC simulators ------------------------------------------- Step I. Invoke constructor: A pelifolite object needs to be created per bank-pair of the LLC. The constructor takes four arguments: number of sets per bank of LLC, associativity of LLC, number of banks in the LLC, and number of cores in the system. pelifolite (unsigned numSets, unsigned numWays, unsigned numBanks, unsigned numCores); ---------------------------------------------------------------------------- Step II. The LLC (and hence, the pelifolite object) changes state in one of the following four events: A. An LLC hit B. An LLC miss C. An LLC replacement D. An LLC fill In these events, the LLC simulator is expected to make the appropriate method calls in the pelifolite object. ----------------------------------------------------------------------------- A. pelifolite::UpdateOnHit (unsigned parity, unsigned set, unsigned way) The ``parity'' indicates one of the two banks in the pair (this is really a boolean value), to which the set under consideration belongs to. The ``set'' indicates the set being operated on within the bank. The ``way'' indicates the way within this set which has experienced a hit. ------------------------------------------------------------------------------ B. pelifolite::UpdateOnMiss (unsigned parity, unsigned set) The ``parity'' indicates one of the two banks in the pair (this is really a boolean value), to which the set under consideration belongs to. The ``set'' indicates the set being operated on within the bank. ------------------------------------------------------------------------------ C. pelifolite::UpdateOnReplacement (unsigned parity, unsigned set, unsigned way) The parameters passed reveal where the replacement has taken place. The bank within this bank-pair is ``parity'' (this is really a boolean value), the set within the bank is ``set'', the way within the set is ``way''. This method currently doesn't do anything and hence, need not be called. ------------------------------------------------------------------------------ D. pelifolite::UpdateOnFill (unsigned parity, unsigned set, unsigned way) The parameters passed reveal where the refill has taken place. The bank within this bank-pair is ``parity'' (this is really a boolean value), the set within the bank is ``set'', the way within the set is ``way''. ------------------------------------------------------------------------------ Step III. Whenever LLC needs to make a replacement, it makes the following call to the pelifolite object of the corresponding bank pair. Note that this call is made only when the target set has all the ways valid. unsigned pelifolite::GetReplacementCandidate (unsigned parity, unsigned set, unsigned *way) The relevant bank is ``parity'' (this is really a boolean value) within the pair and set is ``set'' within the bank. On completion of this method, (*way) contains the way of the replacement victim. The return value of this method is 0 or 1. It returns 0 if peLIFOLite fails to find a replacement victim satisfying all the necessary criteria (see MICRO'09 paper). In this case, the LLC will carry out a traditional LRU replacement and the content of (*way) is irrelevant. If peLIFOLite successfully finds an eviction candidate, it returns 1. If the return value of this call is zero, the LLC simulator is expected to invoke the baseline replacement (which is assumed to be LRU). Note that in addition to calling these methods, the LLC should be updating the states corresponding to the baseline policy e.g., LRU states, etc. ------------------------------------------------------------------------------ An example: Let's assume that we have an 8 MB LLC with 1 MB banks. This LLC will require four pelifolite objects to be constructed. Let this array be PELIFOLITE[4]. Now, let us see how each method in the pelifolite object is called when an event (one of the four discussed above) takes place in bank b, set s. Note that s is not the global set id, but the set id within a bank. Exactly how sets are distributed across banks is up to the LLC simulator. The MICRO'09 paper assumes a round-robin distribution of sets across banks. A. Hit in way w: call PELIFOLITE[b/2]->UpdateOnHit(b%2, s, w); B. Miss: call PELIFOLITE[b/2]->UpdateOnMiss(b%2, s); C. Replacement of way w: call PELIFOLITE[b/2]->UpdateOnReplacement(b%2, s, w); This can be omitted, as this method is currently empty. D. Fill into way w: call PELIFOLITE[b/2]->UpdateOnFill(b%2, s, w); If a replacement is needed from the LLC in bank b, set s, the following code should be used. if (PELIFOLITE[b/2]->GetReplacementCandidate(b%2, s, &w)) { // Replace from way w } else { // Invoke LLC baseline replacement }