O3: Fix mispredicts from non control instructions.
Review Request #343 - Created Dec. 6, 2010 and submitted
| Information | |
|---|---|
| Ali Saidi | |
| gem5 | |
| Reviewers | |
| Default | |
| ali, gblack, nate, stever | |
O3: Fix mispredicts from non control instructions. The squash inside the fetch unit should not attempt to remove them from the branch predictor as non-control instructions are not pushed into the predictor.
Posted (Dec. 8, 2010, 3:30 p.m.)
Seems basically ok to me. It's a little odd to have mispredicts on non-control instructions, but that's how ARM does things I guess. Perhaps you could make the ISA description mark instructions changing R15 as control instructions? I'm sure that would be harder than it sounds.
-
src/cpu/o3/fetch_impl.hh (Diff revision 1) -
I don't think there's actually a rule about it, but this || at the start of the line looks a little funny. I like them at the end of the line since that visually indicates the expression continues. Not a big deal, but it would be nice to move it.
-
src/cpu/o3/fetch_impl.hh (Diff revision 1) -
I was really confused here for a second until I realized review board was ignoring the change in indentation.
Posted (Dec. 21, 2010, 9:37 a.m.)
-
src/cpu/o3/fetch_impl.hh (Diff revision 1) -
Is it ever the case that branchMispredict is true but mispredictInst is not set? I don't think so. In that case I'd get rid of the redundant flag and clean up this control flow; I don't think nested ifs are needed (though I might be wrong). Also the old comment doesn't really fit in context very well and should be updated.
-
src/cpu/o3/iew_impl.hh (Diff revision 1) -
This line should be moved up to line 458 with the other misprediction-related signals.
Posted (Jan. 10, 2011, 8:41 a.m.)
-
src/cpu/o3/fetch_impl.hh (Diff revision 1) -
hugely simplified: if (fromCommit->commitInfo[tid].branchMispredict && fromCommit->commitInfo[tid].mispredictInst->isControl()) { branchPred.squash(fromCommit->commitInfo[tid].doneSeqNum, fromCommit->commitInfo[tid].pc, fromCommit->commitInfo[tid].branchTaken, tid); } else { branchPred.squash(fromCommit->commitInfo[tid].doneSeqNum, tid); }
Review request changed
Updated (Jan. 12, 2011, 1:08 a.m.)
Summary: |
|
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||
Diff: |
Revision 2 (+16 -4) |
This new version looks basically ok to me.
Posted (Jan. 17, 2011, 12:32 a.m.)
Hugely improved! It seems clear from the assertion now that the branchMispredict flag is redundant (you could add the converse check to be sure that mispredictInst is NULL whenever branchMispredict is false, but it seems unnecessary if the line above where you set mispredictInst to NULL is the one place where branchMispredict is set to false). Why not get rid of the flag and just use mispredictInst == NULL to signal that there was no misprediction? The redundancy only adds confusion IMO b/c then you're left wondering if there is a case where they wouldn't be consistent, and if so, what that would mean. If it helps to add a wrapper like
bool branchMispredict() { return (mispredictInst != NULL); }
that's ok with me.
