cpu-o3: Fixed halt assertion failure

Halting the O3 CPU would cause an assertion failure because
instructions were not finished being squashed in the ROB.

Change-Id: I8b8c375d0e520861af3657249de987de2451b6f1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37676
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel Gerzhoy
2020-11-03 15:28:18 -05:00
parent 671d089676
commit 65f63e7b69
2 changed files with 29 additions and 1 deletions

View File

@@ -717,6 +717,15 @@ FullO3CPU<Impl>::haltContext(ThreadID tid)
deactivateThread(tid);
removeThread(tid);
// If this was the last thread then unschedule the tick event.
if (activeThreads.size() == 0) {
if (tickEvent.scheduled())
{
unscheduleTickEvent();
}
lastRunningCycle = curCycle();
_status = Idle;
}
updateCycleCounters(BaseCPU::CPU_STATE_SLEEP);
}
@@ -795,6 +804,15 @@ FullO3CPU<Impl>::removeThread(ThreadID tid)
rename.clearStates(tid);
iew.clearStates(tid);
// Flush out any old data from the time buffers.
for (int i = 0; i < timeBuffer.getSize(); ++i) {
timeBuffer.advance();
fetchQueue.advance();
decodeQueue.advance();
renameQueue.advance();
iewQueue.advance();
}
// at this step, all instructions in the pipeline should be already
// either committed successfully or squashed. All thread-specific
// queues in the pipeline must be empty.

View File

@@ -338,8 +338,18 @@ ROB<Impl>::doSquash(ThreadID tid)
bool robTailUpdate = false;
unsigned int numInstsToSquash = squashWidth;
// If the CPU is exiting, squash all of the instructions
// it is told to, even if that exceeds the squashWidth.
// Set the number to the number of entries (the max).
if (cpu->isThreadExiting(tid))
{
numInstsToSquash = numEntries;
}
for (int numSquashed = 0;
numSquashed < squashWidth &&
numSquashed < numInstsToSquash &&
squashIt[tid] != instList[tid].end() &&
(*squashIt[tid])->seqNum > squashedSeqNum[tid];
++numSquashed)