From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 70EE5393C87D for ; Mon, 28 Jun 2021 07:01:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 70EE5393C87D Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15S6YHmv042781; Mon, 28 Jun 2021 03:01:20 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39f5whcwyr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Jun 2021 03:01:20 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15S6Z9Xp049500; Mon, 28 Jun 2021 03:01:19 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 39f5whcwy0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Jun 2021 03:01:19 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15S6psQg031224; Mon, 28 Jun 2021 07:01:17 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 39duv88mcb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Jun 2021 07:01:17 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15S71FLI35193228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Jun 2021 07:01:15 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 24D16A4108; Mon, 28 Jun 2021 07:01:15 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEDDAA41A2; Mon, 28 Jun 2021 07:01:13 +0000 (GMT) Received: from kewenlins-mbp.cn.ibm.com (unknown [9.200.147.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 28 Jun 2021 07:01:13 +0000 (GMT) Subject: PING^2 [PATCH v2] rs6000: Add load density heuristic To: GCC Patches Cc: Bill Schmidt , David Edelsohn , Segher Boessenkool References: <7b9f9bdf-1ed5-139b-de9c-511ee8454b85@linux.ibm.com> <3424a3d3-fa4e-16f9-89c6-0b07beec957d@linux.ibm.com> <733f25c0-4c39-e490-6c0b-a9d8a6b51126@linux.ibm.com> From: "Kewen.Lin" Message-ID: <84090dc8-1aa4-8abd-5c14-428491ac16aa@linux.ibm.com> Date: Mon, 28 Jun 2021 15:01:12 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 In-Reply-To: <733f25c0-4c39-e490-6c0b-a9d8a6b51126@linux.ibm.com> Content-Type: text/plain; charset=gbk Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4CfokJEuDtVBKzmOoF5flSNxlMKUQtiE X-Proofpoint-GUID: lHF9oR8BSlJ9gcVBROFAbu4l-eHgztA9 Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-28_05:2021-06-25, 2021-06-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106280045 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, KAM_SHORT, MIME_CHARSET_FARAWAY, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 07:01:21 -0000 Hi, Gentle ping this: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571258.html BR, Kewen on 2021/6/9 ÉÏÎç10:26, Kewen.Lin via Gcc-patches wrote: > Hi, > > Gentle ping this: > > https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571258.html > > BR, > Kewen > > on 2021/5/26 ÉÏÎç10:59, Kewen.Lin via Gcc-patches wrote: >> Hi, >> >> This is the updated version of patch to deal with the bwaves_r >> degradation due to vector construction fed by strided loads. >> >> As Richi's comments [1], this follows the similar idea to over >> price the vector construction fed by VMAT_ELEMENTWISE or >> VMAT_STRIDED_SLP. Instead of adding the extra cost on vector >> construction costing immediately, it firstly records how many >> loads and vectorized statements in the given loop, later in >> rs6000_density_test (called by finish_cost) it computes the >> load density ratio against all vectorized stmts, and check >> with the corresponding thresholds DENSITY_LOAD_NUM_THRESHOLD >> and DENSITY_LOAD_PCT_THRESHOLD, do the actual extra pricing >> if both thresholds are exceeded. >> >> Note that this new load density heuristic check is based on >> some fields in target cost which are updated as needed when >> scanning each add_stmt_cost entry, it's independent of the >> current function rs6000_density_test which requires to scan >> non_vect stmts. Since it's checking the load stmts count >> vs. all vectorized stmts, it's kind of density, so I put >> it in function rs6000_density_test. With the same reason to >> keep it independent, I didn't put it as an else arm of the >> current existing density threshold check hunk or before this >> hunk. >> >> In the investigation of -1.04% degradation from 526.blender_r >> on Power8, I noticed that the extra penalized cost 320 on one >> single vector construction with type V16QI is much exaggerated, >> which makes the final body cost unreliable, so this patch adds >> one maximum bound for the extra penalized cost for each vector >> construction statement. >> >> Bootstrapped/regtested on powerpc64le-linux-gnu P9. >> >> Full SPEC2017 performance evaluation on Power8/Power9 with >> option combinations: >> * -O2 -ftree-vectorize {,-fvect-cost-model=very-cheap} {,-ffast-math} >> * {-O3, -Ofast} {,-funroll-loops} >> >> bwaves_r degradations on P8/P9 have been fixed, nothing else >> remarkable was observed. >> >> Is it ok for trunk? >> >> [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570076.html >> >> BR, >> Kewen >> ----- >> gcc/ChangeLog: >> >> * config/rs6000/rs6000.c (struct rs6000_cost_data): New members >> nstmts, nloads and extra_ctor_cost. >> (rs6000_density_test): Add load density related heuristics and the >> checks, do extra costing on vector construction statements if need. >> (rs6000_init_cost): Init new members. >> (rs6000_update_target_cost_per_stmt): New function. >> (rs6000_add_stmt_cost): Factor vect_nonmem hunk out to function >> rs6000_update_target_cost_per_stmt and call it. >> >