41#ifndef __CPU_O3_COMMIT_HH__
42#define __CPU_O3_COMMIT_HH__
56#include "enums/CommitPolicy.hh"
62struct BaseO3CPUParams;
135 Commit(
CPU *_cpu,
const BaseO3CPUParams ¶ms);
138 std::string
name()
const;
Cycles is a wrapper class for representing cycle counts, i.e.
ProbePointArg generates a point for the class of Arg.
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
Commit handles single threaded and SMT commit.
ThreadStatus commitStatus[MaxThreads]
Per-thread status.
TimeBuffer< IEWStruct >::wire fromIEW
Wire to read information from IEW queue.
std::vector< ThreadState * > thread
Vector of all of the threads.
ThreadID oldestReady()
Returns the thread ID to use based on an oldest instruction policy.
ProbePointArg< DynInstPtr > * ppCommitStall
void squashFromSquashAfter(ThreadID tid)
Handles a squash from a squashAfter() request.
void squashAll(ThreadID tid)
Squashes all in flight instructions.
void pcState(const PCStateBase &val, ThreadID tid)
Sets the PC of a specific thread.
void startupStage()
Initializes stage by sending back the number of free entries.
bool changedROBNumEntries[MaxThreads]
Records if the number of ROB entries has changed this cycle.
bool changedROBEntries()
Returns if any of the threads have the number of ROB entries changed on this cycle.
DynInstPtr squashAfterInst[MaxThreads]
Instruction passed to squashAfter().
bool executingHtmTransaction(ThreadID) const
Is the CPU currently processing a HTM transaction?
CommitStatus _status
Overall commit status.
gem5::o3::Commit::CommitStats stats
void setIEWQueue(TimeBuffer< IEWStruct > *iq_ptr)
Sets the pointer to the queue coming from IEW.
size_t numROBFreeEntries(ThreadID tid)
Returns the number of free ROB entries for a specific thread.
void setFetchQueue(TimeBuffer< FetchStruct > *fq_ptr)
void processTrapEvent(ThreadID tid)
Mark the thread as processing a trap.
void setRenameQueue(TimeBuffer< RenameStruct > *rq_ptr)
Sets the pointer to the queue coming from rename.
bool checkEmptyROB[MaxThreads]
Records if commit should check if the ROB is truly empty (see commit_impl.hh).
void generateTrapEvent(ThreadID tid, Fault inst_fault)
Generates an event to schedule a squash due to a trap.
void deactivateThread(ThreadID tid)
Deschedules a thread from scheduling.
TimeBuffer< TimeStruct >::wire toIEW
Wire to write information heading to previous stages.
CPU * cpu
Pointer to O3CPU.
void squashFromTC(ThreadID tid)
Handles squashing due to an TC write.
ThreadStatus
Individual thread status.
const ThreadID numThreads
Number of Active Threads.
ProbePointArg< DynInstPtr > * ppSquash
To probe when an instruction is squashed.
Commit(CPU *_cpu, const BaseO3CPUParams ¶ms)
Construct a Commit with the given parameters.
bool trapInFlight[MaxThreads]
Records if there is a trap currently in flight.
void handleInterrupt()
Handles processing an interrupt.
const Cycles fetchToCommitDelay
void propagateInterrupt()
Get fetch redirecting so we can handle an interrupt.
std::string name() const
Returns the name of the Commit.
TimeBuffer< FetchStruct > * fetchQueue
void setROB(ROB *rob_ptr)
Sets pointer to the ROB.
int htmStarts[MaxThreads]
CommitPolicy commitPolicy
Commit policy used in SMT mode.
TimeBuffer< TimeStruct >::wire robInfoFromIEW
Wire to read information from IEW (for ROB).
void tick()
Ticks the commit stage, which tries to commit instructions.
void setIEWStage(IEW *iew_stage)
Sets the pointer to the IEW stage.
const unsigned renameWidth
Rename width, in instructions.
bool drainPending
Is a drain pending? Commit is looking for an instruction boundary while there are no pending interrup...
const Cycles trapLatency
The latency to handle a trap.
ProbePointArg< DynInstPtr > * ppCommit
Probe Points.
bool wroteToTimeBuffer
Records that commit has written to the time buffer this cycle.
TimeBuffer< IEWStruct > * iewQueue
IEW instruction queue interface.
void setTimeBuffer(TimeBuffer< TimeStruct > *tb_ptr)
Sets the main time buffer pointer, used for backwards communication.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to list of active threads.
const Cycles renameToROBDelay
Rename to ROB delay.
std::list< ThreadID > * activeThreads
Pointer to the list of active threads.
const PCStateBase & pcState(ThreadID tid)
Reads the PC of a specific thread.
void updateStatus()
Updates the overall status of commit with the nextStatus, and tell the CPU if commit is active/inacti...
void squashAfter(ThreadID tid, const DynInstPtr &head_inst)
Handle squashing from instruction with SquashAfter set.
bool commitHead(const DynInstPtr &head_inst, unsigned inst_num)
Tries to commit the head ROB instruction passed in.
void resetHtmStartsStops(ThreadID)
void getInsts()
Gets instructions from rename and inserts them into the ROB.
bool tcSquash[MaxThreads]
Records if a thread has to squash this cycle due to an XC write.
const Cycles commitToIEWDelay
Commit to IEW delay.
void drainSanityCheck() const
Perform sanity checks after a drain.
void takeOverFrom()
Takes over from another CPU's thread.
void clearStates(ThreadID tid)
Clear all thread-specific states.
void drainResume()
Resumes execution after draining.
CommitStatus
Overall commit status.
TimeBuffer< RenameStruct > * renameQueue
Rename instruction queue interface, for ROB.
void drain()
Initializes the draining of commit.
bool trapSquash[MaxThreads]
Records if a thread has to squash this cycle due to a trap.
InstSeqNum youngestSeqNum[MaxThreads]
The sequence number of the youngest valid instruction in the ROB.
InstSeqNum lastCommitedSeqNum[MaxThreads]
The sequence number of the last commited instruction.
CommitStatus _nextStatus
Next commit status, to be set at the end of the cycle.
bool drainImminent
Is a drain imminent? Commit has found an instruction boundary while no interrupts were present or in ...
void commitInsts()
Commits as many instructions as possible.
void markCompletedInsts()
Marks completed instructions using information sent from IEW.
bool canHandleInterrupts
True if last committed microop can be followed by an interrupt.
TimeBuffer< TimeStruct > * timeBuffer
Time buffer interface.
TimeBuffer< RenameStruct >::wire fromRename
Wire to read information from rename queue.
ThreadID roundRobin()
Returns the thread ID to use based on a round robin policy.
void generateTCEvent(ThreadID tid)
Records that commit needs to initiate a squash due to an external state update through the TC.
std::unique_ptr< PCStateBase > pc[MaxThreads]
The commit PC state of each thread.
void regProbePoints()
Registers probes.
IEW * iewStage
The pointer to the IEW stage.
void setThreads(std::vector< ThreadState * > &threads)
Sets the list of threads.
void updateComInstStats(const DynInstPtr &inst)
Updates commit stats based on this instruction.
ThreadID getCommittingThread()
Gets the thread to commit, based on the SMT policy.
const Cycles iewToCommitDelay
IEW to Commit delay.
bool avoidQuiesceLiveLock
Have we had an interrupt pending and then seen it de-asserted because of a masking change?...
std::list< ThreadID > priority_list
Priority List used for Commit Policy.
void commit()
Handles any squashes that are sent from IEW, and adds instructions to the ROB and tries to commit ins...
UnifiedRenameMap * renameMap[MaxThreads]
Rename map interface.
void setRenameMap(UnifiedRenameMap::PerThreadUnifiedRenameMap &rm_ptr)
Sets pointer to the commited state rename map.
void squashFromTrap(ThreadID tid)
Handles squashing due to a trap.
bool committedStores[MaxThreads]
Records if there were any stores committed this cycle.
const unsigned commitWidth
Commit width, in instructions.
bool isDrained() const
Has the stage drained?
Fault interrupt
The interrupt fault.
TimeBuffer< FetchStruct >::wire fromFetch
IEW handles both single threaded and SMT IEW (issue/execute/writeback).
Unified register rename map for all classes of registers.
std::array< UnifiedRenameMap, MaxThreads > PerThreadUnifiedRenameMap
A simple distribution stat.
This is a simple scalar statistic, like a counter.
A 2-Dimensional vecto of scalar stats.
A vector of scalar stats.
static constexpr int MaxThreads
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
int16_t ThreadID
Thread index/ID type.
Declaration of Statistics objects.
statistics::Vector amos
Stat for the total number of committed atomics.
CommitStats(CPU *cpu, Commit *commit)
statistics::Distribution numCommittedDist
Distribution of the number of committed instructions each cycle.
statistics::Scalar commitNonSpecStalls
Stat for the total number of times commit has had to stall due to a non-speculative instruction reach...
statistics::Scalar commitEligibleSamples
Number of cycles where the commit bandwidth limit is reached.
statistics::Scalar commitSquashedInsts
Stat for the total number of squashed instructions discarded by commit.
statistics::Scalar branchMispredicts
Stat for the total number of branch mispredicts that caused a squash.
statistics::Vector2d committedInstType
Committed instructions by instruction type (OpClass)
statistics::Vector functionCalls
Total number of function calls.
statistics::Vector membars
Total number of committed memory barriers.