gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::o3::ElasticTrace Class Reference

The elastic trace is a type of probe listener and listens to probe points in multiple stages of the O3CPU. More...

#include <elastic_trace.hh>

Inheritance diagram for gem5::o3::ElasticTrace:
gem5::ProbeListenerObject gem5::SimObject gem5::EventManager gem5::Serializable gem5::Drainable gem5::statistics::Group gem5::Named

Classes

struct  ElasticTraceStats
 
struct  InstExecInfo
 
struct  TraceInfo
 

Public Types

typedef std::pair< InstSeqNum, RegIndexSeqNumRegPair
 
typedef ProtoMessage::InstDepRecord::RecordType RecordType
 Trace record types corresponding to instruction node types.
 
typedef ProtoMessage::InstDepRecord Record
 
- Public Types inherited from gem5::SimObject
typedef SimObjectParams Params
 

Public Member Functions

 ElasticTrace (const ElasticTraceParams &params)
 Constructor.
 
void regProbeListeners ()
 Register the probe listeners that is the methods called on a probe point notify() call.
 
void regEtraceListeners ()
 Register all listeners.
 
void flushTraces ()
 Process any outstanding trace records, flush them out to the protobuf output streams and delete the streams at simulation exit.
 
void fetchReqTrace (const RequestPtr &req)
 Take the fields of the request class object that are relevant to create an instruction fetch request.
 
void recordExecTick (const DynInstConstPtr &dyn_inst)
 Populate the execute timestamp field in an InstExecInfo object for an instruction in flight.
 
void recordToCommTick (const DynInstConstPtr &dyn_inst)
 Populate the timestamp field in an InstExecInfo object for an instruction in flight when it is execution is complete and it is ready to commit.
 
void updateRegDep (const DynInstConstPtr &dyn_inst)
 Record a Read After Write physical register dependency if there has been a write to the source register and update the physical register map.
 
void removeRegDepMapEntry (const SeqNumRegPair &inst_reg_pair)
 When an instruction gets squashed the destination register mapped to it is freed up in the rename stage.
 
void addSquashedInst (const DynInstConstPtr &head_inst)
 Add an instruction that is at the head of the ROB and is squashed only if it is a load and a request was sent for it.
 
void addCommittedInst (const DynInstConstPtr &head_inst)
 Add an instruction that is at the head of the ROB and is committed.
 
- Public Member Functions inherited from gem5::ProbeListenerObject
 ProbeListenerObject (const ProbeListenerObjectParams &params)
 
virtual ~ProbeListenerObject ()
 
ProbeManagergetProbeManager ()
 
- Public Member Functions inherited from gem5::SimObject
const Paramsparams () const
 
 SimObject (const Params &p)
 
virtual ~SimObject ()
 
virtual void init ()
 init() is called after all C++ SimObjects have been created and all ports are connected.
 
virtual void loadState (CheckpointIn &cp)
 loadState() is called on each SimObject when restoring from a checkpoint.
 
virtual void initState ()
 initState() is called on each SimObject when not restoring from a checkpoint.
 
virtual void regProbePoints ()
 Register probe points for this object.
 
ProbeManagergetProbeManager ()
 Get the probe manager for this object.
 
virtual PortgetPort (const std::string &if_name, PortID idx=InvalidPortID)
 Get a port with a given name and index.
 
virtual void startup ()
 startup() is the final initialization call before simulation.
 
DrainState drain () override
 Provide a default implementation of the drain interface for objects that don't need draining.
 
virtual void memWriteback ()
 Write back dirty buffers to memory using functional writes.
 
virtual void memInvalidate ()
 Invalidate the contents of memory buffers.
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
- Public Member Functions inherited from gem5::EventManager
EventQueueeventQueue () const
 
void schedule (Event &event, Tick when)
 
void deschedule (Event &event)
 
void reschedule (Event &event, Tick when, bool always=false)
 
void schedule (Event *event, Tick when)
 
void deschedule (Event *event)
 
void reschedule (Event *event, Tick when, bool always=false)
 
void wakeupEventQueue (Tick when=(Tick) -1)
 This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers.
 
