My journey through the field of modern computer architectures

A personal record in the fields of algorithm, computation, data structure, performance, and microarchitecture design.

Tuesday, September 01, 2009

Lets cheat, and since we're so good at it, lets patent our cheating

I may be still too young to teach anyone about cheating, but I distinctly remember how academic integrity was emphasized in the beginning of every semester when I was in college. Sadly, as always, not everything you learn from school is applicable to the real world.

Ever since power (in terms of Watts) became a first-grade parameter of computer performance, CPUs have been measured by various power consumption/battery life tests. There is MobileMark for laptops and SPECpower for servers, for example. Modern processors reduce power consumption by lowering various clock rates at idle periods. For example, a CPU core can slow down when it is waiting for the data from a cache miss; or conversely, the memory controller can be slowed down when there is no cache miss in the cores.

The hard problem with this approach is exactly to figure out when to raise or lower the clock rates, and how to do it quickly. The irony is that the CPU does not know whether its clock rate was too high or too low for a sequence of instructions before it finished executing them. The ideal case is what we may call an "oracle model." That is, at every time slot, the CPU asks an oracle which tells it precisely and accurately how faster it should run most efficiently. Of course, there is no such "oracle" for real-world applications.

Except when you run benchmarks, that is. It turns out that to ensure repeatability, most benchmarks dictate the exact code binary and even data used for testing. So theoretically, a computer can first run the benchmark to determine the CPU usage at every time slot, then use this knowledge to lower the power consumption of future runs of the same benchmark. This is exactly what is claimed in the Predictive processor speed governor patent filed by Intel in June 2004.

But wait... isn't this cheating? Isn't it like going to an exam knowing the questions and their answers beforehand? Knowing this patent, and with Intel being the major member behind both MobileMark and SPECpower, I feel a lot less inclined to believe the accuracy of these power benchmarks when running on Intel processors.

So is this why that compared to AMD, Intel CPUs perform very well in terms of power consumption on MobileMark, but rather modestly on other CPU-intensive benchmarks? Like what's shown in the picture below (click to get the full-size image):



You may ask, well, if that's the case, then why doesn't everyone else do the same? Did you just forget? How can others follow, when Intel already patented it?!

That said, Intel's engineers ought to be commended for designing & implementing such an effective scheme to lower benchmark power consumption. It's just too bad that for real-world applications with never-before-seen input data, the scheme is completely useless.

Please Note: Anonymous comments will be read and respected only when they are on-topic and polite. Thanks.