From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id F10B53858D37 for ; Fri, 9 Sep 2022 09:15:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F10B53858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,302,1654588800"; d="diff'?scan'208,217";a="82797690" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 09 Sep 2022 01:15:11 -0800 IronPort-SDR: n8P9oomFdeiB8VM0tp3OJTLd6dIkH4ouJ/6zrWzL94g+lPt8AcTssPtuo+BOxN8Jrrh+D2+1OO gZYoYpapmoOBehNQGFE7TXTlAONtip2bdmkkZMsTX3ascCoROYrO3193xrHgb9VyGJwUM5QU5z nFdbZPDn5PaRLp8JHd/2+LSg9Fw0lWQXvC5VohZfcn1MG/hpPS6NDg1cF5MCzj50Mffp8LIzj4 f7ueeFo6RBU4fwI9fMJlcVkT/12rLv393gE+otFq/A0VYOyf6pYap0e/hbTRUrtX/ZW7ClK/gP dKc= Content-Type: multipart/mixed; boundary="------------jPdPlhx2Cv1AqEFG7XK3YC0M" Message-ID: <08966068-719a-30d1-5b71-7cf839e507e7@codesourcery.com> Date: Fri, 9 Sep 2022 11:15:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations Content-Language: en-US To: Andrew Stubbs , Kwok Cheung Yeung , gcc-patches , Richard Biener References: From: Tobias Burnus In-Reply-To: X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,KAM_DMARC_STATUS,KAM_SHORT,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --------------jPdPlhx2Cv1AqEFG7XK3YC0M Content-Type: multipart/alternative; boundary="------------O14f10YOYvYhESkUv35Uldfg" --------------O14f10YOYvYhESkUv35Uldfg Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable On 09.09.22 10:10, Andrew Stubbs wrote: On 08.09.22 22:38, Kwok Cheung Yeung wrote: The instructions for the transcendental functions are documented to have li= mited numerical precision, so they are only used if unsafe_math_optimizatio= ns are enabled for now. -funsafe-math-optimizations implies -fno-signed-zeros, -fno-trapping-math, = -fassociative-math, and -freciprocal-math. All of them reduce precision and my violate IEEE or = ISO/language standards. However, I think it is rather surprising to have all of the sudden only a p= recision of the order of 100,000,000 ULP instead of ~4 ULP as to be expected. That's a prec= ision loss of the order of 10^8 or 2^29 which is huge! For program deliberately using double precision, it can be too much =E2=80= =93 even if they do not need double precision in reality. (Weather forecast system recently moved to sin= gle precision as the quality is similar and benefits of faster results/finer grids or longer for= ecast times prevail.) As this behavior is highly surprising, I think it should be at least docume= nted. In https://gcc.gnu.org/PR105246 , I suggested a new flag (such as -mpermit-= reduced-precision) to make it possible turn it on/off explicitly (might be still enabled by -funs= afe-math-optimizations); alternatively, it could also be handled as initial guess for the result whi= ch is then refined in some iteration steps. (It could also be combined to give the user the ch= oice.) While still being convinced that a flag makes more sense than just document= ing it, I have nonetheless attached a documentation attempt. Thoughts? Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955 --------------O14f10YOYvYhESkUv35Uldfg-- --------------jPdPlhx2Cv1AqEFG7XK3YC0M Content-Type: text/x-patch; charset="UTF-8"; name="gcn-unsafe-math.diff" Content-Disposition: attachment; filename="gcn-unsafe-math.diff" Content-Transfer-Encoding: base64 R0NOOiBEb2N1bWVudCBpbiBpbnZva2UudGV4aSByZWR1Y2VkIHByZWNzIHdp dGggLWZ1bnNhZmUtbWF0aC1vcHQKCmdjYy9DaGFuZ2VMb2c6CgoJKiBkb2Mv aW52b2tlLnRleGkgKEFNRCBHQ04gT3B0aW9ucyk6IERvY3VtZW50IHRoYXQK CS1mdW5zYWZlLW1hdGgtb3B0aW1pemF0aW9ucyBpbXBsaWVzIHNpbmdsZS1w cmVjaXNpb24KCXJlc3VsdHMgZm9yIHNvbWUgbWF0aCBpbnRyaW5zaWNzLgoK ZGlmZiAtLWdpdCBhL2djYy9kb2MvaW52b2tlLnRleGkgYi9nY2MvZG9jL2lu dm9rZS50ZXhpCmluZGV4IDVjMDY2MjE5YTdkLi4wMTAxMWJkOWY5YiAxMDA2 NDQKLS0tIGEvZ2NjL2RvYy9pbnZva2UudGV4aQorKysgYi9nY2MvZG9jL2lu dm9rZS50ZXhpCkBAIC0yMDEzOSw4ICsyMDEzOSwxNCBAQCBwdXJwb3NlLiAg VGhlIGRlZmF1bHQgaXMgQG9wdGlvbnstbTFyZWctbm9uZX0uCiBAY2luZGV4 IEFNRCBHQ04gT3B0aW9ucwogCiBUaGVzZSBvcHRpb25zIGFyZSBkZWZpbmVk IHNwZWNpZmljYWxseSBmb3IgdGhlIEFNRCBHQ04gcG9ydC4KIAorTm90ZSB0 aGF0IHRoZSBAb3B0aW9uey1mdW5zYWZlLW1hdGgt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