[PATCH] Add optimized addmul_1 and submul_1 for IBM z13

Marius Hillenbrand mhillen at linux.ibm.com
Fri Feb 19 11:05:44 UTC 2021


Hi,

Thanks for your feedback.

On 2/17/21 2:26 PM, Torbjörn Granlund wrote:
> Marius Hillenbrand <mhillen at linux.ibm.com> writes:
>   Tested with the regression test suite and stressed with tests/devel/anymul_1.c
> 
> Please use tests/devel/try too.  It checks for access outside of defined
> operands, which is a common bug in GMP asm.

Done, completed successfully for both mpn_addmul_1 and mpn_submul1.

> 1. What is the measured speed difference of the existing code and the
> new code?

I measure ~40% reduction in cycles per limb on z14 and ~60% reduction on
z15, for both addmul_1 and submul_1 (smaller gains for small n <10 but
no regressions), yet ...

> 2. Is the measured performance close to what you would hope for, given
> some hard pipeline limits?  If not, would you be willing to try to
> improve things?

... I assumed that I hit max multiplication throughput, yet I just
learned that there is potential to increase that further. I'll accept
that challenge and keep working on the patch :)


> As a rough measure, if the code is within 20% of theoretical maximum for
> the target CPU pipeline, we're happy.  If not, more unrolling, better
> scheduling, a different instruction choice, might be tried.  Code
> complexity is also an issue, for sure.  But addmul_1 is extremely
> important for GMP's performance (in particular in the absence of special
> mul_basecase and sqr_basecase) so complexity there is particularly
> tolerated.

Thanks for that guidance; that supports another idea I have in mind.

> Your contribution is significant enough to need copyright paperwork from
> you and IBM.  IBM is FOSS-friendly, so I don't expect any problems, but
> it might take a while.

I went through the process before and already have copyright assignments
in place for multiple GNU projects, including GMP, so we should be good
from that side.

Marius
-- 
Marius Hillenbrand
Linux on Z development
IBM Deutschland Research & Development GmbH
Vors. des Aufsichtsrats: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht
Stuttgart, HRB 243294


More information about the gmp-devel mailing list