From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65016 invoked by alias); 14 Jan 2019 08:15:37 -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 62555 invoked by uid 89); 14 Jan 2019 08:15:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Did X-HELO: mail-it1-f179.google.com Received: from mail-it1-f179.google.com (HELO mail-it1-f179.google.com) (209.85.166.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Jan 2019 08:15:32 +0000 Received: by mail-it1-f179.google.com with SMTP id c9so11086752itj.1 for ; Mon, 14 Jan 2019 00:15:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6id3ADsqA6Gbd51KkEuxiMieKtAJigPn0An4ZKzfh+o=; b=WeJttqAF5MJpgXyqA86pEozpM0OBF/Hhn/hhGabQ8NBuIOxDwpU75G2SPrfBjWnQ01 3PRuSnY5yqIxzDt4qkp8TmYJJoBsnwELD3UdGHXvWw/OkkBEXMp2xSwH/u46z2F1Dv++ T1vMMZBqvCHOdDNHrN6vIUmqVE7wJSR2pmsN+OPEZMwnbwM/+T4+392tD2t3q3R7JzA7 UrPd1Pa78XXzX2gJcWJetgB8GLlUWnJHUkRFndQ0sSXSpen2CKLXLhS7C6P44tzOJjAW r6NTmziWnqliDyqX5u7eezw5a68OAnA1GsPO6/76UjxKbxEQKKW1grNwZLEEElXVOTmH 3U5w== MIME-Version: 1.0 References: <87wooai8cs.fsf@linux.intel.com> <20190114080726.GD6118@tassilo.jf.intel.com> In-Reply-To: <20190114080726.GD6118@tassilo.jf.intel.com> From: "Bin.Cheng" Date: Mon, 14 Jan 2019 08:15:00 -0000 Message-ID: Subject: Re: [PATCH AutoFDO]Restoring indirect call value profile transformation To: Andi Kleen Cc: bin.cheng@linux.alibaba.com, gcc-patches List Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00747.txt.bz2 On Mon, Jan 14, 2019 at 4:07 PM Andi Kleen wrote: > > Bin Cheng, > > I did some testing on this now. The attached patch automatically increases the iterations > for autofdo profiles. Hi Andi, thanks very much for tuning these. > > But even with even more iterations I still have stable failures in > > FAIL: gcc.dg/tree-prof/cold_partition_label.c scan-assembler foo[._]+cold > FAIL: gcc.dg/tree-prof/cold_partition_label.c scan-assembler size[ \ta-zA-Z0-0]+foo[._]+cold I think these two are supposed to fail with current code base. > FAIL: gcc.dg/tree-prof/indir-call-prof.c scan-ipa-dump afdo "Indirect call -> direct call.* a1 transformation on insn" I also got unstable pass/fail for indirect call optimization when tuning iterations, and haven't got an iteration number which passes all the time. I guess we need to combine decreasing of sampling count here. > FAIL: gcc.dg/tree-prof/peel-1.c scan-tree-dump cunroll "Peeled loop ., 1 times" This one should fail too. Thanks, bin > > Did these really ever work for you? > > -Andi > > > diff --git a/gcc/testsuite/g++.dg/tree-prof/morefunc.C b/gcc/testsuite/g++.dg/tree-prof/morefunc.C > index a9bdc167f45..02b01c073e9 100644 > --- a/gcc/testsuite/g++.dg/tree-prof/morefunc.C > +++ b/gcc/testsuite/g++.dg/tree-prof/morefunc.C > @@ -2,6 +2,10 @@ > #include "reorder_class1.h" > #include "reorder_class2.h" > > +#ifndef ITER > +#define ITER 1000 > +#endif > + > int g; > > #ifdef _PROFILE_USE > @@ -19,7 +23,7 @@ static __attribute__((always_inline)) > void test1 (A *tc) > { > int i; > - for (i = 0; i < 1000; i++) > + for (i = 0; i < ITER; i++) > g += tc->foo(); > if (g<100) g++; > } > @@ -28,7 +32,7 @@ static __attribute__((always_inline)) > void test2 (B *tc) > { > int i; > - for (i = 0; i < 1000000; i++) > + for (i = 0; i < ITER; i++) > g += tc->foo(); > } > > diff --git a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c > index 450308d6407..099069da6a7 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c > @@ -9,6 +9,10 @@ const char *sarr[SIZE]; > const char *buf_hot; > const char *buf_cold; > > +#ifndef ITER > +#define ITER 1000000 > +#endif > + > __attribute__((noinline)) > void > foo (int path) > @@ -32,7 +36,7 @@ main (int argc, char *argv[]) > int i; > buf_hot = "hello"; > buf_cold = "world"; > - for (i = 0; i < 1000000; i++) > + for (i = 0; i < ITER; i++) > foo (argc); > return 0; > } > diff --git a/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c b/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c > index 58109d54dc7..32d22c69c6c 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1.c > @@ -2,6 +2,10 @@ > /* { dg-additional-sources "crossmodule-indircall-1a.c" } */ > /* { dg-options "-O3 -flto -DDOJOB=1" } */ > > +#ifndef ITER > +#define ITER 1000 > +#endif > + > int a; > extern void (*p[2])(int n); > void abort (void); > @@ -10,12 +14,12 @@ main() > { int i; > > /* This call shall be converted. */ > - for (i = 0;i<1000;i++) > + for (i = 0;i p[0](1); > /* This call shall not be converted. */ > - for (i = 0;i<1000;i++) > + for (i = 0;i p[i%2](2); > - if (a != 1000) > + if (a != ITER) > abort (); > > return 0; > diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c > index 53063c3e7fa..8b9dfbb78c7 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c > @@ -1,5 +1,9 @@ > /* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile -fdump-ipa-afdo" } */ > > +#ifndef ITER > +#define ITER 100000 > +#endif > + > static int a1 (void) > { > return 10; > @@ -28,7 +32,7 @@ main (void) > int (*p) (void); > int i; > > - for (i = 0; i < 10000000; i ++) > + for (i = 0; i < ITER*100; i++) > { > setp (&p, i); > p (); > diff --git a/gcc/testsuite/gcc.dg/tree-prof/peel-1.c b/gcc/testsuite/gcc.dg/tree-prof/peel-1.c > index 7245b68c1ee..b6ed178e1ad 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/peel-1.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/peel-1.c > @@ -1,13 +1,17 @@ > /* { dg-options "-O3 -fdump-tree-cunroll-details -fno-unroll-loops -fpeel-loops" } */ > void abort(); > > -int a[1000]; > +#ifndef ITER > +#define ITER 1000 > +#endif > + > +int a[ITER]; > int > __attribute__ ((noinline)) > t() > { > int i; > - for (i=0;i<1000;i++) > + for (i=0;i if (!a[i]) > return 1; > abort (); > @@ -16,7 +20,7 @@ int > main() > { > int i; > - for (i=0;i<1000;i++) > + for (i=0;i t(); > return 0; > } > diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr52027.c b/gcc/testsuite/gcc.dg/tree-prof/pr52027.c > index c46a14b2e86..bf2a83a336d 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/pr52027.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/pr52027.c > @@ -2,6 +2,10 @@ > /* { dg-require-effective-target freorder } */ > /* { dg-options "-O2 -freorder-blocks-and-partition -fno-reorder-functions" } */ > > +#ifndef ITER > +#define ITER 1000 > +#endif > + > void > foo (int len) > { > @@ -13,7 +17,7 @@ int > main () > { > int i; > - for (i = 0; i < 1000; i++) > + for (i = 0; i < ITER; i++) > foo (8); > return 0; > } > diff --git a/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c b/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c > index 1e64f284ac0..65570a5e96d 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c > @@ -1,9 +1,14 @@ > /* { dg-options "-O2 -ftracer -fdump-tree-tracer" } */ > + > +#ifndef ITER > +#define ITER 1000 > +#endif > + > volatile int a, b, c; > int main () > { > int i; > - for (i = 0; i < 1000; i++) > + for (i = 0; i < ITER; i++) > { > if (i % 17) > a++; > diff --git a/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c b/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c > index 3ad0cf019b3..3027e75a241 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/unroll-1.c > @@ -1,13 +1,17 @@ > /* { dg-options "-O3 -fdump-rtl-loop2_unroll-details -funroll-loops -fno-peel-loops" } */ > void abort (); > > -int a[1000]; > +#ifndef ITER > +#define ITER 1000 > +#endif > + > +int a[ITER]; > int > __attribute__ ((noinline)) > t() > { > int i; > - for (i=0;i<1000;i++) > + for (i=0;i if (!a[i]) > return 1; > abort (); > @@ -16,7 +20,7 @@ int > main() > { > int i; > - for (i=0;i<1000;i++) > + for (i=0;i t(); > return 0; > } > diff --git a/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c b/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c > index c286816cdf8..de2d03ebaee 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/update-cunroll-2.c > @@ -1,5 +1,9 @@ > - > /* { dg-options "-O2 -fdump-tree-optimized-blocks" } */ > + > +#ifndef ITER > +#define ITER 1000 > +#endif > + > int a[8]; > __attribute__ ((noinline)) > int t() > @@ -14,7 +18,7 @@ int > main () > { > int i; > - for (i = 0; i < 1000; i++) > + for (i = 0; i < ITER; i++) > t (); > return 0; > } > diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp > index 65494cfd4f6..13e7828bf32 100644 > --- a/gcc/testsuite/lib/profopt.exp > +++ b/gcc/testsuite/lib/profopt.exp > @@ -289,8 +289,8 @@ proc auto-profopt-execute { src } { > return > } > set profile_wrapper [profopt-perf-wrapper] > - set profile_option "-g" > - set feedback_option "-fauto-profile" > + set profile_option "-g -DITER=1000000" > + set feedback_option "-fauto-profile -DITER=1000000" > set run_autofdo 1 > profopt-execute $src > unset profile_wrapper