CPU dispatching in GMP is flawed

Agner Fog agner at agner.org
Mon Aug 9 12:07:43 CEST 2010

I discovered this problem while testing the latest version of 
Mathematica on a VIA L3050 CPU.
It runs faster when the CPUID vendor string is changed artificially to 
fake an Intel or AMD chip. I found that both GMP and Intel MKL are 
responsible for the problem. I found that the function 
__gmpn_cpuvec_init in fat.c is responsible for the problem. It 
recognizes only Intel and AMD chips. The VIA chip gets the slow generic 
code path even though it supports the SSE4.1 instruction set. It should, 
as a minimum, dispatch unknown CPUs by the instruction set it supports. 
I still maintain that this is a BUG.

The GMP.dll in Mathematica has no version information in its metadata so 
I can't tell if it is up to date. The MKL is from 2008.

Torbjorn Granlund wrote:
> As you can see from my replies at gmp-bugs, we do not agree about much
> here:
We also disagree on how long time it takes for application programmers 
to get a new library version into their end-user product. It is rarely 
less than two years, and I have examples of up to 6 years. Any processor 
you are optimizing for now is likely to be obsolete at the time the 
software is running on the end user's PC.

More information about the gmp-discuss mailing list