From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54806 invoked by alias); 9 Mar 2018 19:06:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 54783 invoked by uid 89); 9 Mar 2018 19:06:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=insanely X-HELO: EUR03-DB5-obe.outbound.protection.outlook.com From: Wilco Dijkstra To: =?iso-8859-2?Q?Ond=F8ej_B=EDlka?= , Siddhesh Poyarekar CC: "libc-alpha@sourceware.org" , nd Subject: Re: [PATCH 2/6] Remove slow paths from sin/cos Date: Fri, 09 Mar 2018 19:06:00 -0000 Message-ID: References: <8065ca77-ec8f-9925-7e9c-52266cd1e4c6@gotplt.org>,<20180309181902.GA26430@domone> In-Reply-To: <20180309181902.GA26430@domone> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB6PR0801MB1669;7:d2HpQLEkcGl2grKkqiS4fbYQ1LrriI1EvVWPOMfm53Rmp5MIfcf2Cq4FuqK+b2rZVvAlSLrZNFuWMk0W+Vh+I7H1XQe4xtnoc3eZk/QthqsBoJaOHr6JHgruSIUbGkqaRw0G8FbCORgG2H83ko8shV5941WtvgAtR5tn59Vc2w1PnJEC3lD+KVjJoxlk5gQVtzasDdVwb32A5ZWJ5jMCIvSwmGavj1zlyc/nn72TkA7sJaafA+OhMACDsd0c7Nhx x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b40d8181-c6a6-4e8f-0cb0-08d585f0d220 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB1669; x-ms-traffictypediagnostic: DB6PR0801MB1669: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:DB6PR0801MB1669;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB1669; x-forefront-prvs: 0606BBEB39 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(366004)(346002)(39380400002)(376002)(396003)(199004)(189003)(86362001)(6436002)(7736002)(4326008)(66066001)(74316002)(53936002)(68736007)(316002)(55016002)(8656006)(305945005)(8676002)(5660300001)(81156014)(8936002)(6506007)(6246003)(478600001)(105586002)(9686003)(14454004)(54906003)(72206003)(110136005)(81166006)(25786009)(3846002)(6116002)(7696005)(76176011)(102836004)(99286004)(97736004)(3280700002)(2950100002)(229853002)(186003)(33656002)(26005)(106356001)(2906002)(5250100002)(3660700001)(2900100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0801MB1669;H:DB6PR0801MB2053.eurprd08.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: q2c8trVGMbk78/Tgr+SW5PlkwUHvs6Apl6Xl52maXBd1Uy3YHTPihvfBI/ZCIeZI8Ie3c9jRb/sgetXfT3bm8dGTtpVeIL4flyHOhXtTPZUrlycRhjRGhrLeLxYvFuYRssRo5GhlALde/w/YP5apymqx1O6pkpoZdaomBCjDbvhBCCvOVqsWewKH1esxcf/ZMmELaWkijIzVk5dcso4MBQtKh7DXXT/4KclzvsKX0hjzin6r+EGSyseE9bupA9/7U0v+wk+uf81LE4TCth4d4JS7/NWLp81S4GLt6uLmo9ljt24k3HcyLf3TSiKISr6cH4uofGU60SlU/Ejcz0z72g== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: b40d8181-c6a6-4e8f-0cb0-08d585f0d220 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2018 19:06:10.6129 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1669 X-SW-Source: 2018-03/txt/msg00251.txt.bz2 Ond=F8ej B=EDlka wrote: > On Fri, Mar 09, 2018 at 09:47:09PM +0530, Siddhesh Poyarekar wrote: >> On Friday 09 March 2018 09:16 PM, Wilco Dijkstra wrote: >> > This patch removes 2nd of the 3 range reduction cases and defer to the= final one. >> > Input values above 2^27 are extremely rare, so this case doesn't need = to as be >> > optimized as smaller inputs. >>=20 >> Please elaborate on two more points: >>=20 >> - The basis for your claim that values above 2^27 are extremely rare, >>=A0=A0 i.e. papers that you may have referred that conclude this and/or >>=A0=A0 applications you may have profiled >>=20 > Main reason is that for these inputs accuracy doesn't make a sense. > There is already millions bigger error caused by limited precision when > rounding input to float. Exactly, it's rare for sin/cos input to be > 10, largest I've ever seen was= around 1000.=20 There is a case to be made for making wildly out or range inputs an error o= r just return 0.0 rather than using insanely accurate range reduction (the result is going to= be equally wrong either way), but that's a different discussion. Fast range reduction of up to 2^27 is a huge overkill, we could get a signi= ficant speedup by reducing this range. The 2nd level range reduction (2^27 till 2^48) is so pointless that there i= s absolutely no reason keep it. There is about a 2.3x slowdown in this range due to __branr= ed being braindead slow. Basically I can only see a reason for 3 levels of range reduction if the fi= rst range reduction only handles a tiny range (say up to 10), the final range reduction is extr= emely slow and we can find proof of an application relying on fast range reduction up to say = 1000 or 1000000. I think a 3-4x speedup of __branred should be feasible using a much simpler= algorithm and integer arithmetic. This will not only cover a much wider range but then we= will also be sure it works correctly! Wilco