mod_1 tuning (was: Re: C implementation of mod_1_1)

Niels Möller nisse at lysator.liu.se
Thu Mar 3 12:01:31 CET 2011


I've checked in some hacks on the tuning now.

I omit measurement of MOD_1_1P_METHOD if it is natively implemented.
When it's not native, I added some macros to generic/mod_1.c, inside

#if TUNE_PROGRAM_BUILD && !HAVE_NATIVE_mpn_mod_1_1p

which test mod_1_1p method and call the right function. It would have
been cleaner to do that in tune/mod_1.c, but that turned out to be
difficult to get right. It's easier to do after the inclusion of
gmp-impl.h and config.h.

This means that tuned values of MOD_1_1P_METHOD now ought to be included
in gmp-mparam.h, otherwise other MOD_1* values will be suboptimal. And
hence, the new method 2 is going to be enabled on several machines.

I tested this on a --disable-assembler build, before this change tuneup
selected

#define MOD_1N_TO_MOD_1_1_THRESHOLD         18
#define MOD_1U_TO_MOD_1_1_THRESHOLD         42
#define MOD_1_1_TO_MOD_1_2_THRESHOLD         0  /* never mpn_mod_1_1p */
#define MOD_1_2_TO_MOD_1_4_THRESHOLD         0  /* never mpn_mod_1s_2p */

After, 

#define MOD_1_1P_METHOD                      2
#define MOD_1N_TO_MOD_1_1_THRESHOLD          4
#define MOD_1U_TO_MOD_1_1_THRESHOLD         42
#define MOD_1_1_TO_MOD_1_2_THRESHOLD         0  /* never mpn_mod_1_1p */
#define MOD_1_2_TO_MOD_1_4_THRESHOLD         0  /* never mpn_mod_1s_2p */

I don't understand why the MOD_1U_TO_MOD_1_1_THRESHOLD didn't change,
though.

I also don't understand why tune/mod_1.c (generated by make) needs the
define

#define __gmpn_mod_1  mpn_mod_1_tune

Regards, 
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list