void setCurTick (Tick newVal)
 
 EventManager (EventManager &em)
 Event manger manages events in the event queue.
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object.
 
virtual void notifyFork ()
 Notify a child process of a fork.
 
- Public Member Functions inherited from gem5::statistics::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group.
 
virtual ~Group ()
 
virtual void regStats ()
 Callback to set stat parameters.
 
virtual void resetStats ()
 Callback to reset stats.
 
virtual void preDumpStats ()
 Callback before stats are dumped.
 
void addStat (statistics::Info *info)
 Register a stat with this group.
 
const std::map< std::string, Group * > & getStatGroups () const
 Get all child groups associated with this object.
 
const std::vector< Info * > & getStats () const
 Get all stats associated with this object.
 
void addStatGroup (const char *name, Group *block)
 Add a stat block as a child of this block.
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group.
 
void mergeStatGroup (Group *block)
 Merge the contents (stats & children) of a block to this block.
 
 Group ()=delete
 
 Group (const Group &)=delete
 
Groupoperator= (const Group &)=delete
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 

Public Attributes

EventFunctionWrapper regEtraceListenersEvent
 Event to trigger registering this listener for all probe points.
 

Private Types

typedef std::vector< TraceInfo * >::iterator depTraceItr
 Typedef of iterator to the instruction dependency trace.
 
typedef std::reverse_iterator< depTraceItrdepTraceRevItr
 Typedef of the reverse iterator to the instruction dependency trace.
 

Private Member Functions

void addDepTraceRecord (const DynInstConstPtr &head_inst, InstExecInfo *exec_info_ptr, bool commit)
 Add a record to the dependency trace depTrace which is a sequential container.
 
void clearTempStoreUntil (const DynInstConstPtr &head_inst)
 Clear entries in the temporary store of execution info objects to free allocated memory until the present instruction being added to the trace.
 
void compDelayRob (TraceInfo *past_record, TraceInfo *new_record)
 Calculate the computational delay between an instruction and a subsequent instruction that has an ROB (order) dependency on it.
 
void compDelayPhysRegDep (TraceInfo *past_record, TraceInfo *new_record)
 Calculate the computational delay between an instruction and a subsequent instruction that has a Physical Register (data) dependency on it.
 
void writeDepTrace (uint32_t num_to_write)
 Write out given number of records to the trace starting with the first record in depTrace and iterating through the trace in sequence.
 
void updateCommitOrderDep (TraceInfo *new_record, bool find_load_not_store)
 Reverse iterate through the graph, search for a store-after-store or store-after-load dependency and update the new node's Rob dependency list.
 
void updateIssueOrderDep (TraceInfo *new_record)
 Reverse iterate through the graph, search for an issue order dependency for a new node and update the new node's Rob dependency list.
 
void assignRobDep (TraceInfo *past_record, TraceInfo *new_record)
 The new_record has an order dependency on a past_record, thus update the new record's Rob dependency list and increment the number of dependents of the past record.
 
bool hasStoreCommitted (TraceInfo *past_record, Tick execute_tick) const
 Check if past record is a store sent earlier than the execute tick.
 
bool hasLoadCompleted (TraceInfo *past_record, Tick execute_tick) const
 Check if past record is a load that completed earlier than the execute tick.
 
bool hasLoadBeenSent (TraceInfo *past_record, Tick execute_tick) const
 Check if past record is a load sent earlier than the execute tick.
 
bool hasCompCompleted (TraceInfo *past_record, Tick execute_tick) const
 Check if past record is a comp node that completed earlier than the execute tick.
 

Private Attributes

bool firstWin
 Used for checking the first window for processing and writing of dependency trace.
 
std::unordered_map< InstSeqNum, InstExecInfo * > tempStore
 Temporary store of InstExecInfo objects.
 
InstSeqNum lastClearedSeqNum
 The last cleared instruction sequence number used to free up the memory allocated in the temporary store.
 
std::unordered_map< RegIndex, InstSeqNumphysRegDepMap
 Map for recording the producer of a physical register to check Read After Write dependencies.
 
std::vector< TraceInfo * > depTrace
 The instruction dependency trace containing TraceInfo objects.
 
