From nobody Wed Aug 7 08:41:24 2024 X-Original-To: hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wf3Yn21kcz5SxCS; Wed, 07 Aug 2024 08:41:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wf3Ym4y9xz4JRS; Wed, 7 Aug 2024 08:41:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 4778fPaM037567; Wed, 7 Aug 2024 11:41:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 4778fPaM037567 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 4778fOiu037566; Wed, 7 Aug 2024 11:41:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 7 Aug 2024 11:41:24 +0300 From: Konstantin Belousov To: Paul Zimmermann 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: References: List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4Wf3Ym4y9xz4JRS On Wed, Aug 07, 2024 at 10:07:32AM +0200, Paul Zimmermann wrote: > Hi Konstantin, > > > Date: Tue, 6 Aug 2024 17:56:38 +0300 > > From: Konstantin Belousov > > 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 ) ); > | ^ Yes, we have some restructuring there, quite recent. Anyway, the main part of the patch is the marking of the statics with thread local. > > Apart from that, various tests I did seem to indicate the multi-thread issue > has gone, thanks! > Thank you for the testing.