gem5  v20.1.0.0
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
StoreSet Class Reference

Implements a store set predictor for determining if memory instructions are dependent upon each other. More...

#include <store_set.hh>

Public Types

typedef unsigned SSID
 

Public Member Functions

 StoreSet ()
 Default constructor. More...
 
 StoreSet (uint64_t clear_period, int SSIT_size, int LFST_size)
 Creates store set predictor with given table sizes. More...
 
 ~StoreSet ()
 Default destructor. More...
 
void init (uint64_t clear_period, int SSIT_size, int LFST_size)
 Initializes the store set predictor with the given table sizes. More...
 
void violation (Addr store_PC, Addr load_PC)
 Records a memory ordering violation between the younger load and the older store. More...
 
void checkClear ()
 Clears the store set predictor every so often so that all the entries aren't used and stores are constantly predicted as conflicting. More...
 
void insertLoad (Addr load_PC, InstSeqNum load_seq_num)
 Inserts a load into the store set predictor. More...
 
void insertStore (Addr store_PC, InstSeqNum store_seq_num, ThreadID tid)
 Inserts a store into the store set predictor. More...
 
InstSeqNum checkInst (Addr PC)
 Checks if the instruction with the given PC is dependent upon any store. More...
 
void issued (Addr issued_PC, InstSeqNum issued_seq_num, bool is_store)
 Records this PC/sequence number as issued. More...
 
void squash (InstSeqNum squashed_num, ThreadID tid)
 Squashes for a specific thread until the given sequence number. More...
 
void clear ()
 Resets all tables. More...
 
void dump ()
 Debug function to dump the contents of the store list. More...
 

Private Types

typedef std::map< InstSeqNum, int, ltseqnum >::iterator SeqNumMapIt
 

Private Member Functions

int calcIndex (Addr PC)
 Calculates the index into the SSIT based on the PC. More...
 
SSID calcSSID (Addr PC)
 Calculates a Store Set ID based on the PC. More...
 

Private Attributes

std::vector< SSIDSSIT
 The Store Set ID Table. More...
 
std::vector< bool > validSSIT
 Bit vector to tell if the SSIT has a valid entry. More...
 
std::vector< InstSeqNumLFST
 Last Fetched Store Table. More...
 
std::vector< bool > validLFST
 Bit vector to tell if the LFST has a valid entry. More...
 
std::map< InstSeqNum, int, ltseqnumstoreList
 Map of stores that have been inserted into the store set, but not yet issued or squashed. More...
 
uint64_t clearPeriod
 Number of loads/stores to process before wiping predictor so all entries don't get saturated. More...
 
int SSITSize
 Store Set ID Table size, in entries. More...
 
int LFSTSize
 Last Fetched Store Table size, in entries. More...
 
int indexMask
 Mask to obtain the index. More...
 
int offsetBits
 
int memOpsPred
 Number of memory operations predicted since last clear of predictor. More...
 

Detailed Description

Implements a store set predictor for determining if memory instructions are dependent upon each other.

See paper "Memory Dependence Prediction using Store Sets" by Chrysos and Emer. SSID stands for Store Set ID, SSIT stands for Store Set ID Table, and LFST is Last Fetched Store Table.

Definition at line 54 of file store_set.hh.

Member Typedef Documentation

◆ SeqNumMapIt

typedef std::map<InstSeqNum, int, ltseqnum>::iterator StoreSet::SeqNumMapIt
private

Definition at line 135 of file store_set.hh.

◆ SSID

typedef unsigned StoreSet::SSID

Definition at line 57 of file store_set.hh.

Constructor & Destructor Documentation

◆ StoreSet() [1/2]

StoreSet::StoreSet ( )
inline

Default constructor.

init() must be called prior to use.

Definition at line 61 of file store_set.hh.

◆ StoreSet() [2/2]

StoreSet::StoreSet ( uint64_t  clear_period,
int  SSIT_size,
int  LFST_size 
)

Creates store set predictor with given table sizes.

Definition at line 36 of file store_set.cc.

References DPRINTF, fatal, ArmISA::i, indexMask, isPowerOf2(), LFST, LFSTSize, memOpsPred, offsetBits, SSIT, SSITSize, validLFST, and validSSIT.

◆ ~StoreSet()

StoreSet::~StoreSet ( )

Default destructor.

Definition at line 74 of file store_set.cc.

Member Function Documentation

◆ calcIndex()

int StoreSet::calcIndex ( Addr  PC)
inlineprivate

Calculates the index into the SSIT based on the PC.

Definition at line 111 of file store_set.hh.

References indexMask, and offsetBits.

Referenced by checkInst(), insertStore(), issued(), and violation().

◆ calcSSID()

SSID StoreSet::calcSSID ( Addr  PC)
inlineprivate

Calculates a Store Set ID based on the PC.

Definition at line 115 of file store_set.hh.

References LFSTSize.

Referenced by violation().

◆ checkClear()

void StoreSet::checkClear ( )

Clears the store set predictor every so often so that all the entries aren't used and stores are constantly predicted as conflicting.

Definition at line 187 of file store_set.cc.

References clear(), clearPeriod, DPRINTF, and memOpsPred.

Referenced by insertLoad(), and insertStore().

◆ checkInst()

InstSeqNum StoreSet::checkInst ( Addr  PC)

Checks if the instruction with the given PC is dependent upon any store.

Returns
Returns the sequence number of the store instruction this PC is dependent upon. Returns 0 if none.

