Skip to content

Comment on Why is processing a sorted array faster than an unsorted array?

Comments

Is it possible to reduce the length of pipelines? Example: http://www.youtube.com/watch?v=w9VWRB07yqc

Deeper pipelines have higher clock frequencies but this comes at the cost of lower instructions per clock (IPC). Roughly speaking, asking for a shallower pipe essentially boils down to asking for a lower clock frequency. Deeper pipelines are more complex to build, tricky to validate, not to mention the obvious fact that they consume more area and power, so architects who choose deeper pipelines are doing so only because performance studies show that these pipes are worthwhile.

The branch in this example is essentially random and so pretty much impossible to predict. I would classify it as a pathological case. A modern predictor such as perceptron [1] or even the older tournament predictor [2] is extremely accurate for branches found in real benchmarks.

[1] http://www.cs.utexas.edu/~lin/papers/hpca01.pdf [2] http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-TN-36.pdf

PS. Sidenote about the P4, it achieved the highest SpecINT CPU score among all its contemporary processors so it wasn't the performance disaster some people make it out to be. It's worth noting that SpecINT CPU is has traditionally been the most challenging benchmark in terms of branch prediction requirements. SpecFP CPU for example is full of easy to predict loops.

> The branch in this example is essentially random and so pretty much impossible to predict. I would classify it as a pathological case.

It's a highly contrived example, and it's a little bit misleading.

Generally processors started with short pipelines and only lengthened them after extensive analysis showing that the extra stages produce a net gain in performance. There was a period around 2002-2005 where that analysis was wrong because it was based on wrong assumptions, but now that we're past that I doubt there's much performance to be gained from shortening pipelines.

Intel has long since fixed the mistakes they made with the Pentium 4.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.