TournamentBP: Fix some bugs with table sizes and counters
Review Request #1523 - Created Oct. 28, 2012 and submitted
| Information | |
|---|---|
| Erik Tomusk | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9394:edeba77c9f2f --------------------------- TournamentBP: Fix some bugs with table sizes and counters globalHistoryBits, globalPredictorSize, and choicePredictorSize are decoupled. globalHistoryBits controls how much history is kept, global and choice predictor sizes control how much of that history is used when accessing predictor tables. This way, global and choice predictors can actually be different sizes, and it is no longer possible to walk off the predictor arrays and cause a seg fault. There are now individual thresholds for choice, global, and local saturating counters, so that taken/not taken decisions are correct even when the predictors' counters' sizes are different. The interface for localPredictorSize has been removed from TournamentBP because the value can be calculated from localHistoryBits.
Works with ARM SE quick regression (except for dram target, which fails with and without this patch). ARM SE long regressions all pass when version 6 of this patch is applied onto changeset 9385.
Issue Summary
| Description | From | Last Updated | Status |
|---|---|---|---|
| it would be great if you could remove it then | Ali Saidi | Nov. 6, 2012, 8:12 p.m. | Open |
| This definitely changes behavior, but I think it's a correct change to make. The original should have been (1 << ... | Erik Tomusk | Nov. 6, 2012, 7:44 p.m. | Open |
| Is this clearing the LSB? If so perhaps unify this and others to be & ~ULL(1) instead? | Andreas Hansson | Nov. 9, 2012, 11:18 p.m. | Open |
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+71 -24) |
Thanks for working on this Erik. We very much appreciate your contribution. I've got some questions below. Additionally, the quick regressions test very little functionality in the branch predictor. I'd be curious to see how the long regeressions turn out with your changes. There are a couple of places that don't quite seem right to me as far as differentiating between taken and not taken branches. Thanks, Ali
-
src/cpu/pred/tournament.cc (Diff revision 2) -
it would be great if you could remove it then
-
src/cpu/pred/tournament.cc (Diff revision 2) -
should this be the historyRegisterMask? Couldn't this be larger than the globalHistory was specified? This doesn't appear to do what the previous implementation did which was signify that the branch was taken (by oring in a 1 in the lsb). Both the taken and not taken versions are the same which doesn't seem correct.
-
src/cpu/pred/tournament.cc (Diff revision 2) -
you created the globalHistoryMask but you're not using it here?
-
src/cpu/pred/tournament.cc (Diff revision 2) -
a temporary variable would be very helpful here
-
src/cpu/pred/tournament.cc (Diff revision 2) -
it would be great to use a temporary variable here and make this much more readble
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+69 -40) |
Hi Erik, Could you rebase this on top of the patch I committed today? Thanks, Ali
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+69 -40) |
I'm curious about the testing statement. No regressions should be failing.
Change Summary:
Rebase
Testing Done: |
|
|---|
Thanks Erik This seems like a huge improvement. If you could fix up the couple of issue that would be great and we can get it committed.
-
src/cpu/pred/tournament.cc (Diff revision 5) -
could you switch these to use mask() instead af creating the mask yourself? It just makes it a bit clearer about what is going on. src/base/bitfields.hh
-
src/cpu/pred/tournament.cc (Diff revision 5) -
I think something like globalHistory &= (historyRegisterMask & ~ULL(1)) would be clearer that you're clearing the lowest bit. With a subtract it's not completely clear to me
-
src/cpu/pred/tournament.cc (Diff revision 5) -
shouldn't need ()
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+76 -46) |
-
src/cpu/pred/tournament.cc (Diff revision 6) -
This definitely changes behavior, but I think it's a correct change to make. The original should have been (1 << floorPow2(localPredictorSize)) - 1.
Testing Done: |
|
|---|
Ship It!
-
src/cpu/pred/tournament.cc (Diff revision 6) -
Is this clearing the LSB? If so perhaps unify this and others to be & ~ULL(1) instead?
-
src/cpu/pred/tournament.cc (Diff revision 6) -
clang static analyzer rightfully points out that this is undefined as the 1 is not typed (according to the standard) ULL(1) instead of 1 will fix the warning Not sure any compiler would ever not do this...but might as well.
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 7 (+84 -59) |
Ship It!
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 8 (+85 -60) |
