Skip to content

Commit

Permalink
cpu-o3: fix rob head ready
Browse files Browse the repository at this point in the history
Commit instruction after all instructions of head group becomes ready

Change-Id: I29c4927811e25c2e13ede8f640922b3228eae30b
  • Loading branch information
happy-lx committed Feb 26, 2025
1 parent bdf0d09 commit 966cecf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/cpu/o3/commit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,10 @@ Commit::commitInsts()

int commit_width = rob->numInstCanCommit(commitWidth);

if (commit_width >= 0) {
cpu->activityThisCycle();
}

// Commit as many instructions as possible until the commit bandwidth
// limit is reached, or it becomes impossible to commit any more.
while (num_committed < commit_width) {
Expand Down
7 changes: 6 additions & 1 deletion src/cpu/o3/rob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,12 @@ ROB::isHeadReady(ThreadID tid)
stats.reads++;

if (!threadGroups[tid].empty() && threadGroups[tid].front() != 0) {
return instList[tid].front()->readyToCommit();
// check if all insts in the same head group are ready to commit
return std::all_of(
instList[tid].begin(),
std::next(instList[tid].begin(), threadGroups[tid].front()),
[] (DynInstPtr inst) { return inst->readyToCommit(); }
);
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/o3/rob.hh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class ROB
/** Is the oldest instruction across all threads ready. */
// bool isHeadReady();

/** Is the oldest instruction across a particular thread ready. */
/** Is the oldest group of instructions across a particular thread ready. */
bool isHeadReady(ThreadID tid);

/** Is there any commitable head instruction across all threads ready. */
Expand Down

0 comments on commit 966cecf

Please sign in to comment.