From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2070.outbound.protection.outlook.com [40.107.21.70]) by sourceware.org (Postfix) with ESMTPS id BF9D33858409 for ; Fri, 21 Jul 2023 13:11:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF9D33858409 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n1n6GFsVLC08SSLyTumBNYX/cOsLi3yD5OtjA1FhoGE=; b=FnQasz2ueYX2EIhk8UwRXG5rz8ZK0oinKxO+4V0/ZopPO+IbGpbH6OeljjrvgfYGO2VfzdIMJ7lsSfwSOcPsLOEzJL09WwWPWjssaLKSSPwrebzOtR1Om93ABRJKWBJ8X05qx3yR4O5qsk3Dqa4r55XlCXEiPdfJhOoSRGcIJro= Received: from AM0PR02CA0140.eurprd02.prod.outlook.com (2603:10a6:20b:28d::7) by DU2PR08MB10279.eurprd08.prod.outlook.com (2603:10a6:10:46e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23; Fri, 21 Jul 2023 13:11:37 +0000 Received: from AM7EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:28d:cafe::45) by AM0PR02CA0140.outlook.office365.com (2603:10a6:20b:28d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28 via Frontend Transport; Fri, 21 Jul 2023 13:11:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT049.mail.protection.outlook.com (100.127.140.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28 via Frontend Transport; Fri, 21 Jul 2023 13:11:36 +0000 Received: ("Tessian outbound 997ae1cc9f47:v145"); Fri, 21 Jul 2023 13:11:36 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bc4a7b23bb2f27f9 X-CR-MTA-TID: 64aa7808 Received: from 81b0a6a8296c.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D058EEB1-3CE9-47D3-99EE-BE352296CBA2.1; Fri, 21 Jul 2023 13:11:25 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 81b0a6a8296c.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 21 Jul 2023 13:11:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8dyI6zbMb0BQQtuS9/ym71NglADJXdCev0n2E42BhRlU4q9bCASXDqctRv8hlCuRg7Qgjs4pK9CRO2XpEscyEotcaUBRFG9Hw5NnW0c+RgxpfIc+KvNAEHojompCy8QJzOuhpctX2bwyCQiofL6YZ5g83EoiL428wZnhXp0b0kLb7NdLtaaXNeVlVFFM8xgTDii5doPA7P9YArZXfa9IegvpFPPsMeX0Py3ktuqtBcX63Bj31hoo2DwcZg3bnfe4ct5bNHfaQ8MjNrUlvJhZu/mQiFYQFW6Owa+lGUGM+DSepj0iQ6SgPeXxC3DZpe/lueqeSMBVx1wpNSgyr6hdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n1n6GFsVLC08SSLyTumBNYX/cOsLi3yD5OtjA1FhoGE=; b=eDfWzzgGWj2KwpXkFe81DtLuh67pU/p0KWeAOK8p0UGcx2th8dih5fv6AdL6V4vouPK9qSmcbG7KNZtV12Q3U4hxQT0ZjQTT6VVTZOkirNcloetVUeBwo2pUfrbzJRIMss3yYHq4dnoUzTlDpf0A8dmUdHm2/qrloit5EHXIf/BfILxi5f7fXpj1Dr/OSFSxEA4yDFyuDDnWw6ZzBtbQlgBcGollPrq67UR3IE6JBqI4OoVhqsgW+sga6+CkfgTc07qBjVQQT12xQJU4qy4kZ0Mi+YwgyOTTd7yFidrpzIzzpd9A0/VwX6Dlj0FoFBULH5XthO5ZiMgo+2q/jAjrGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n1n6GFsVLC08SSLyTumBNYX/cOsLi3yD5OtjA1FhoGE=; b=FnQasz2ueYX2EIhk8UwRXG5rz8ZK0oinKxO+4V0/ZopPO+IbGpbH6OeljjrvgfYGO2VfzdIMJ7lsSfwSOcPsLOEzJL09WwWPWjssaLKSSPwrebzOtR1Om93ABRJKWBJ8X05qx3yR4O5qsk3Dqa4r55XlCXEiPdfJhOoSRGcIJro= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB9611.eurprd08.prod.outlook.com (2603:10a6:10:461::12) by AS2PR08MB8975.eurprd08.prod.outlook.com (2603:10a6:20b:5fb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 13:11:23 +0000 Received: from DB9PR08MB9611.eurprd08.prod.outlook.com ([fe80::465a:bdfa:eee2:77b7]) by DB9PR08MB9611.eurprd08.prod.outlook.com ([fe80::465a:bdfa:eee2:77b7%4]) with mapi id 15.20.6609.026; Fri, 21 Jul 2023 13:11:23 +0000 Message-ID: <62d34c82-b883-8497-1b6b-cc662d26b4c9@arm.com> Date: Fri, 21 Jul 2023 14:11:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] Reduce floating-point difficulties in timevar.cc Content-Language: en-US To: Richard Biener , Xi Ruoyao Cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com References: From: Matthew Malcomson In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0140.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::19) To DB9PR08MB9611.eurprd08.prod.outlook.com (2603:10a6:10:461::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR08MB9611:EE_|AS2PR08MB8975:EE_|AM7EUR03FT049:EE_|DU2PR08MB10279:EE_ X-MS-Office365-Filtering-Correlation-Id: e0da921f-503e-418d-c63a-08db89ec0399 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: dANbnU5jw/34Q7m5UbVw7QMz/aBKfBC57Ag4gZTQUOKj9q1w4cV16/BGxEbr4LIbCeLkF1se+ebH+a0yBIoOAL6Y5fEtvEbu/TeX7mCncd1P4F5IqC8F3p4EvZWFnzLOlzmlH662Ohl0FxyT2HU8cz6MuJE+AE78wiYeYJhtTa//gdMogA5c5626LrbClBaPMSzEPPkvlAsZfAeRu/FSiP98u8IraXK9ccBvZ00CDtKN1l6GMaK2ao50Dp5GX4eKl3KKr9OCBzl1GvPFxohoFAh9DmA/XNBxO1vAfM7nTbVzQAWo4wHYIt1D8dEGanxGnDwE5yF1qPMNnVLSxJ3eh/bD0OKTcesF2774ZQ1QOWLDvTU8kH2Q4HOBxjOH1B1jmSPU3DNVuXxPjUwjI5J6UnWz90FIE4B9hewbcWqcf4KkX+tMyn2XrTP5uV6kZKzDCBYVT+gHdNaJYvpbSh5q0FZFCGzIwo3K8wjLfCPtvcg115QjrLcNvj9JgiRRLiLVhALi0SjbaEXinqbIZVyzWZHuyCYQb1o4j75t7YlOjL2d5HOHQGbij3517svnalkuQnctLNdDtc4oVMzxmtPPTk5Y+7gSYWwFYsuppWa/WPd2GDVzjCdO2dUBtF7TL/kWAH7VCKL8B3LU3mQN6HIEIQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB9611.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(366004)(39860400002)(346002)(376002)(451199021)(38100700002)(2616005)(36756003)(83380400001)(66556008)(66476007)(4326008)(2906002)(478600001)(316002)(66946007)(110136005)(6666004)(6512007)(6486002)(26005)(186003)(41300700001)(8936002)(8676002)(6506007)(44832011)(53546011)(5660300002)(31696002)(86362001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8975 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 643515e8-959d-46f9-b307-08db89ebfb75 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MDCJedhUPA6mNFEaPTZDOuB3Yu7jtY08ZbVQ0IkxUP0XB3RTxz7b9xgEoEsHgqxydMf9oC48q0p5GyHKu9QYYdpflUelYNXWfn7yOMwpHkIEQMrSCE30g3fyhtsF1m/T6KvZrJtF+kGC53Bw+9xjjBUyDJEMLOkqnXdcdFAj+ArbYqGY66IfOtsVMfULA5VnrCGNkOGwdnZmyCkLKV/fgZzy2ytI0z81SVCdfRPr0xxatnBoRPuLP8/pi2m/3YEzR9hWzwa2nVkbV0yuPXD+E/yO8ebp4cC3nRLxDxNIGHTf3CfkwP0NyiyiBleBi9cizLoeczYSsx7L01/JgBwduAPuJCci79J/MnzWerlqewmPM1RFzCKuUn4e93Gp2uShGFDatLIjr9g+OoOr5vCI1PWZ17rMqVGNtPCa8uPwjaNQVxbTzk7CiIlV5TS9sZQ08qsVNq8k+/fT97qbMDogTTH2qNsOYKd1/gN6DiJ1lz0h4aS8hDBq1u+FaV9lqDu7a5P4s9Wfvhj9TYmS8935MyyFZ/TOSIAQYf1f3lxoefSwVac6Ck3WHw9g5wXoEkWRxPUqpGa3Faq4Rp4WVXRdLJkBlfy3Sn1cXK5mWW7uBv+O0OXUNOXMR/Lxc5b0eK1YDQl8/3nbnG4PoGBxlNgTxRuSkw5pWwwSLV5Tgeyj9oiT3onZt4Lp5/57cYw3CVgv9mk+HS7xQ0JiPM0IlGXORu7rDNt9X/hKf/eLybckxDnt4vJF2PFhGCSKFFqIGbAMvIs2LZHVzeIrXbItnJnbXA== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(396003)(136003)(376002)(82310400008)(451199021)(36840700001)(40470700004)(46966006)(186003)(6506007)(2616005)(53546011)(356005)(82740400003)(336012)(31686004)(26005)(110136005)(81166007)(478600001)(6666004)(83380400001)(70586007)(70206006)(4326008)(6486002)(47076005)(36860700001)(6512007)(44832011)(8936002)(316002)(8676002)(40460700003)(41300700001)(86362001)(2906002)(31696002)(40480700001)(36756003)(5660300002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 13:11:36.8284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0da921f-503e-418d-c63a-08db89ec0399 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10279 X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Responding to two emails at the same time ;-) On 7/21/23 13:47, Richard Biener wrote: > On Fri, 21 Jul 2023, Matthew Malcomson wrote: > >> On some AArch64 bootstrapped builds, we were getting a flaky test >> because the floating point operations in `get_time` were being fused >> with the floating point operations in `timevar_accumulate`. >> >> This meant that the rounding behaviour of our multiplication with >> `ticks_to_msec` was different when used in `timer::start` and when >> performed in `timer::stop`. These extra inaccuracies led to the >> testcase `g++.dg/ext/timevar1.C` being flaky on some hardware. >> >> This change ensures those operations are not fused and hence stops the test >> being flaky on that particular machine. There is no expected change in the >> generated code. >> Bootstrap & regtest on AArch64 passes with no regressions. > > I think this is undesriable. With fused you mean we use FMA? > I think you could use -ffp-contract=off for the TU instead. Yeah -- we used fused multiply subtract because we combined the multiply in `get_time` with the subtract in `timevar_accumulate`. > > Note you can't use __attribute__((noinline)) literally since the > host compiler might not support this. > > Richard. > On 7/21/23 13:49, Xi Ruoyao wrote: ... > I don't think it's correct. It will break bootstrapping GCC from other > ISO C++11 compilers, you need to at least guard it with #ifdef __GNUC__. > And IMO it's just hiding the real problem. > > We need more info of the "particular machine". Is this a hardware bug > (i.e. the machine violates the AArch64 spec) or a GCC code generation > issue? Or should we generally use -ffp-contract=off in BOOT_CFLAGS? > My understanding is that this is not a hardware bug and that it's specified that rounding does not happen on the multiply "sub-part" in `FNMSUB`, but rounding happens on the `FMUL` that generates some input to it. I was given to understand from discussions with others that this codegen is allowed -- though I honestly didn't confirm the line of reasoning through all the relevant standards. ------------------------ W.r.t. both: Thanks for pointing out bootstrapping from other ISO C++ compilers -- (didn't realise that was a concern). I can look into `-ffp-contract=off` as you both have recommended. One question -- if we have concerns that the host compiler may not be able to handle `attribute((noinline))` would we also be concerned that this flag may not be supported? (Or is the severity of lack of support sufficiently different in the two cases that this is fine -- i.e. not compile vs may trigger floating point rounding inaccuracies?)