std::unordered_map< InstSeqNum, TraceInfo * > traceInfoMap
 Map where the instruction sequence number is mapped to the pointer to the TraceInfo object.
 
uint32_t depWindowSize
 The maximum distance for a dependency and is set by a top level level parameter.
 
ProtoOutputStreamdataTraceStream
 Protobuf output stream for data dependency trace.
 
ProtoOutputStreaminstTraceStream
 Protobuf output stream for instruction fetch trace.
 
const InstSeqNum startTraceInst
 Number of instructions after which to enable tracing.
 
bool allProbesReg
 Whther the elastic trace listener has been registered for all probes.
 
const bool traceVirtAddr
 Whether to trace virtual addresses for memory requests.
 
CPUcpu
 Pointer to the O3CPU that is this listener's parent a.k.a.
 
gem5::o3::ElasticTrace::ElasticTraceStats stats
 

Additional Inherited Members

- Static Public Member Functions inherited from gem5::SimObject
static void serializeAll (const std::string &cpt_dir)
 Create a checkpoint by serializing all SimObjects in the system.
 
static SimObjectfind (const char *name)
 Find the SimObject with the given name and return a pointer to it.
 
static void setSimObjectResolver (SimObjectResolver *resolver)
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
static SimObjectResolvergetSimObjectResolver ()
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain.
 
void signalDrainDone () const
 Signal that an object is drained.
 
- Protected Attributes inherited from gem5::ProbeListenerObject
ProbeManagermanager
 
std::vector< ProbeListener * > listeners
 
- Protected Attributes inherited from gem5::SimObject
const SimObjectParams & _params
 Cached copy of the object parameters.
 
- Protected Attributes inherited from gem5::EventManager
EventQueueeventq
 A pointer to this object's event queue.
 

Detailed Description

The elastic trace is a type of probe listener and listens to probe points in multiple stages of the O3CPU.

The notify method is called on a probe point typically when an instruction successfully progresses through that stage.

As different listener methods mapped to the different probe points execute, relevant information about the instruction, e.g. timestamps and register accesses, are captured and stored in temporary data structures. When the instruction progresses through the commit stage, the timing as well as dependency information about the instruction is finalised and encapsulated in a struct called TraceInfo. TraceInfo objects are collected in a list instead of writing them out to the trace file one a time. This is required as the trace is processed in chunks to evaluate order dependencies and computational delay in case an instruction does not have any register dependencies. By this we achieve a simpler algorithm during replay because every record in the trace can be hooked onto a record in its past. The trace is written out as a protobuf format output file.

The output trace can be read in and played back by the TraceCPU.

Definition at line 93 of file elastic_trace.hh.

Member Typedef Documentation

◆ depTraceItr

Typedef of iterator to the instruction dependency trace.

Definition at line 338 of file elastic_trace.hh.

◆ depTraceRevItr

typedef std::reverse_iterator<depTraceItr> gem5::o3::ElasticTrace::depTraceRevItr
private

Typedef of the reverse iterator to the instruction dependency trace.

Definition at line 341 of file elastic_trace.hh.

◆ Record

typedef ProtoMessage::InstDepRecord gem5::o3::ElasticTrace::Record

Definition at line 101 of file elastic_trace.hh.

◆ RecordType

typedef ProtoMessage::InstDepRecord::RecordType gem5::o3::ElasticTrace::RecordType

Trace record types corresponding to instruction node types.

Definition at line 100 of file elastic_trace.hh.

◆ SeqNumRegPair

Constructor & Destructor Documentation

◆ ElasticTrace()

gem5::o3::ElasticTrace::ElasticTrace ( const ElasticTraceParams & params)

Constructor.

Definition at line 54 of file elastic_trace.cc.

References regEtraceListeners().

Member Function Documentation

◆ addCommittedInst()

void gem5::o3::ElasticTrace::addCommittedInst ( const DynInstConstPtr & head_inst)

Add an instruction that is at the head of the ROB and is committed.

Parameters
head_instpointer to dynamic instruction to be committed

Definition at line 336 of file elastic_trace.cc.

References addDepTraceRecord(), clearTempStoreUntil(), DPRINTF, DPRINTFR, gem5::o3::ElasticTrace::InstExecInfo::executeTick, gem5::MaxTick, gem5::NoFault, tempStore, and gem5::o3::ElasticTrace::InstExecInfo::toCommitTick.