Definition at line 237 of file store_set.cc.

References calcIndex(), DPRINTF, MipsISA::index, LFST, LFSTSize, SSIT, SSITSize, validLFST, and validSSIT.

◆ clear()

void StoreSet::clear ( )

Resets all tables.

Definition at line 339 of file store_set.cc.

References ArmISA::i, LFSTSize, SSITSize, storeList, validLFST, and validSSIT.

Referenced by checkClear().

◆ dump()

void StoreSet::dump ( )

Debug function to dump the contents of the store list.

Definition at line 353 of file store_set.cc.

References cprintf(), and storeList.

◆ init()

void StoreSet::init ( uint64_t  clear_period,
int  SSIT_size,
int  LFST_size 
)

Initializes the store set predictor with the given table sizes.

Definition at line 79 of file store_set.cc.

References clearPeriod, DPRINTF, ArmISA::i, indexMask, LFST, LFSTSize, memOpsPred, offsetBits, SSIT, SSITSize, validLFST, and validSSIT.

◆ insertLoad()

void StoreSet::insertLoad ( Addr  load_PC,
InstSeqNum  load_seq_num 
)

Inserts a load into the store set predictor.

This does nothing but is included in case other predictors require a similar function.

Definition at line 199 of file store_set.cc.

References checkClear().

◆ insertStore()

void StoreSet::insertStore ( Addr  store_PC,
InstSeqNum  store_seq_num,
ThreadID  tid 
)

Inserts a store into the store set predictor.

Updates the LFST if the store has a valid SSID.

Definition at line 207 of file store_set.cc.

References calcIndex(), checkClear(), DPRINTF, MipsISA::index, LFST, LFSTSize, SSIT, SSITSize, storeList, validLFST, and validSSIT.

◆ issued()

void StoreSet::issued ( Addr  issued_PC,
InstSeqNum  issued_seq_num,
bool  is_store 
)

Records this PC/sequence number as issued.

Definition at line 272 of file store_set.cc.

References calcIndex(), DPRINTF, MipsISA::index, LFST, LFSTSize, SSIT, SSITSize, storeList, validLFST, and validSSIT.

◆ squash()

void StoreSet::squash ( InstSeqNum  squashed_num,
ThreadID  tid 
)

Squashes for a specific thread until the given sequence number.

Definition at line 309 of file store_set.cc.

References DPRINTF, LFST, storeList, and validLFST.

◆ violation()

void StoreSet::violation ( Addr  store_PC,
Addr  load_PC 
)

Records a memory ordering violation between the younger load and the older store.

Definition at line 114 of file store_set.cc.

References calcIndex(), calcSSID(), DPRINTF, LFSTSize, SSIT, SSITSize, and validSSIT.

Member Data Documentation

◆ clearPeriod

uint64_t StoreSet::clearPeriod
private

Number of loads/stores to process before wiping predictor so all entries don't get saturated.

Definition at line 140 of file store_set.hh.

Referenced by checkClear(), and init().

◆ indexMask

int StoreSet::indexMask
private

Mask to obtain the index.

Definition at line 149 of file store_set.hh.

Referenced by calcIndex(), init(), and StoreSet().

◆ LFST

std::vector<InstSeqNum> StoreSet::LFST
private

Last Fetched Store Table.

Definition at line 125 of file store_set.hh.

Referenced by checkInst(), init(), insertStore(), issued(), squash(), and StoreSet().

◆ LFSTSize

int StoreSet::LFSTSize
private

Last Fetched Store Table size, in entries.

Definition at line 146 of file store_set.hh.

Referenced by calcSSID(), checkInst(), clear(), init(), insertStore(), issued(), StoreSet(), and violation().

◆ memOpsPred

int StoreSet::memOpsPred
private

Number of memory operations predicted since last clear of predictor.

Definition at line 155 of file store_set.hh.

Referenced by checkClear(), init(), and StoreSet().

◆ offsetBits

int StoreSet::offsetBits
private

Definition at line 152 of file store_set.hh.

Referenced by calcIndex(), init(), and StoreSet().

◆ SSIT

std::vector<SSID> StoreSet::SSIT
private

The Store Set ID Table.

Definition at line 119 of file store_set.hh.

Referenced by checkInst(), init(), insertStore(), issued(), StoreSet(), and violation().

◆ SSITSize

int StoreSet::SSITSize
private

Store Set ID Table size, in entries.

Definition at line 143 of file store_set.hh.

Referenced by checkInst(), clear(), init(), insertStore(), issued(), StoreSet(), and violation().

◆ storeList

std::map<InstSeqNum, int, ltseqnum> StoreSet::storeList
private

Map of stores that have been inserted into the store set, but not yet issued or squashed.

Definition at line 133 of file store_set.hh.

Referenced by clear(), dump(), insertStore(), issued(), and squash().

◆ validLFST

std::vector<bool> StoreSet::validLFST
private

Bit vector to tell if the LFST has a valid entry.

Definition at line 128 of file store_set.hh.

Referenced by checkInst(), clear(), init(), insertStore(), issued(), squash(), and StoreSet().

◆ validSSIT

std::vector<bool> StoreSet::validSSIT
private

Bit vector to tell if the SSIT has a valid entry.

Definition at line 122 of file store_set.hh.

Referenced by checkInst(), clear(), init(), insertStore(), issued(), StoreSet(), and violation().


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:32 for gem5 by doxygen 1.8.17