Prescott's New Crystal Ball: Branch Predictor Improvements

We’ve said it before: before you can build a longer pipeline or add more execution units, you need a powerful branch predictor. The branch predictor (more specifically, its accuracy), will determine how many operations you can have working their way through the CPU until you hit a stall. Intel extended the basic Integer pipeline by 11 stages, so they need to make corresponding increases in the accuracy of Prescott’s branch predictor otherwise performance will inevitably tank.

Intel admits that the majority of the branch predictor unit remains unchanged in Prescott, but there have been some key modifications to help balance performance.

For those of you that aren’t familiar with the term, the role of a branch predictor in a processor is to predict the path code will take. If you’ve ever written code before, it boils down to being able to predict which part of a conditional statement (if-then, loops, etc…) will be taken. Present day branch predictors work on a simple principle; if branches were taken in the past, it is likely that they will be taken in the future. So the purpose of a branch predictor is to keep track of the code being executed on the CPU, and increment counters that keep track of how often branches at particular addresses were taken. Once enough data has accumulated in these counters, the branch predictor will then be able to predict branches as taken or not taken with relatively high accuracy, assuming they are given enough room to store all of this data.

One way of improving the accuracy of a branch predictor, as you may guess, is to give the unit more space to keep track of previously taken (or not taken) branches. AMD improved the accuracy of their branch predictor in the Opteron by increasing the amount of space available to store branch data, Intel has not chosen to do so with Prescott. Prescott’s Branch Target Buffer remains unchanged at 4K entries and it doesn’t look like Intel has increased the size of the Global History Counter either. Instead, Intel focused on tuning the efficiency of their branch predictor using less die-space-consuming methods.

Loops are very common in code, they are useful for zeroing data structures, printing characters or are simply a part of a larger algorithm. Although you may not think of them as branches, loops are inherently filled with branches – before you start a loop and every iteration of the loop, you must find out whether you should continue executing the loop. Luckily, these types of branches are relatively easy to predict; you could generally assume that if the outcome of a branch took you to an earlier point in the code (called a backwards branch), that you were dealing with a loop and the branch predictor should predict taken.

As you would expect, not all backwards branches should be taken – not all of them are at the end of a loop. Backwards branches that aren’t loop ending branches are sometimes the result of error handling in code, if an error is generated then you should back up and start over again. But if there’s no error generated in the application, then the prediction should be not-taken, but how do you specify this while keeping hardware simple?

Code Fragment A

Line 10: while (i < 10) do
Line 11: A;
Line 12: B;
Line 13: increment i;
Line 14: if i is still < 10, then go back to Line 11

Code Fragment B

Line 10: A;
Line 11: B;
Line 12: C;
...
Line 80: if (error) then go back to Line 11

Line 14 is a backwards branch at the end of a loop - should be taken!
Line 80 is a backwards branch not at the end of a loop - should not be taken!
Example of the two types of backwards branching

It turns out that loop ending branches and these error branches, both backwards branches, differentiate themselves from one another by the amount of code that separates the branch from its target. Loops are generally small, and thus only a handful of instructions will separate the branch from its target; error handling branches generally instruct the CPU to go back many more lines of code. The depiction below should illustrate this a bit better:

Prescott includes a new algorithm that looks at how far the branch target is from the actual branch instruction, and better determines whether or not to take the branch. These enhancements are for static branch prediction, which looks at certain scenarios and always makes the same prediction when those scenarios occur. Prescott also includes improvements to its dynamic branch prediction.

31 Stages: What’s this, Baskin Robbins? Prescott's Crystal Ball (continued)
Comments Locked

104 Comments

View All Comments

  • Chadder007 - Monday, February 2, 2004 - link

    I can't imagine how HOT that sucker will be when up to 5ghz!!!! 150oC??? LOL
    For the heat issues alone, im thinking about going AMD in my next rig.
  • CRAMITPAL - Monday, February 2, 2004 - link

    Ace's Hardware summed it up well: Prescott is a DOG, or to be exact a HOT DOG ! See the picture in the review of the dog warming it's toes next to the Prescott powered PC. Talk about one sad CPU piece of crap...

    Here is the FLAME THROWER reality check:

    "Currently there is no reason to upgrade to Prescott, as the gaming performance is more or less ok, but many applications report pretty poor results. On top of that, the new Intel CPU gets hot very quickly and requires a well ventilated case. The Athlon 64 3200+ is not always the clear winner in games compared to 3.2 GHz Prescott, but the 3400+ will have little trouble beating the 3.4 GHz Prescott in most benchmarks. Prescott will have to scale incredibly quickly to outperform the Athlon 64, because the latter scales excellently with clockspeed, and we definitely prefer Cool'n'Quiet over Hot'n Prescott! "

    As shown this FLAME THROWER don't scale well, especially when it runs 15-20C hotter than an equal speed Northwood. Intel really fugged up this time. Ya gotta love seeing the Satan eat shit and choke! When every hardware review site on the planet, including THG's tells ya Prescott is a piece of crap, then you might as well resign to reality. DENIAL is futile!

    Dell will be selling FLAME THROWING PC Heaters to any gullible sheep foolish enough to buy a Prescott. A fool and his money are soon parted !
  • AnonymouseUser - Monday, February 2, 2004 - link

    "Ummmm yea, kinda reminds me of cooking an egg on an Athlon XP"

    Yeah, kinda, except the Prescott can do the same work in about half the time. Sounds like something they should advertise that as a feature...
  • Stlr22 - Monday, February 2, 2004 - link

    What happened to CRAM's post???
  • INTC - Monday, February 2, 2004 - link

    #43 cliffa3 - http://www.x86-secret.com/articles/cpu/prescott/p4...

    It doesn't look good for P4G8X with either the 2.8/533 or the 800 MHz FSB flavors.
  • mkruer - Monday, February 2, 2004 - link

    For those who missed it, X-bit gave a temperature comparison, for the all the chip.
    http://www.xbitlabs.com/articles/cpu/display/presc...

    Processor; Idle, Burn
    Pentium 4 (Prescott) 3.2GHz; 45oC, 61oC
    Pentium 4 (Northwood) 3.2GHz; 30oC, 48oC
    Pentium 4 Extreme Edition 3.2GHz; 32oC, 51oC

    This does not bode well for Intel unless they are going to make water cooling a standard.

    But this Quote sums it up nicely IMHO “I am scared to imagine what happens to Prescott when we close the system case…”

  • lmonds - Monday, February 2, 2004 - link

    what??? no talk about heat on this chip? Come on anand this is vital info about prescott. Other sites are reporting temps up around 80c with the stock cooler. I understand that as it gets faster in mhz it will be a better performing chip but what kinda heat are we looking at at 4ghz? No way is a 80c chip going in any of my boxes. If keeping an intel badge on the front of my case means i have to have a delta fan in my box then you can forget about it.
  • Stlr22 - Monday, February 2, 2004 - link

    :D
  • Captante - Monday, February 2, 2004 - link

    Stlr22 ....Re post # 31 Hahahahahahahahahahahahahahahahahahahahahaaha!!!!
    That one had me cracking up for 5 minutes!
    It is good to laugh!!! :-)
  • Stlr22 - Monday, February 2, 2004 - link

    Moreless a Prescott....

Log in

Don't have an account? Sign up now