Referenced by regEtraceListeners().

◆ addDepTraceRecord()

void gem5::o3::ElasticTrace::addDepTraceRecord ( const DynInstConstPtr & head_inst,
InstExecInfo * exec_info_ptr,
bool commit )
private

Add a record to the dependency trace depTrace which is a sequential container.

A record is inserted per committed instruction and in the same order as the order in which instructions are committed.

Parameters
head_instPointer to the instruction which is head of the ROB and ready to commit
exec_info_ptrPointer to InstExecInfo for that instruction
commitTrue if instruction is committed, false if squashed

Definition at line 395 of file elastic_trace.cc.

References gem5::o3::ElasticTrace::TraceInfo::commit, gem5::o3::ElasticTrace::TraceInfo::commitTick, gem5::o3::ElasticTrace::TraceInfo::compDelay, compDelayPhysRegDep(), gem5::curTick(), depTrace, depWindowSize, DPRINTF, gem5::o3::ElasticTrace::InstExecInfo::executeTick, gem5::o3::ElasticTrace::TraceInfo::executeTick, firstWin, gem5::o3::ElasticTrace::TraceInfo::instNum, gem5::o3::ElasticTrace::TraceInfo::numDepts, gem5::o3::ElasticTrace::ElasticTraceStats::numRegDep, gem5::o3::ElasticTrace::TraceInfo::pc, gem5::o3::ElasticTrace::TraceInfo::physAddr, gem5::o3::ElasticTrace::TraceInfo::physRegDepList, gem5::o3::ElasticTrace::InstExecInfo::physRegDepSet, gem5::o3::ElasticTrace::TraceInfo::reqFlags, gem5::o3::ElasticTrace::TraceInfo::robDepList, gem5::o3::ElasticTrace::TraceInfo::size, stats, gem5::o3::ElasticTrace::InstExecInfo::toCommitTick, gem5::o3::ElasticTrace::TraceInfo::toCommitTick, traceInfoMap, gem5::o3::ElasticTrace::TraceInfo::type, updateCommitOrderDep(), updateIssueOrderDep(), gem5::o3::ElasticTrace::TraceInfo::virtAddr, and writeDepTrace().

Referenced by addCommittedInst(), and addSquashedInst().

◆ addSquashedInst()

void gem5::o3::ElasticTrace::addSquashedInst ( const DynInstConstPtr & head_inst)

Add an instruction that is at the head of the ROB and is squashed only if it is a load and a request was sent for it.

Parameters
head_instpointer to dynamic instruction to be squashed

Definition at line 308 of file elastic_trace.cc.

References addDepTraceRecord(), clearTempStoreUntil(), DPRINTFR, gem5::o3::ElasticTrace::InstExecInfo::executeTick, gem5::MaxTick, gem5::NoFault, tempStore, and gem5::o3::ElasticTrace::InstExecInfo::toCommitTick.

Referenced by regEtraceListeners().

◆ assignRobDep()

void gem5::o3::ElasticTrace::assignRobDep ( TraceInfo * past_record,
TraceInfo * new_record )
private

The new_record has an order dependency on a past_record, thus update the new record's Rob dependency list and increment the number of dependents of the past record.

Parameters
new_recordpointer to new record
past_recordpointer to record that new_record has a rob dependency on

Definition at line 610 of file elastic_trace.cc.

References compDelayRob(), DPRINTF, gem5::o3::ElasticTrace::TraceInfo::instNum, gem5::o3::ElasticTrace::ElasticTraceStats::maxNumDependents, gem5::o3::ElasticTrace::TraceInfo::numDepts, gem5::o3::ElasticTrace::TraceInfo::robDepList, stats, gem5::o3::ElasticTrace::TraceInfo::typeToStr(), and gem5::statistics::ScalarBase< Derived, Stor >::value().

Referenced by updateCommitOrderDep(), and updateIssueOrderDep().

◆ clearTempStoreUntil()

void gem5::o3::ElasticTrace::clearTempStoreUntil ( const DynInstConstPtr & head_inst)
private

