[Gmp-commit] /var/hg/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Wed Feb 15 15:05:51 CET 2012


details:   /var/hg/gmp/rev/c5895d463cd9
changeset: 14633:c5895d463cd9
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Feb 15 14:40:55 2012 +0100
description:
toom54 related definitions. Also corrected MPN_TOOM43_MUL_MINSIZE and
MPN_TOOM53_MUL_MINSIZE.

details:   /var/hg/gmp/rev/b641c8181188
changeset: 14634:b641c8181188
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Feb 15 14:46:40 2012 +0100
description:
Tuneup support for MUL_TOOM43_TO_TOOM54_THRESHOLD.

diffstat:

 ChangeLog     |  17 +++++++++++++++++
 gmp-impl.h    |  16 ++++++++++++++--
 tune/common.c |  10 ++++++++++
 tune/speed.h  |  13 +++++++++++++
 tune/tuneup.c |  10 ++++++++++
 5 files changed, 64 insertions(+), 2 deletions(-)

diffs (148 lines):

diff -r 605ce4a6238b -r b641c8181188 ChangeLog
--- a/ChangeLog	Tue Feb 14 21:41:21 2012 +0100
+++ b/ChangeLog	Wed Feb 15 14:46:40 2012 +0100
@@ -1,3 +1,20 @@
+2012-02-15  Niels Möller  <nisse at lysator.liu.se>
+
+	* tune/tuneup.c (mul_toom43_to_toom54_threshold): New global.
+	(tune_mul): Added tuning of MUL_TOOM43_TO_TOOM54_THRESHOLD.
+	* tune/speed.h (SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM54_MUL): New macro.
+	(SPEED_ROUTINE_MPN_TOOM54_FOR_TOOM43_MUL): New macro.
+	Prototypes for corresponding functions.
+	* tune/common.c (speed_mpn_toom43_for_toom54_mul): New function.
+	(speed_mpn_toom54_for_toom43_mul): New function.
+
+	* gmp-impl.h (MPN_TOOM43_MUL_MINSIZE): Corrected constant.
+	(MPN_TOOM53_MUL_MINSIZE): Likewise.
+	(MPN_TOOM54_MUL_MINSIZE): New constant.
+	(mpn_toom54_mul): Added prototype.
+	(MUL_TOOM43_TO_TOOM54_THRESHOLD): New threshold. Default value and
+	tuning setup.
+
 2012-02-14  Niels Möller  <nisse at lysator.liu.se>
 
 	* mpn/generic/toom54_mul.c: New file, originally contributed by
diff -r 605ce4a6238b -r b641c8181188 gmp-impl.h
--- a/gmp-impl.h	Tue Feb 14 21:41:21 2012 +0100
+++ b/gmp-impl.h	Wed Feb 15 14:46:40 2012 +0100
@@ -1247,8 +1247,9 @@
 
 #define MPN_TOOM32_MUL_MINSIZE   10
 #define MPN_TOOM42_MUL_MINSIZE   10
-#define MPN_TOOM43_MUL_MINSIZE   49 /* ??? */
-#define MPN_TOOM53_MUL_MINSIZE   49 /* ??? */
+#define MPN_TOOM43_MUL_MINSIZE   25
+#define MPN_TOOM53_MUL_MINSIZE   17
+#define MPN_TOOM54_MUL_MINSIZE   31
 #define MPN_TOOM63_MUL_MINSIZE   49
 
 #define MPN_TOOM42_MULMID_MINSIZE    4
@@ -1327,6 +1328,9 @@
 #define   mpn_toom53_mul __MPN(toom53_mul)
 __GMP_DECLSPEC void      mpn_toom53_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
 
+#define   mpn_toom54_mul __MPN(toom54_mul)
+__GMP_DECLSPEC void      mpn_toom54_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
+
 #define   mpn_toom63_mul __MPN(toom63_mul)
 __GMP_DECLSPEC void      mpn_toom63_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
 
@@ -1939,6 +1943,10 @@
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD  110
 #endif
 
