Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DI unit balanced port allocation fix #431

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions src/lib/pipeline/DispatchIssueUnit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,42 @@ void DispatchIssueUnit::tick() {
continue;
}

const std::vector<uint16_t>& supportedPorts = uop->getSupportedPorts();
std::vector<uint16_t> supportedPorts = uop->getSupportedPorts();
if (uop->exceptionEncountered()) {
// Exception; mark as ready to commit, and remove from pipeline
uop->setCommitReady();
input_.getHeadSlots()[slot] = nullptr;
continue;
}
// Allocate issue port to uop
uint16_t port = portAllocator_.allocate(supportedPorts);
uint16_t RS_Index = portMapping_[port].first;
uint16_t RS_Port = portMapping_[port].second;
assert(RS_Index < reservationStations_.size() &&
"Allocated port inaccessible");
ReservationStation& rs = reservationStations_[RS_Index];

// When appropriate, stall uop or input buffer if stall buffer full
if (rs.currentSize == rs.capacity ||
dispatches_[RS_Index] == rs.dispatchRate) {
// Deallocate port given
portAllocator_.deallocate(port);
// Try find an available RS
uint16_t port = 0;
uint16_t RS_Index = 0;
uint16_t RS_Port = 0;
ReservationStation* rs;
bool foundRS = false;
while (false == foundRS && supportedPorts.size() > 0) {
// Allocate issue port to uop
port = portAllocator_.allocate(supportedPorts);
RS_Index = portMapping_[port].first;
RS_Port = portMapping_[port].second;
assert(RS_Index < reservationStations_.size() &&
"Allocated port inaccessible");
rs = &reservationStations_[RS_Index];
// When appropriate, stall uop or input buffer if stall buffer full
if (rs->currentSize == rs->capacity ||
dispatches_[RS_Index] == rs->dispatchRate) {
// Deallocate port given
portAllocator_.deallocate(port);
supportedPorts.erase(
std::find(supportedPorts.begin(), supportedPorts.end(), port));
} else {
foundRS = true;
}
}
// If no port with capacity or available dispatch rate found. Stall and
// return.
if (false == foundRS) {
input_.stall(true);
rsStalls_++;
return;
Expand Down Expand Up @@ -123,10 +139,10 @@ void DispatchIssueUnit::tick() {

// Increment dispatches made and RS occupied entries size
dispatches_[RS_Index]++;
rs.currentSize++;
rs->currentSize++;

if (ready) {
rs.ports[RS_Port].ready.push_back(std::move(uop));
rs->ports[RS_Port].ready.push_back(std::move(uop));
}

input_.getHeadSlots()[slot] = nullptr;
Expand Down