Clear entries in the temporary store of execution info objects to free allocated memory until the present instruction being added to the trace.

Parameters
head_instpointer to dynamic instruction

Definition at line 657 of file elastic_trace.cc.

References lastClearedSeqNum, and tempStore.

Referenced by addCommittedInst(), and addSquashedInst().

◆ compDelayPhysRegDep()

void gem5::o3::ElasticTrace::compDelayPhysRegDep ( TraceInfo * past_record,
TraceInfo * new_record )
private

Calculate the computational delay between an instruction and a subsequent instruction that has a Physical Register (data) dependency on it.

Parameters
past_recordPointer to instruction
new_recordPointer to subsequent instruction having a Physical Register dependency on the instruction pointed to by past_record

Definition at line 722 of file elastic_trace.cc.

References gem5::o3::ElasticTrace::TraceInfo::commitTick, gem5::o3::ElasticTrace::TraceInfo::compDelay, DPRINTF, gem5::o3::ElasticTrace::TraceInfo::getExecuteTick(), gem5::o3::ElasticTrace::TraceInfo::instNum, gem5::o3::ElasticTrace::TraceInfo::isStore(), and gem5::o3::ElasticTrace::TraceInfo::toCommitTick.

Referenced by addDepTraceRecord().

◆ compDelayRob()

void gem5::o3::ElasticTrace::compDelayRob ( TraceInfo * past_record,
TraceInfo * new_record )
private

Calculate the computational delay between an instruction and a subsequent instruction that has an ROB (order) dependency on it.

Parameters
past_recordPointer to instruction
new_recordPointer to subsequent instruction having an ROB dependency on the instruction pointed to by past_record

Definition at line 679 of file elastic_trace.cc.

References gem5::o3::ElasticTrace::TraceInfo::commitTick, gem5::o3::ElasticTrace::TraceInfo::compDelay, DPRINTF, gem5::o3::ElasticTrace::TraceInfo::executeTick, gem5::o3::ElasticTrace::TraceInfo::getExecuteTick(), gem5::o3::ElasticTrace::TraceInfo::instNum, gem5::o3::ElasticTrace::TraceInfo::isComp(), gem5::o3::ElasticTrace::TraceInfo::isLoad(), gem5::o3::ElasticTrace::TraceInfo::isStore(), and gem5::o3::ElasticTrace::TraceInfo::toCommitTick.

Referenced by assignRobDep().

◆ fetchReqTrace()

void gem5::o3::ElasticTrace::fetchReqTrace ( const RequestPtr & req)

Take the fields of the request class object that are relevant to create an instruction fetch request.

It creates a protobuf message containing the request fields and writes it to instTraceStream.

Parameters
reqpointer to the fetch request

Definition at line 151 of file elastic_trace.cc.

References gem5::curTick(), DPRINTFR, instTraceStream, gem5::MemCmd::ReadReq, and ProtoOutputStream::write().

Referenced by regEtraceListeners().

◆ flushTraces()

void gem5::o3::ElasticTrace::flushTraces ( )

Process any outstanding trace records, flush them out to the protobuf output streams and delete the streams at simulation exit.

Definition at line 919 of file elastic_trace.cc.

References dataTraceStream, depTrace, instTraceStream, and writeDepTrace().

◆ hasCompCompleted()

bool gem5::o3::ElasticTrace::hasCompCompleted ( TraceInfo * past_record,
Tick execute_tick ) const
private

Check if past record is a comp node that completed earlier than the execute tick.

Parameters
past_recordpointer to past comp node
execute_ticktick with which to compare past comp node's completion tick
Returns
true if past record is comp completed earlier

Definition at line 650 of file elastic_trace.cc.

References gem5::o3::ElasticTrace::TraceInfo::isComp(), and gem5::o3::ElasticTrace::TraceInfo::toCommitTick.

Referenced by updateIssueOrderDep().

◆ hasLoadBeenSent()

bool gem5::o3::ElasticTrace::hasLoadBeenSent ( TraceInfo * past_record,
Tick execute_tick ) const
private

Check if past record is a load sent earlier than the execute tick.

