0

I'm wondering if it is a viable scenario in long pipelines, when younger branch instruction is already processed by branch prediction mechanism, but corresponding lhr (or ghr, depending on implementation) still hasn't been updated with actual result of older branch, due to the pipeline length.

It it is a viable scenario, how is it worked around?

Bob
  • 137
  • 1
  • 6

2 Answers2

0

The scenario you mentioned in the question seems legit though I doubt if this would cause any functional/performance issues related to Branch Predictor. Consider a scenario in which there are two back-to-back branches, then prediction result of the older branch would not be seen by the younger branch. But when we have back-to-back branches, the following are possible outcomes -

  • Older branch taken and Predicted correctly - Since the branch was predicted correctly the predictor algorithm would use the prediction result and use the information to predict the younger branch. The update wouldn't effect the prediction result as the older branch was already predicted correctly.
  • Older branch taken and Not Predicted correctly - In this case the younger branch is not in the question itself as the processor would anyway squash all the instruction/updates made in the shadow of the older branch. Hence the prediction would be of no use.

The same applies for the scenario where branch is not taken and predicted correctly/incorrectly. Hope this answers your query.

Rahul Behl
  • 372
  • 1
  • 11
0

Yes, that's absolutely possible. While the older branch hasn't been resolved or the prediction mechanism (whatever it might be) updated with the result of the older branch, new branches will be predicted based on available "stale" history.

rda
  • 86
  • 4