- Taking a vacation day - actually, a so-called "floating holiday"
on today, USA President's Day
- so that I could be with my daughter, who is off school,
and so that I could pick up my wife at the airport.
= Terminology =
Many branch predictors have a property that I call [[Pattern History Invariant Branch Prediction]].
By this I mean that the cannot change their prediction for a branch, e.g. from taken to not-taken, or vice versa, without having an intervening misprediction.
- Okay, I admit: "Pattern History Invariant" is a bad name. It is pompous, and not very intuitive.
I welcome proposal for a different name. Something like "Branch predictor that can't change it's mind without a misprediction"?
- == Bad Joke ==
Oooh, how about "Can't change its mind without a fight"? I'm tempted to call it a Scottish, Irish,
or a "My Wife" branch predictor - but I'll get in trouble for any and all of these,
and only mention them because I am humor impaired.
= Why does this matter? =
== [[Timing Invariant Branch Prediction]] ==
Pattern history invariance can be a useful property, because it makes it easier to build
[[Timing Invariant Branch Prediction]].
Which has several good properties, such as making val
In particular, it means that delaying updating the pattern tables used to make predictions until retirement will NOT result in any more mispredictions than would otherwise occur
- any such mispredictions would already be on the wrong path, younger than a misprediction that would occur no matter what.
Delaying the pattern table update from, e.g. branch execution to retirement has the possible benefit that [[wrong path]] execution will not corrupt the branch predictor.
However, it may be pointed out that it is possible that there will be a performance loss because of other benefits of execution on the multiply speculative wrong path that speculatively updating a branch pattern history table may bring.
But to get this, you must have several nested effects:
* there must be a first branch misprediction pending
* a younger branch may update the predictor tables
* this may result in a misprediction underneath the first branch misprediction
* which may itself update the predictor tables
** possibly eliminating a misprediction when execution resumes after the first branch misprediction is repaired
** possibly producing instruction prefetch and other [[good wrong path effects]]
I.e. with [[Pattern History Invariant Branch Prediction]] there must be a misprediction to result in a change of prediction.
However, that misprediction may itself occur, and be repaired, speculatively.
And that misprediction may have other [[good wrong path effects]].
== [[BTB Unrolling]] ==
[[Pattern History Invariant Branch Prediction]]
also enables [[BTB Unrolling]]:
give a current (IP,history) tuple
and a separate pattern table used to make a prediction
one can "unroll" the predictor to produce a trace
of multiple, N, branch (from,to) addresses.
And such a trace unrolling is guaranteed to be as accurate as if the predictor were accessed one branch at a time.
= Examples of Pattern History Invariance =
= Examples of non-Pattern History Invariance =
I was tempted to say
- The most powerful example of a non-pattern history invariant branch predictor is a [[loop predictor]].
E.g. it may predict that the loop closing branch is taken 99 times in a row, and then not-taken the 100th time.
Even more advanced loop predictors, such as predicting that if the last few loops were executed were 67,66,65, times,
then the next will be executed 64 times,
are even less pattern history invariant.
is considered to be part of the history that used, along with the branch in question, to index
the pattern tables.
It is necessary to work ahrder to contrive branch predictors that are not pattern history invariant.
TBD: I believe that certain McFarling-style branch predictors may break the pattern history invariance property.
TBD: get the details right.
In particular, in a multi-predictor system such as McFarling,
if you update the predictors and choosers that are NOT being used as well as the predictors and choosers that are being used,
you can "mask" a misprediction in a second predictor,
if a first predictor was being used.
If the choice of which predictor should be used can then change in the pattern table so that
when the same (IP,history) pair is used at a later time the second predictor wins...
= See Also =
* [[Branch predictor state update]]
* [[Timing Invariant Branch Prediction]]
Post a Comment