Parameters
past_recordpointer to past load
execute_ticktick with which to compare past load's send tick
Returns
true if past record is load sent earlier

Definition at line 641 of file elastic_trace.cc.

References gem5::o3::ElasticTrace::TraceInfo::commit, gem5::o3::ElasticTrace::TraceInfo::executeTick, and gem5::o3::ElasticTrace::TraceInfo::isLoad().

Referenced by updateIssueOrderDep().

◆ hasLoadCompleted()

bool gem5::o3::ElasticTrace::hasLoadCompleted ( TraceInfo * past_record,
Tick execute_tick ) const
private

Check if past record is a load that completed earlier than the execute tick.

Parameters
past_recordpointer to past load
execute_ticktick with which to compare past load's complete tick
Returns
true if past record is load completed earlier

Definition at line 633 of file elastic_trace.cc.

References gem5::o3::ElasticTrace::TraceInfo::commit, gem5::o3::ElasticTrace::TraceInfo::isLoad(), and gem5::o3::ElasticTrace::TraceInfo::toCommitTick.

Referenced by updateCommitOrderDep().

◆ hasStoreCommitted()

bool gem5::o3::ElasticTrace::hasStoreCommitted ( TraceInfo * past_record,
Tick execute_tick ) const
private

Check if past record is a store sent earlier than the execute tick.

Parameters
past_recordpointer to past store
execute_ticktick with which to compare past store's commit tick
Returns
true if past record is store sent earlier

Definition at line 626 of file elastic_trace.cc.

References gem5::o3::ElasticTrace::TraceInfo::commitTick, and gem5::o3::ElasticTrace::TraceInfo::isStore().

Referenced by updateCommitOrderDep(), and updateIssueOrderDep().

◆ recordExecTick()

void gem5::o3::ElasticTrace::recordExecTick ( const DynInstConstPtr & dyn_inst)

Populate the execute timestamp field in an InstExecInfo object for an instruction in flight.

Parameters
dyn_instpointer to dynamic instruction in flight

Definition at line 173 of file elastic_trace.cc.

References gem5::curTick(), DPRINTFR, gem5::o3::ElasticTrace::InstExecInfo::executeTick, lastClearedSeqNum, gem5::o3::ElasticTrace::ElasticTraceStats::maxTempStoreSize, stats, tempStore, and gem5::statistics::ScalarBase< Derived, Stor >::value().

Referenced by regEtraceListeners().

◆ recordToCommTick()

void gem5::o3::ElasticTrace::recordToCommTick ( const DynInstConstPtr & dyn_inst)

Populate the timestamp field in an InstExecInfo object for an instruction in flight when it is execution is complete and it is ready to commit.

Parameters
dyn_instpointer to dynamic instruction in flight

Definition at line 210 of file elastic_trace.cc.

References gem5::curTick(), DPRINTFR, tempStore, and gem5::o3::ElasticTrace::InstExecInfo::toCommitTick.

Referenced by regEtraceListeners().

◆ regEtraceListeners()

◆ regProbeListeners()

void gem5::o3::ElasticTrace::regProbeListeners ( )
virtual

Register the probe listeners that is the methods called on a probe point notify() call.

Reimplemented from gem5::SimObject.

Definition at line 104 of file elastic_trace.cc.

References cpu, gem5::curTick(), gem5::BaseCPU::getContext(), inform, regEtraceListeners(), regEtraceListenersEvent, gem5::ThreadContext::scheduleInstCountEvent(), and startTraceInst.

◆ removeRegDepMapEntry()

void gem5::o3::ElasticTrace::removeRegDepMapEntry ( const SeqNumRegPair & inst_reg_pair)

When an instruction gets squashed the destination register mapped to it is freed up in the rename stage.

Remove the register entry from the physRegDepMap as well to avoid dependencies on squashed instructions.

Parameters
inst_reg_pairpair of inst. sequence no. and the register

Definition at line 298 of file elastic_trace.cc.

References DPRINTFR, and physRegDepMap.

Referenced by regEtraceListeners().

◆ updateCommitOrderDep()

void gem5::o3::ElasticTrace::updateCommitOrderDep ( TraceInfo * new_record,
bool find_load_not_store )
private

