From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100576 invoked by alias); 11 Feb 2020 02:15:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 100377 invoked by uid 89); 11 Feb 2020 02:15:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 02:15:02 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01B2AJKF126174; Mon, 10 Feb 2020 21:15:00 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y1tn5e4fw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Feb 2020 21:15:00 -0500 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 01B2BqlQ128889; Mon, 10 Feb 2020 21:14:59 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y1tn5e4fh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Feb 2020 21:14:59 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01B2Af6e021161; Tue, 11 Feb 2020 02:14:58 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma03dal.us.ibm.com with ESMTP id 2y1mm6w0gb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Feb 2020 02:14:58 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01B2EvOR32768462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Feb 2020 02:14:57 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C6359AC064; Tue, 11 Feb 2020 02:14:57 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E3CFAC060; Tue, 11 Feb 2020 02:14:57 +0000 (GMT) Received: from genoa.aus.stglabs.ibm.com (unknown [9.40.192.157]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTPS; Tue, 11 Feb 2020 02:14:57 +0000 (GMT) From: Jiufu Guo To: "Kewen.Lin" Cc: Segher Boessenkool , GCC Patches , Bill Schmidt , "bin.cheng" , Richard Guenther Subject: Re: [PATCH 1/4 v2 GCC11] Add middle-end unroll factor estimation References: <131a3294-1951-3678-453b-085744366af6@linux.ibm.com> <20200120130249.GW3191@gate.crashing.org> <2aefe945-ac95-a472-a6b2-3b2ae3e63f4d@linux.ibm.com> Date: Tue, 11 Feb 2020 02:15:00 -0000 In-Reply-To: <2aefe945-ac95-a472-a6b2-3b2ae3e63f4d@linux.ibm.com> (Kewen Lin's message of "Mon, 10 Feb 2020 14:20:17 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00609.txt.bz2 "Kewen.Lin" writes: > Hi Segher, > > Thanks for your comments! Updated to v2 as below: > > 1) Removed unnecessary hook loop_unroll_adjust_tree. > 2) Updated estimated_uf to estimated_unroll and some comments. > > gcc/ChangeLog > > 2020-02-10 Kewen Lin > > * cfgloop.h (struct loop): New field estimated_unroll. > * tree-ssa-loop-manip.c (decide_uf_const_iter): New function. > (decide_uf_runtime_iter): Likewise. > (decide_uf_stupid): Likewise. > (estimate_unroll_factor): Likewise. In RTL unroller, target hooks are also involved when decide unroll factor, so these decide_uf_xx functions may not same with final real unroll factor in RTL. For example, at O2 by default, small loops will be unrolled 2 times.=20 > * tree-ssa-loop-manip.h (estimate_unroll_factor): New declare. > * tree-ssa-loop.c (tree_average_num_loop_insns): New function. > * tree-ssa-loop.h (tree_average_num_loop_insns): New declare. > > BR, > Kewen > > on 2020/1/20 =E4=B8=8B=E5=8D=889:02, Segher Boessenkool wrote: >> Hi! >>=20 >> On Thu, Jan 16, 2020 at 05:39:40PM +0800, Kewen.Lin wrote: >>> --- a/gcc/cfgloop.h >>> +++ b/gcc/cfgloop.h >>> @@ -232,6 +232,9 @@ public: >>> Other values means unroll with the given unrolling factor. */ >>> unsigned short unroll; >>>=20=20 >>> + /* Like unroll field above, but it's estimated in middle-end. */ >>> + unsigned short estimated_uf; >>=20 >> Please use full words? "estimated_unroll" perhaps? (Similar for other >> new names). >>=20 > > Done. > >>> +/* Implement targetm.loop_unroll_adjust_tree, strictly refers to >>> + targetm.loop_unroll_adjust. */ >>> + >>> +static unsigned >>> +rs6000_loop_unroll_adjust_tree (unsigned nunroll, struct loop *loop) >>> +{ >>> + /* For now loop_unroll_adjust is simple, just invoke directly. */ >>> + return rs6000_loop_unroll_adjust (nunroll, loop); >>> +} >>=20 >> Since the two hooks have the same arguments as well, it should really >> just be one hook, and an implementation can check whether >> current_pass->type =3D=3D RTL_PASS >> if it needs to do something special for RTL, etc.? Or it can use some >> more appropriate condition -- the point is you need no extra hook. >>=20 > > Good point, removed it. > >>> + /* Check number of iterations is constant. */ >>> + if ((niter_desc->may_be_zero && !integer_zerop (niter_desc->may_be_z= ero)) >>> + || !tree_fits_uhwi_p (niter_desc->niter)) >>> + return false; >>=20 >> Check, and do what? It's easier to read if you say. >>=20 > > Done. > >>=20 >> "If loop->unroll is set, use that as loop->estimated_unroll"? >>=20 > > Done.