Bug found in nightbuilds

Niels Möller nisse at lysator.liu.se
Mon Feb 17 08:48:58 UTC 2014


nisse at lysator.liu.se (Niels Möller) writes:

> So to avoid zeros, we'd just need to clear the param.min_is_always flag
> when tuning, right?

I'd suggest doing the below (also undoing Marco's previous fix).
To fix the actual failure, one would also need to edit the two
gmp-mparam.h files which set DIV_QR_1_NORM_THRESHOLD to zero.

I've run tuneup with -tt, and it seems that tuning of DIV_QR_1_NORM
threshold does get sensible measurements. I don't quite understand why
(with the n vs n-1 issue).

Regards,
/Niels

diff -r df5e57333079 mpn/generic/div_qr_1.c
--- a/mpn/generic/div_qr_1.c	Sun Feb 16 07:08:24 2014 +0100
+++ b/mpn/generic/div_qr_1.c	Mon Feb 17 09:37:38 2014 +0100
@@ -35,7 +35,6 @@
 #include "gmp-impl.h"
 #include "longlong.h"
 
-/* FIXME: Add proper tuning */
 #ifndef DIV_QR_1_NORM_THRESHOLD
 #define DIV_QR_1_NORM_THRESHOLD 3
 #endif
@@ -70,7 +69,7 @@
       *qh = q;
       uh -= (-q) & d;
 
-      if (BELOW_THRESHOLD (n, DIV_QR_1_NORM_THRESHOLD | (DIV_QR_1_NORM_THRESHOLD==0)))
+      if (BELOW_THRESHOLD (n, DIV_QR_1_NORM_THRESHOLD))
 	{
 	  cnt = 0;
 	plain:
diff -r df5e57333079 tune/tuneup.c
--- a/tune/tuneup.c	Sun Feb 16 07:08:24 2014 +0100
+++ b/tune/tuneup.c	Mon Feb 17 09:37:38 2014 +0100
@@ -2083,6 +2083,8 @@
     static struct param_t  param;
     param.name = "DIV_QR_1_NORM_THRESHOLD";
     DIV_1_PARAMS;
+    param.min_size = 1;
+    param.min_is_always = 0;
     s.r = randlimb_norm ();
     param.function = speed_mpn_div_qr_1_tune;
     one (&div_qr_1_norm_threshold, &param);
@@ -2091,6 +2093,8 @@
     static struct param_t  param;
     param.name = "DIV_QR_1_UNNORM_THRESHOLD";
     DIV_1_PARAMS;
+    param.min_size = 1;
+    param.min_is_always = 0;
     s.r = randlimb_half();
     param.function = speed_mpn_div_qr_1_tune;
     one (&div_qr_1_unnorm_threshold, &param);

-- 
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