Reverse iterate through the graph, search for a store-after-store or store-after-load dependency and update the new node's Rob dependency list.

If a dependency is found, then call the assignRobDep() method that updates the store with the dependency information. This function is only called when a new store node is added to the trace.

Parameters
new_recordpointer to new store record
find_load_not_storetrue for searching store-after-load and false for searching store-after-store dependency

Definition at line 523 of file elastic_trace.cc.

References assignRobDep(), gem5::curTick(), depTrace, depWindowSize, hasLoadCompleted(), hasStoreCommitted(), gem5::o3::ElasticTrace::TraceInfo::isStore(), gem5::o3::ElasticTrace::ElasticTraceStats::numRegDep, and stats.

Referenced by addDepTraceRecord().

◆ updateIssueOrderDep()

void gem5::o3::ElasticTrace::updateIssueOrderDep ( TraceInfo * new_record)
private

Reverse iterate through the graph, search for an issue order dependency for a new node and update the new node's Rob dependency list.

If a dependency is found, call the assignRobDep() method that updates the node with its dependency information. This function is called in case a new node to be added to the trace is dependency-free or its dependency got discarded because the dependency was outside the window.

Parameters
new_recordpointer to new record to be added to the trace

Definition at line 564 of file elastic_trace.cc.

References assignRobDep(), gem5::curTick(), depTrace, depWindowSize, gem5::o3::ElasticTrace::TraceInfo::executeTick, hasCompCompleted(), hasLoadBeenSent(), hasStoreCommitted(), gem5::o3::ElasticTrace::TraceInfo::isLoad(), gem5::o3::ElasticTrace::TraceInfo::isStore(), gem5::o3::ElasticTrace::ElasticTraceStats::numIssueOrderDepLoads, gem5::o3::ElasticTrace::ElasticTraceStats::numIssueOrderDepOther, gem5::o3::ElasticTrace::ElasticTraceStats::numIssueOrderDepStores, stats, and gem5::o3::ElasticTrace::TraceInfo::toCommitTick.

Referenced by addDepTraceRecord().

◆ updateRegDep()

void gem5::o3::ElasticTrace::updateRegDep ( const DynInstConstPtr & dyn_inst)

Record a Read After Write physical register dependency if there has been a write to the source register and update the physical register map.

For this look up the physRegDepMap with this instruction as the writer of its destination register. If the dependency falls outside the window it is assumed as already complete. Duplicate entries are avoided.

Parameters
dyn_instpointer to dynamic instruction in flight

Definition at line 231 of file elastic_trace.cc.

References gem5::PhysRegId::className(), gem5::RegId::className(), depWindowSize, DPRINTFR, gem5::PhysRegId::flatIndex(), gem5::InvalidRegClass, gem5::RegId::is(), lastClearedSeqNum, gem5::o3::ElasticTrace::ElasticTraceStats::maxPhysRegDepMapSize, gem5::MiscRegClass, physRegDepMap, gem5::o3::ElasticTrace::InstExecInfo::physRegDepSet, stats, tempStore, and gem5::statistics::ScalarBase< Derived, Stor >::value().

Referenced by regEtraceListeners().

◆ writeDepTrace()

Member Data Documentation

◆ allProbesReg

bool gem5::o3::ElasticTrace::allProbesReg
private

Whther the elastic trace listener has been registered for all probes.

When enabling tracing after a specified number of instructions have committed, check this to prevent re-registering the listener.

Definition at line 366 of file elastic_trace.hh.

Referenced by regEtraceListeners().

◆ cpu

CPU* gem5::o3::ElasticTrace::cpu
private

Pointer to the O3CPU that is this listener's parent a.k.a.

manager

Definition at line 372 of file elastic_trace.hh.

Referenced by regEtraceListeners(), and regProbeListeners().

◆ dataTraceStream

ProtoOutputStream* gem5::o3::ElasticTrace::dataTraceStream
private

Protobuf output stream for data dependency trace.

Definition at line 352 of file elastic_trace.hh.

Referenced by flushTraces(), and writeDepTrace().

◆ depTrace

std::vector<TraceInfo*> gem5::o3::ElasticTrace::depTrace
private

The instruction dependency trace containing TraceInfo objects.