+#ifndef MUL_TOOM43_TO_TOOM54_THRESHOLD
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD  150
+#endif
+
 /* MUL_TOOM22_THRESHOLD_LIMIT is the maximum for MUL_TOOM22_THRESHOLD.  In a
    normal build MUL_TOOM22_THRESHOLD is a constant and we use that.  In a fat
    binary or tune program build MUL_TOOM22_THRESHOLD is a variable and a
@@ -4581,6 +4589,10 @@
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD	mul_toom42_to_toom63_threshold
 extern mp_size_t			mul_toom42_to_toom63_threshold;
 
+#undef  MUL_TOOM43_TO_TOOM54_THRESHOLD
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD	mul_toom43_to_toom54_threshold;
+extern mp_size_t			mul_toom43_to_toom54_threshold;
+
 #undef	MUL_FFT_THRESHOLD
 #define MUL_FFT_THRESHOLD		mul_fft_threshold
 extern mp_size_t			mul_fft_threshold;
diff -r 605ce4a6238b -r b641c8181188 tune/common.c
--- a/tune/common.c	Tue Feb 14 21:41:21 2012 +0100
+++ b/tune/common.c	Wed Feb 15 14:46:40 2012 +0100
@@ -1317,6 +1317,16 @@
 {
   SPEED_ROUTINE_MPN_TOOM53_FOR_TOOM42_MUL (mpn_toom53_mul);
 }
+double
+speed_mpn_toom43_for_toom54_mul (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM54_MUL (mpn_toom43_mul);
+}
+double
+speed_mpn_toom54_for_toom43_mul (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_TOOM54_FOR_TOOM43_MUL (mpn_toom54_mul);
+}
 
 double
 speed_mpn_nussbaumer_mul (struct speed_params *s)
diff -r 605ce4a6238b -r b641c8181188 tune/speed.h
--- a/tune/speed.h	Tue Feb 14 21:41:21 2012 +0100
+++ b/tune/speed.h	Wed Feb 15 14:46:40 2012 +0100
@@ -339,6 +339,8 @@
 double speed_mpn_toom53_for_toom32_mul __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_toom42_for_toom53_mul __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_toom53_for_toom42_mul __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_toom43_for_toom54_mul __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_toom54_for_toom43_mul __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_toom42_mulmid __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_mulmod_bnm1 __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_bc_mulmod_bnm1 __GMP_PROTO ((struct speed_params *s));
@@ -1437,6 +1439,17 @@
      mpn_toom53_mul_itch (s->size, 11*s->size/20),			\
      MPN_TOOM53_MUL_MINSIZE)
 
+#define SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM54_MUL(function)		\
+  SPEED_ROUTINE_MPN_MUL_N_TSPACE					\
+    (function (wp, s->xp, s->size, s->yp, 5*s->size/6, tspace),	\
+     mpn_toom42_mul_itch (s->size, 5*s->size/6),			\
+     MPN_TOOM54_MUL_MINSIZE)
+#define SPEED_ROUTINE_MPN_TOOM54_FOR_TOOM43_MUL(function)		\
+  SPEED_ROUTINE_MPN_MUL_N_TSPACE					\
+    (function (wp, s->xp, s->size, s->yp, 5*s->size/6, tspace),	\
+     mpn_toom54_mul_itch (s->size, 5*s->size/6),			\
+     MPN_TOOM54_MUL_MINSIZE)
+
 
 
 #define SPEED_ROUTINE_MPN_SQR_CALL(call)				\
diff -r 605ce4a6238b -r b641c8181188 tune/tuneup.c
--- a/tune/tuneup.c	Tue Feb 14 21:41:21 2012 +0100
+++ b/tune/tuneup.c	Wed Feb 15 14:46:40 2012 +0100
@@ -156,6 +156,7 @@
 mp_size_t  mul_toom32_to_toom53_threshold = MP_SIZE_T_MAX;
 mp_size_t  mul_toom42_to_toom53_threshold = MP_SIZE_T_MAX;
 mp_size_t  mul_toom42_to_toom63_threshold = MP_SIZE_T_MAX;
+mp_size_t  mul_toom43_to_toom54_threshold = MP_SIZE_T_MAX;
 mp_size_t  mul_fft_threshold            = MP_SIZE_T_MAX;
 mp_size_t  mul_fft_modf_threshold       = MP_SIZE_T_MAX;
 mp_size_t  sqr_basecase_threshold       = MP_SIZE_T_MAX;
@@ -1306,6 +1307,15 @@
   one (&thres, &param);
   mul_toom42_to_toom63_threshold = thres / 2;
   print_define ("MUL_TOOM42_TO_TOOM63_THRESHOLD", mul_toom42_to_toom63_threshold);
+
+  /* Use ratio 5/6 when measuring, the middle of the range 2/3 to 1. */
+  param.function = speed_mpn_toom43_for_toom54_mul;
+  param.function2 = speed_mpn_toom54_for_toom43_mul;
+  param.name = "MUL_TOOM43_TO_TOOM54_THRESHOLD";
+  param.min_size = MPN_TOOM54_MUL_MINSIZE * 6 / 5;
+  one (&thres, &param);
+  mul_toom43_to_toom54_threshold = thres * 5 / 6;
+  print_define ("MUL_TOOM43_TO_TOOM54_THRESHOLD", mul_toom43_to_toom54_threshold);
 }
 
 


More information about the gmp-commit mailing list