Here’s something you probably don’t know, but really should – especially if you’re a programmer, and especially especially if you’re using Intel’s compiler. It’s a fact that’s not widely known, but Intel’s compiler deliberately and knowingly cripples performance for non-Intel (AMD/VIA) processors.
Agner Fog details this particularly nasty examples of Intel’s anticompetitive practices quite well. Intel’s compiler can produce different versions of pieces of code, with each version being optimised for a specific processor and/or instruction set (SSE2, SSE3, etc.). The system detects which CPU it’s running on and chooses the optimal code path accordingly; the CPU dispatcher, as it’s called.
“However, the Intel CPU dispatcher does not only check which instruction set is supported by the CPU, it also checks the vendor ID string,” Fog details, “If the vendor string says ‘GenuineIntel’ then it uses the optimal code path. If the CPU is not from Intel then, in most cases, it will run the slowest possible version of the code, even if the CPU is fully compatible with a better version.”
It turns out that while this is known behaviour, few users of the Intel compiler actually seem to know about it. Intel does not advertise the compiler as being Intel-specific, so the company has no excuse for deliberately crippling performance on non-Intel machines.
“Many software developers think that the compiler is compatible with AMD processors, and in fact it is, but unbeknownst to the programmer it puts in a biased CPU dispatcher that chooses an inferior code path whenever it is running on a non-Intel processor,” Fog writes, “If programmers knew this fact they would probably use another compiler. Who wants to sell a piece of software that doesn’t work well on AMD processors?”
In fact, Fog points out that even benchmarking programs are affected by this, up to a point where benchmark results can differ greatly depending on how a processor identifies itself. Ars found out that by changing the CPUID of a VIA Nano processor to AuthenticAMD you could increase performance in PCMark 2005’s memory subsystem test by 10% – changing it to GenuineIntel yields a 47.4% performance improvement! There’s more on that here [print version – the regular one won’t load for me].
In other words, this is a very serious problem. Luckily, though, it appears that the recent antitrust settlement between AMD and Intel will solve this problem for at least AMD users, as the agreement specifically states that Intel must fix its compiler, meaning they’ll have to fix their CPU dispatcher.
The Federal Trade Commission is investigating Intel too, and it is also seeking a resolution of the compiler issue, but the FTC takes it all a step further than the Intel-AMD settlement. Since the latter only covers AMD, VIA could still be in trouble. Consequently, the FTC asks that Intel do a lot more than what’s described in the AMD settlement:
Requiring that, with respect to those Intel customers that purchased from Intel a software compiler that had or has the design or effect of impairing the actual or apparent performance of microprocessors not manufactured by Intel (“Defective Compiler”), as described in the Complaint:
- Intel provide them, at no additional charge, a substitute compiler that is not a Defective Compiler;
- Intel compensate them for the cost of recompiling the software they had compiled on the Defective Compiler and of substituting, and distributing to their own customers, the recompiled software for software compiled on a Defective Compiler; and
- Intel give public notice and warning, in a manner likely to be communicated to persons that have purchased software compiled on Defective Compilers purchased from Intel, of the possible need to replace that software.
Fog also offers up a number of workarounds, such as using GNU GCC, whose optimisations are similar to that of Intel’s compiler, “but the Gnu function library (glibc) is inferior”. You can also patch Intel’s CPU dispatcher – Fog even provides a patch to do so in “Optimizing software in C++: An optimization guide for Windows, Linux and Mac platforms“.
This is a particularly nasty kind of anticompetitive practice, as it really requires deep knowledge of matters in order to find it out. God knows how many benchmarks have been skewed in favour of Intel simply because people unknowingly used Intel’s compiler in good faith. Intel’s compiler is seen as the cream of the crop and delivers superior performance, but apparently only if you stick to GenuineIntel.
Wow I remember more then 5 years ago on that topic. I even used a (perl?) script that removed that check from a compiled library or the compiler itself. I still use intel’s compiler, but each time I use it I’m aware that the compiler is a “Defective Compiler” on anything else then Intel. Luckily for me (or for intel…) most developpement was on intel machines.
I kind of gave up hope on a real fix for that. I am wonderfully surprised to see intel migth be forced to fix it! It is good news.
On the other hand, since the time I’ve read on this, GCC has come back from crappy to almost par with icc. And it’s always a good thing to compile/run on many compilers; you’d be surprised to see how many errors slip through which a certain compiler accept!
Would it be illegal for AMD and VIA to just put “GenuineIntel” in the CPUID, and use another field for AuthenticAMD and CentaurHauls?
I look at it as comparable to Internet Explorer putting “Mozilla/x.x (compatible; MSIE x.x)” as the User-Agent. (Or Opera’s “Mozilla/x.x (compatible; MSIE 6.0; Opera x.x)” user-agent from a few years back.)