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

Got a confusing issue, maybe it's a corner case when scheduling transaction #27

Open
TQLyu opened this issue Jan 19, 2022 · 0 comments
Open

Comments

@TQLyu
Copy link

TQLyu commented Jan 19, 2022

In function Controller::ScheduleTransaction, there would be a corner case that the write_buffer is full and the first transaction in write_buffer can not pass the dependency check. When this happens, here would be an infinite loop until reaching the cycle we set when initializing.
I'm not sure whether this is correct but I modified the code like when this happens, schedule read queue for next cycle, and switch back to write_buffer after this. I'm glad to hear from you whether I'm right about this.

`void Controller::ScheduleTransaction() {
// determine whether to schedule read or write
if (write_draining_ == 0 && !is_unified_queue_) {
// we basically have a upper and lower threshold for write buffer
if ((write_buffer_.size() >= write_buffer_.capacity()) ||
(write_buffer_.size() > 8 && cmd_queue_.QueueEmpty())) {
write_draining_ = write_buffer_.size();
}
}

std::vector<Transaction> &queue =
    is_unified_queue_ ? unified_queue_
                      : write_draining_ > 0 ? write_buffer_ : read_queue_;
for (auto it = queue.begin(); it != queue.end(); it++) {
    auto cmd = TransToCommand(*it);
    if (cmd_queue_.WillAcceptCommand(cmd.Rank(), cmd.Bankgroup(),
                                     cmd.Bank())) {
        if (!is_unified_queue_ && cmd.IsWrite()) {
            // Enforce R->W dependency
            if (pending_rd_q_.count(it->addr) > 0) {
                write_draining_ = 0;
                break;
            }
            write_draining_ -= 1;
        }
        cmd_queue_.AddCommand(cmd);
        queue.erase(it);
        break;
    }
}

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant