Just for my own personal knowledge...
Which of the two, Bimodal or Gshare, provide more correct predictions than the other? why?
Just for my own personal knowledge...
Which of the two, Bimodal or Gshare, provide more correct predictions than the other? why?
With predictors there's no such thing as "better", you could ask which one performs better (less mispredictions) for a given workload/application, or a set of these like a benchmark suite. The performance also depends on the parameters (table sizes, history length, etc..).
The two are quite different, and each could work better for a different scenario. You could say that the bimodal is likely to learn faster and have less collisions, but the global variants are more elaborate and have better chance to capture complicated patterns. However it has higher collisions since the tables represent all sorts of partial histories, and has lower chances to converge in some cases.
It's better to demonstrate the strong/weak spots with this example:
for (i=0; i<N; ++i) {
if (A[i] < 50)
do_stuff();
if (A[i] > 50)
do_other_stuff()
}
The branches are data dependent (let's say the data is randomly distributed evenly in [1..100]), so the bimodal is not likely to capture them. However a global predictor will easily learn that the second branch depends on the outcome of the first one (if the first is take, the second will never be taken, if the first isn't taken the second is very likely to be taken (the case of A[i]==50
having a 1% chance only).
Now take the same code, but assume A is sorted, the bimodal will easily win, nailing almost all the predictions right except on the few transitions.
So if no predictor is superior, what should we do? Well, build a hybrid one of course! Many high performance CPUs today employ multiple ones, although the algorithm for combining/selecting between the results are probably not available online.
This explanation also disregards the design implications like size and power consumption - these of course depend too on the parameters of implementation.