GMP contribution

Pierrick Gaudry pierrick.gaudry at
Fri Apr 18 10:33:13 CEST 2008


I am not an official GMP developper, so I cannot speak for the
maintainer. But I am one of the "external contributors" you mention, so I
can try to give you some hints.

On Mon, Apr 14, 2008 at 03:36:13PM -0500, Natarajan, Bragadeesh wrote:
> Hello,
> I am a software engineer at Advanced Micro Devices and I have been
> working on increasing the performance of certain functions in GMP. We
> are also working with an AMD customer that is using GMP in their system.
> We wish to contribute our optimized implementations back to the GMP
> project. In particular, I have optimized the following functions, 
> 1. mpn_addmul_1 
> 2. mpn_sqr_basecase
> We have tested these changes against in-house developed test codes with
> reference code from existing GMP-4.2.2. The mpn_addmul_1 has SSE2
> instructions in it and is generic to both AMD and Intel. But the
> optimizations are 64-bit specific and AMD specific.
> Please let us know what legal steps that AMD needs to take for the
> contribution. Also, what technical work (verification, performance tests
> etc) do you expect from us before accepting the contribution.

As for the legal steps, I am pretty sure that the maintainer will only
accept code that belongs to the Free Software Foundation. So you'll have
to give the copyright to FSF, who will put a LGPL license on your
contribution. Note that you will have no legal guarantee that your
contribution end up with this precise license, though this will be the
case in practice.

As for the technical work, your code must be very well tested and
benchmarked. There are many tools for that in the GMP distribution: look
at tests/devel/ and tune/speed*.

For instance, the first question will be:
  "How many cycles/limbs does your addmul_1 implementation perform?"

HOWEVER: even if your code belongs to the FSF, is way faster than
existing one, is very well tested, is well written, and so on, from my
own experience, there is no guarantee that it ends up in the official GMP

There is only one person that takes the decision: the maintainer.

> Also, we saw there are some external links to other people's work who
> have optimized GMP for AMD processors. Some questions related to this
> are,
> 1. Can these contributions be used by anybody under LGPL?

My own contribution is under LGPL. Every one is free to use it under the
conditions of this license.
> 2. Will these contributions become part of GMP in the future?
I didn't transfer the copyright to FSF, since the GMP maintainer made it
clear to me that it was very unlikely that my code would be included in
the official GMP release. Of course, I am willing to transfer the
copyright to FSF, as soon as there is some hint that the situation is

To conclude, I think that you could start by publishing your work under
the LGPL license, with AMD as a copyright holder, so that everybody could
play with your code. There are some free and non-free projects that use
GMP and that would be happy to use a non-official patch that gives some

Best regards,

More information about the gmp-devel mailing list