Skip to content

Commit

Permalink
Revert commitMicroOps Function (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
dANW34V3R authored May 19, 2023
1 parent a36e679 commit 769852e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
1 change: 1 addition & 0 deletions configs/a64fx_SME.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Core:
Simulation-Mode: outoforder
ISA: AArch64
# Clock Frequency is in GHz.
Clock-Frequency: 1.8
# Timer-Frequency is in MHz.
Expand Down
48 changes: 30 additions & 18 deletions src/lib/pipeline/ReorderBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,40 @@ void ReorderBuffer::reserve(const std::shared_ptr<Instruction>& insn) {
}

void ReorderBuffer::commitMicroOps(uint64_t insnId) {
if (!buffer_.empty()) {
// Do a binary search to find the range of micro-ops that belong to macro-op
// with ID insnId
auto [first, last] =
std::equal_range(buffer_.begin(), buffer_.end(), insnId, idCompare{});

// Return early if no micro-op was found
if (first == buffer_.end()) return;

// Return early if any micro-op is not waiting to commit
if (std::any_of(first, last, [](const std::shared_ptr<Instruction>& insn) {
return !insn->isWaitingCommit();
})) {
return;
if (buffer_.size()) {
size_t index = 0;
int firstOp = -1;
bool validForCommit = false;

// Find first instance of uop belonging to macro-op instruction
for (; index < buffer_.size(); index++) {
if (buffer_[index]->getInstructionId() == insnId) {
firstOp = index;
break;
}
}

// No early return thus all micro-ops are committable
while (first != last) {
first->get()->setCommitReady();
first++;
if (firstOp > -1) {
// If found, see if all uops are committable
for (; index < buffer_.size(); index++) {
if (buffer_[index]->getInstructionId() != insnId) break;
if (!buffer_[index]->isWaitingCommit()) {
return;
} else if (buffer_[index]->isLastMicroOp()) {
// all microOps must be in ROB for the commit to be valid
validForCommit = true;
}
}
if (!validForCommit) return;

// No early return thus all uops are committable
for (; firstOp < buffer_.size(); firstOp++) {
if (buffer_[firstOp]->getInstructionId() != insnId) break;
buffer_[firstOp]->setCommitReady();
}
}
}
return;
}

unsigned int ReorderBuffer::commit(unsigned int maxCommitSize) {
Expand Down

0 comments on commit 769852e

Please sign in to comment.