Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Questions about branch predictions.

Author: Robert Hyatt

Date: 20:56:34 08/08/03

Go up one level in this thread


On August 08, 2003 at 18:15:04, Gerd Isenberg wrote:

>I'm not quite sure about the branch prediction issue in Vincent's inner loops.
>E.g. the "if ( color[u] == xside )" expression.
>
>I learned that there are two kinds of branch predictions. Static and dynamic.
>Static is done, if no BPT-entry is found, by simple heuristics like branching
>short backward by jxx to a do-while body, but no jxx-branch foreward.
>
>I guess dynamic branch prediction is implemented by a branch prediction table.
>It maps ip of branch instruction with ip of branchtarget done recently with some
>recent counter. Is that correct so far?

Depends.  On the PIV things are more complicated.  The basic branch
prediction is a BTB that has a bunch of 2-bit finite state machines
with the classic strongly/weakly taken and strongly/weakly not-taken
indicators.  But the PIV has multiple FSM entries per BTB entry.  It
uses the past 5 branches as a string of five 0/1 bits (0-not taken,
1=taken) to index to the proper FSM.  This means that if you have
a 5-bit pattern of branches, ie taken, taken, taken, not taken, taken, then
the 5 bit index is 11101 and we access that FSM to predict what should happen
_next_ after the above pattern has been hit.  It works well.  I think this
came from a prof at Texas A&M, although I am not sure.  I saw the paper
a couple of years ago and thought "cute".  Apparently so did Intel.  :)


>
>Does a frequently asked, but long time constant condition affects branch
>prediction in seldom reached code with the same well known and often computed
>condition but ip and branch target not in BPT?
>
>How does the pipe length interact with branch prediction, eg. on P4, K7 or
>Opteron?  Eg. if a condition is already computed and flags are set, but the
>conditional jump is not even decoded, due to some further not modifying flag
>instructions?
>
>Thanks in advance,
>Gerd



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.