The container implemented is sequential as dependencies obey commit order (program order). For example, if B is dependent on A then B must be committed after A. Thus records are updated with dependency information and written to the trace in commit order. This ensures that when a graph is reconstructed from the trace during replay, all the dependencies are stored in the graph before the dependent itself is added. This facilitates creating a tree data structure during replay, i.e. adding children as records are read from the trace in an efficient manner.

Definition at line 329 of file elastic_trace.hh.

Referenced by addDepTraceRecord(), flushTraces(), updateCommitOrderDep(), updateIssueOrderDep(), and writeDepTrace().

◆ depWindowSize

uint32_t gem5::o3::ElasticTrace::depWindowSize
private

The maximum distance for a dependency and is set by a top level level parameter.

It must be equal to or greater than the number of entries in the ROB. This variable is used as the length of the sliding window for processing the dependency trace.

Definition at line 349 of file elastic_trace.hh.

Referenced by addDepTraceRecord(), updateCommitOrderDep(), updateIssueOrderDep(), and updateRegDep().

◆ firstWin

bool gem5::o3::ElasticTrace::firstWin
private

Used for checking the first window for processing and writing of dependency trace.

At the start of the program there can be dependency- free instructions and such cases are handled differently.

Definition at line 191 of file elastic_trace.hh.

Referenced by addDepTraceRecord(), and writeDepTrace().

◆ instTraceStream

ProtoOutputStream* gem5::o3::ElasticTrace::instTraceStream
private

Protobuf output stream for instruction fetch trace.

Definition at line 355 of file elastic_trace.hh.

Referenced by fetchReqTrace(), and flushTraces().

◆ lastClearedSeqNum

InstSeqNum gem5::o3::ElasticTrace::lastClearedSeqNum
private

The last cleared instruction sequence number used to free up the memory allocated in the temporary store.

Definition at line 237 of file elastic_trace.hh.

Referenced by clearTempStoreUntil(), recordExecTick(), and updateRegDep().

◆ physRegDepMap

std::unordered_map<RegIndex, InstSeqNum> gem5::o3::ElasticTrace::physRegDepMap
private

Map for recording the producer of a physical register to check Read After Write dependencies.

The key is the renamed physical register and the value is the instruction sequence number of its last producer.

Definition at line 244 of file elastic_trace.hh.

Referenced by removeRegDepMapEntry(), and updateRegDep().

◆ regEtraceListenersEvent

EventFunctionWrapper gem5::o3::ElasticTrace::regEtraceListenersEvent

Event to trigger registering this listener for all probe points.

Definition at line 183 of file elastic_trace.hh.

Referenced by regProbeListeners().

◆ startTraceInst

const InstSeqNum gem5::o3::ElasticTrace::startTraceInst
private

Number of instructions after which to enable tracing.

Definition at line 358 of file elastic_trace.hh.

Referenced by regProbeListeners().

◆ stats

◆ tempStore

std::unordered_map<InstSeqNum, InstExecInfo*> gem5::o3::ElasticTrace::tempStore
private

Temporary store of InstExecInfo objects.

Later on when an instruction is processed for commit or retire, if it is chosen to be written to the output trace then this information is looked up using the instruction sequence number as the key. If it is not chosen then the entry for it in the store is cleared.

Definition at line 231 of file elastic_trace.hh.

Referenced by addCommittedInst(), addSquashedInst(), clearTempStoreUntil(), recordExecTick(), recordToCommTick(), and updateRegDep().

◆ traceInfoMap

std::unordered_map<InstSeqNum, TraceInfo*> gem5::o3::ElasticTrace::traceInfoMap
private

Map where the instruction sequence number is mapped to the pointer to the TraceInfo object.

Definition at line 335 of file elastic_trace.hh.

Referenced by addDepTraceRecord(), and writeDepTrace().

◆ traceVirtAddr

const bool gem5::o3::ElasticTrace::traceVirtAddr
private

Whether to trace virtual addresses for memory requests.

Definition at line 369 of file elastic_trace.hh.

Referenced by writeDepTrace().


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

Generated on Tue Jun 18 2024 16:24:20 for gem5 by doxygen 1.11.0