From patchwork Wed Nov 22 04:15:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 168095 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1088585vqb; Tue, 21 Nov 2023 20:18:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWbByNNMQzcAg76H9tabP2rpmgDXhaHjwxn+cIFqci+9wHtLrXrLPuqgKcoKnc0WP6Ftzn X-Received: by 2002:ac8:5e10:0:b0:423:6fd1:40b with SMTP id h16-20020ac85e10000000b004236fd1040bmr1170937qtx.52.1700626698216; Tue, 21 Nov 2023 20:18:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700626698; cv=pass; d=google.com; s=arc-20160816; b=XeBRAoTjJBYyM6247MNSU5oJ5/+Lod5gLOf21pt+lSIgcez6dqDwH5p5pue2Fo9t+s jxyFcTg14Y7RnMcRHD3oK5smikVJokxssqoIBySeDVG4BWT4SLLVKb5uhJjfFxIsYl4o kX0H/0myBqBdWT6ttS6fJO1hxR7a/4gmO+3vuOZfDCsC2hF8gbLPG2tRwuqelzFYZCje nyq4WyrGmjhQIbDKKzguGKlp6g0Vnz7X9C+ZwhD87vte1k/6W8tIsuAFFuz5ev+Dyr+v L7QNIPp/nHt8vqvq0MFM/AkgEW5bAS9/3sAJZRe2sPTOWzmCwmvRsk3EljCEbKJ4Nqk2 topw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=lFcAO3yyMTWr2tYEAMG3wnZ/22z/ICmwUi1eeu3gAtc=; fh=P34bkTN01XZGCADOX+RQw9SEp+RbZR4iFMJGkdMlhcQ=; b=rxHvrjKbK+7nAKMmswCPgn2gGmchvKL403jBW+uHQZ5yWiEhQkNZUdCkVgz7BtLcLV M1ieFUlgEiFla8KnPDQqZdOMW4YUK+kHG7FdmN/tNYS9Nv+idPezUi9si/xeUjBsWBiN ZCFt2kqP23Gc+hmStL/glwvojFNC1x2icDt0/sEXI3qC9gs+xBuc+Sknxgb38q7Ls3Cs telrXQzu39BGZCOiuTAjaCDAYutVKtBvPdRuUXR83tScAQP9hGkvb/mgEfRdOTJ9kroX y0OLD/ZR6I+IyZAxeGIi5p2Trl4DZl/3QNHGvUl3BEjJ2ADLLPzcT6gVYLx9RVL/+sKF f2kw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IAnciE32; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id gd13-20020a05622a5c0d00b004237dbacfcbsi357906qtb.778.2023.11.21.20.18.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 20:18:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IAnciE32; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0436A3858C31 for ; Wed, 22 Nov 2023 04:18:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by sourceware.org (Postfix) with ESMTPS id E4EB63858D33 for ; Wed, 22 Nov 2023 04:17:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E4EB63858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E4EB63858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.55.52.136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700626674; cv=none; b=DSf8j9Zel1yqfQK8TzSfYp+VUygVJprM8LK0CCRaCoTcA9L8UdnrUHFxmU2oj8KM1Ia8+510xJGAmaBhgN+1KwNtV7Xjv25St1M54nCG0qkalzpX0EteLDagapE0YItLVrGKnsffd6DKJ9EXeXPMp7Qwd9nwgsKDQQAFVRVnNh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700626674; c=relaxed/simple; bh=KnRlCEGbYOTP+1Kbqw0V2NsPr9HAE+JgV4iqNhDFRe0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=DTnLIPj65WF65kaOLxw+hbnIHx5JHtp0mfBYVV0T7VHHHOVklXPxv1bTP4OTsga+40/j7hX5SWLhbB8POTOEeeLz3wCTwtz+ngB5nu/Td6CNargs0X/VcPBAhG21gkCMCa/Ig0NJynf8kq7xD3ryFQ3lTIrNu2m6x5uMNjJziBc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700626671; x=1732162671; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KnRlCEGbYOTP+1Kbqw0V2NsPr9HAE+JgV4iqNhDFRe0=; b=IAnciE329EaduTaPYgVw/NXZbw980LjqWvV0YgZnjc4M3beBXZ1ZvVl3 DXM7PlBM3DXgHZQ8XEI8v37ROfsuir7Q0EVMTztWCqPSXqRl4zANhc1+L Q+uB41QgxzVpHfd0KTzVXOlRuMZmo3O5n2ynb59MSjdissN5BJTBCrg5y DJc+dMOLGjPpJHDgumRWx2Yw30thrUgRE03NYMMQ+4h/WhqYCDjST/YcP 4z4J0txWRpJzmXjBnVYKu2vFvLE6m8lU306ZHoBx4ZwV4O4f6LSvDe67Z Gh+pbqjD7z7o3JZmoweEshNSWVkx29ac3sVQ0vOsrX4elXe/e8xF2fhoJ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="371329508" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="371329508" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 20:17:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="8311470" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmviesa002.fm.intel.com with ESMTP; 21 Nov 2023 20:17:50 -0800 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 2B1ED1005606; Wed, 22 Nov 2023 12:17:48 +0800 (CST) From: liuhongt To: gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, hjl.tools@gmail.com, "Zhang, Annita" Subject: [PATCH] Set AVOID_256FMA_CHAINS TO m_GENERIC as it's generally good to new platforms Date: Wed, 22 Nov 2023 12:15:48 +0800 Message-Id: <20231122041548.3655374-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783236340255226004 X-GMAIL-MSGID: 1783236340255226004 From: "Zhang, Annita" Avoid_fma_chain was enabled in m_SAPPHIRERAPIDS, m_ALDERLAKE and m_CORE_HYBRID. It can also be enabled in m_GENERIC to improve the performance of -march=x86-64-v3/v4 with -mtune=generic set by default. One SPEC2017 benchmark 510.parest_r can improve greatly due to it. From the experiments, the single thread with -O2 -march=x86-64-v3 can improve 26% on SPR, and 15% on Zen3. Meanwhile, it didn't cause notable regression in previous platforms including Cascade Lake and Ice Lake Server. On zenver4, it looks like fadd(3 cycles) is still fater than fma(4 cycles). So in theory, avoid_fma_chain should be also better for znver4. And according to [1], enable fma_chain is not a generic win on znver4? ----cut from [1]--------------- I also added X86_TUNE_AVOID_256FMA_CHAINS. Since fma has improved in zen4 this flag may not be a win except for very specific benchmarks. I am still doing some more detailed testing here. -----cut end-------------- [1] https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607962.html Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. Ok for trunk? gcc/ChangeLog * config/i386/x86-tune.def (AVOID_256FMA_CHAINS): Add m_GENERIC. --- gcc/config/i386/x86-tune.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def index 43fa9e8fd6d..a2e57e01550 100644 --- a/gcc/config/i386/x86-tune.def +++ b/gcc/config/i386/x86-tune.def @@ -521,7 +521,7 @@ DEF_TUNE (X86_TUNE_AVOID_128FMA_CHAINS, "avoid_fma_chains", m_ZNVER1 | m_ZNVER2 /* X86_TUNE_AVOID_256FMA_CHAINS: Avoid creating loops with tight 256bit or smaller FMA chain. */ DEF_TUNE (X86_TUNE_AVOID_256FMA_CHAINS, "avoid_fma256_chains", m_ZNVER2 | m_ZNVER3 - | m_CORE_HYBRID | m_SAPPHIRERAPIDS | m_CORE_ATOM) + | m_CORE_HYBRID | m_SAPPHIRERAPIDS | m_CORE_ATOM | m_GENERIC) /* X86_TUNE_AVOID_512FMA_CHAINS: Avoid creating loops with tight 512bit or smaller FMA chain. */