Date: Wed, 07 Aug 2024 10:07:32 +0200 From: Paul Zimmermann <Paul.Zimmermann@inria.fr> To: Konstantin Belousov <kostikbel@gmail.com> Cc: hackers@freebsd.org, numerics@freebsd.org Subject: Re: kargl@freebsd.org, sgk@troutmask.apl.washington.edu, vincenzo.innocente@cern.ch, riemannic@gmail.com, johnmather@sidefx.com Message-ID: <p9u04j7wah8b.fsf@coriandre.loria.fr> In-Reply-To: <ZrI5pocdm0Zbl9pW@kib.kiev.ua> (message from Konstantin Belousov on Tue, 6 Aug 2024 17:56:38 %2B0300) References: <p9u0ed713j4u.fsf@coriandre.loria.fr> <ZrI5pocdm0Zbl9pW@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Konstantin, > Date: Tue, 6 Aug 2024 17:56:38 +0300 > From: Konstantin Belousov <kostikbel@gmail.com> > Cc: hackers@freebsd.org, numerics@freebsd.org > > On Tue, Aug 06, 2024 at 02:56:01PM +0200, Paul Zimmermann wrote: > > Hi, > > > > we have updated our comparison with FreeBSD 14.1: > > > > https://members.loria.fr/PZimmermann/papers/accuracy.pdf > > > > Remaining issues in 14.1: > > > > * the powl function is not thread-safe > This is for 80-bit long double, am I right? yes > And it is because of the global vars passing values between functions? > > I tried to hack something in https://reviews.freebsd.org/D46237 thanks. I tried to apply your patch on top of openlibm-0.8.3 (after stripping lib/msun). Part of it failed: $ patch -p1 -i /tmp/D46237.diff patching file ld80/e_powl.c Hunk #1 FAILED at 23. Hunk #2 FAILED at 42. Hunk #3 succeeded at 85 (offset -41 lines). Hunk #4 succeeded at 100 (offset -41 lines). Hunk #5 succeeded at 135 (offset -41 lines). Hunk #6 succeeded at 158 (offset -41 lines). Hunk #7 succeeded at 189 (offset -41 lines). $ cat ld80/e_powl.c.rej --- ld80/e_powl.c +++ ld80/e_powl.c @@ -23,10 +23,10 @@ * P[0] x^n + P[1] x^(n-1) + ... + P[n] */ static inline long double -__polevll(long double x, long double *PP, int n) +__polevll(long double x, const long double *PP, int n) { long double y; - long double *P; + const long double *P; P = PP; y = *P++; @@ -42,10 +42,10 @@ * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n] */ static inline long double -__p1evll(long double x, long double *PP, int n) +__p1evll(long double x, const long double *PP, int n) { long double y; - long double *P; + const long double *P; P = PP; n -= 1; Also I git compiler warnings (maybe due to the rejected part): ld80/e_powl.c: In function ‘powl’: ld80/e_powl.c:374:29: warning: passing argument 2 of ‘__polevll’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 374 | w = x * ( z * __polevll( x, P, 3 ) / __p1evll( x, Q, 3 ) ); | ^ Apart from that, various tests I did seem to indicate the multi-thread issue has gone, thanks! Paul
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p9u04j7wah8b.fsf>