USS Clueless - Hyperthreading
     
     
 

Stardate 20020830.1818

(Captain's log): Sometimes it seems as if I go out of my way to make trouble for myself. Having just learned about hyperthreading, I began to wonder whether it might be screwing up my new dual-CPU system. Win2K was reporting two CPUs, but was it actually reporting two chips or two iterations of the same one?

Hyperthreading is a mechanism whereby advanced versions of the P4 (including the Xeons I own) can act sort of like two actual CPUs. Some of the hardware is duplicated, and it means that the CPU can actually run two execution threads simultaneously with each one having its own register set without having to do a formal context switch to go from one to the other. If the two happen on any cycle to be doing things such that they're trying to use different execution units inside the CPU, then they'll actually both execute at once on a single piece of silicon. The extent to which a given application depends on this is highly dependent on the exact code being run. However, if the OS isn't smart about it, then it can end up assigning two CPU-bound threads to the same processor instead of to two different processors, and the result can actually be a significant degradation of performance under some circumstances.

And the possibility existed that my system, although having two CPUs, might not actually be using both of them. It reported having two, but maybe they were both the same one. How to find out? Benchmarks, of course.

So I downloaded something called PCMark2002, which has both a free and a paid version, with the free version being somewhat limited. I ran it on the new dual 2.4 GHz Xeon and on my 1.13GHz PIII laptop, and the dual Xeon only came up with a CPU score about twice what the laptop did, which is definitely not what I would have expected. The laptop scored: CPU=3185 Memory=1550 HDD=72. The Xeon scored CPU=5842, Memory=4920 HDD=854. Improvement: Like all laptops, the hard disk in this one is terribly slow (the price you pay for being small and using little power), especially compared to 160 MHz SCSI 3, so the Xeon was 1086% faster. The Xeon's memory was 217% faster, which is about right for PC800 RDRAM compared to 133 MHz SDRAM. But the CPU score was only 83% higher, and I started to get worried.

Of course, it might not be the case that PCMark2002 was designed to utilize two CPUs, even though they claimed that it was designed to evaluate everything from grunch computers all the way to workstations. (It's possible that SMP tests are only enabled in the paid version, for instance.)

PCMark2002 has a frame where you can look at a detailed view of the computer configuration. In some ways it's even more detailed than the one in the "Computer Management" tool that comes with Windows. One thing it shows is the "Processor ID", and it reported both CPUs as being "CPU2", and I went cold.

Thought about it some more, and then remembered another benchmark program which would be able to answer the question definitively. It's called CLIBench, and I downloaded the most recent version.

It's a very small program, which means that when it runs it can fit entirely in the onboard processor L2 cache, which means that in an SMP system there will be little competition for the FSB. It runs a series of compute-intensive benchmarks, and you can select the number of parallel threads which run the same code simultaneously.

On a single CPU system, you'll get approximately the same score no matter how many threads you run, which I confirmed on my laptop using 1, 2, 3, 6 and 20 threads. On the Xeon, performance almost exactly doubles when using two or more threads compared to only using 1 thread. Whew! And performance is nearly the same for 2, 3, 4, 6 and 20 threads on all tests except "number crunch", which degrades badly when running 20 threads, though it's not obvious why. (I haven't run that on the laptop; it would take too long.)

All this was run with "Hyperthreading" disabled in the BIOS, and I got curious about just what would happen if I enabled it. Answer: nothing. I can see no change whatever in performance. At all threading numbers I tried, the score is exactly the same.

If Win2K was actually using hyperthreading, but each processor was running the same code in both its threads, then I wouldn't expect to see much of an increase because they'd be competing for the same execution units. But not totally, and if the code got slightly out of phase then there would be at least some gain, maybe 5% to 10%, but I didn't see any at all. And nothing else I can look at indicates any change with or without hyperthreading enabled in the BIOS.

So I hit the Microsoft knowledgebase and got a surprise: there is not a single reference to the term "hyperthreading" anywhere, for Win2K or anything else. The Knowledgebase search engine came up blank, and so did the main everything-at-Microsoft one. Since that's Intel's official term for the product feature, it's more than a bit surprising that there's no mention of it. Later I'm going to hit some of the review sites and see if there's some other term for it. (One possibility is "HMT".) And some other selective googling might turn up help elsewhere.

A friendly reader who works at Microsoft told me that XP actually does know how to take advantage of hyperthreading. The guy at the store told me Win2K does, too, but if that's the case I sure can't see it happening. And if there's some patch I have to download to make it work, I sure can't fig

Captured by MemoWeb from http://denbeste.nu/cd_log_entries/2002/08/Hyperthreading.shtml on 9/16/2004