Re: [PATCH] profiling: fix streaming of TOPN counters

2021-03-04 Thread Martin Liška
On 3/4/21 1:50 PM, Jan Hubicka wrote: .../gcc.dg/tree-prof/indir-call-prof-malloc.c | 2 +- gcc/testsuite/gcc.dg/tree-prof/pr97461.c | 2 +- libgcc/libgcov-driver.c | 56 --- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/gcc/tes

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-03-04 Thread Jan Hubicka
> .../gcc.dg/tree-prof/indir-call-prof-malloc.c | 2 +- > gcc/testsuite/gcc.dg/tree-prof/pr97461.c | 2 +- > libgcc/libgcov-driver.c | 56 --- > 3 files changed, 50 insertions(+), 10 deletions(-) > > diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-ca

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-03-03 Thread Martin Liška
t; 0; gcov_type *total = &counters[GCOV_TOPN_MEM_COUNTERS * i]; -- 2.30.0 >From de61040043c30400a2b8662d81a24387f1a13b3f Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 16 Feb 2021 16:28:06 +0100 Subject: [PATCH] profiling: fix streaming of TOPN counters libgcc/ChangeLog: PR gcov-pr

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-03-03 Thread Jan Hubicka
> > libgcc/ChangeLog: > > PR gcov-profile/99105 > * libgcov-driver.c (write_top_counters): Rename to ... > (write_topn_counters): ... this. > (write_one_data): Pre-allocate buffer for number of items > in the corresponding linked lists. > * libgcov-merge.c (__g

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-18 Thread Richard Biener via Gcc-patches
On Thu, Feb 18, 2021 at 12:35 PM Martin Liška wrote: > > On 2/18/21 11:02 AM, Richard Biener wrote: > > On Thu, Feb 18, 2021 at 10:46 AM Martin Liška wrote: > >> > >> On 2/18/21 10:31 AM, Richard Biener wrote: > >>> On Wed, Feb 17, 2021 at 2:16 PM Martin Liška wrote: > > On 2/17/21 9:3

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-18 Thread Martin Liška
On 2/18/21 11:02 AM, Richard Biener wrote: On Thu, Feb 18, 2021 at 10:46 AM Martin Liška wrote: On 2/18/21 10:31 AM, Richard Biener wrote: On Wed, Feb 17, 2021 at 2:16 PM Martin Liška wrote: On 2/17/21 9:36 AM, Martin Liška wrote: I'll write it even more robust... This is more elegant a

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-18 Thread Richard Biener via Gcc-patches
On Thu, Feb 18, 2021 at 10:46 AM Martin Liška wrote: > > On 2/18/21 10:31 AM, Richard Biener wrote: > > On Wed, Feb 17, 2021 at 2:16 PM Martin Liška wrote: > >> > >> On 2/17/21 9:36 AM, Martin Liška wrote: > >>> I'll write it even more robust... > >> > >> This is more elegant approach I've just t

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-18 Thread Martin Liška
On 2/18/21 10:31 AM, Richard Biener wrote: On Wed, Feb 17, 2021 at 2:16 PM Martin Liška wrote: On 2/17/21 9:36 AM, Martin Liška wrote: I'll write it even more robust... This is more elegant approach I've just tested on the instrumented clang. Patch can bootstrap on x86_64-linux-gnu and sur

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-18 Thread Richard Biener via Gcc-patches
On Wed, Feb 17, 2021 at 2:16 PM Martin Liška wrote: > > On 2/17/21 9:36 AM, Martin Liška wrote: > > I'll write it even more robust... > > This is more elegant approach I've just tested on the instrumented clang. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready t

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-17 Thread Martin Liška
rtin >From a8a879ba8a8ce3e90a712ff4c436b5d993faad7d Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 16 Feb 2021 16:28:06 +0100 Subject: [PATCH] profiling: fix streaming of TOPN counters libgcc/ChangeLog: PR gcov-profile/99105 * libgcov-driver.c (write_top_counters): Rename to ... (write_topn_counte

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-17 Thread Martin Liška
On 2/16/21 9:46 PM, Richard Biener wrote: Looks like this can only shrink the race window. Yes, kind of. Don't you need atomic accesses or locking here? Can the number of counters change? So what we do: we want to stream out N TOPN counters where each looks like this: {total_count, number

Re: [PATCH] profiling: fix streaming of TOPN counters

2021-02-16 Thread Richard Biener via Gcc-patches
On February 16, 2021 7:32:16 PM GMT+01:00, "Martin Liška" wrote: >Hello. > >As Honza noticed, when using GCC 11 during train run of Clang leads to >very slow training run. Apparently, it's caused by a corrupted TOP N >profile. >The patch fixed that by preallocating a buffer that is latter stream

[PATCH] profiling: fix streaming of TOPN counters

2021-02-16 Thread Martin Liška
Hello. As Honza noticed, when using GCC 11 during train run of Clang leads to very slow training run. Apparently, it's caused by a corrupted TOP N profile. The patch fixed that by preallocating a buffer that is latter stream out. With the patch, I can profiledbootstrap GCC and the instrumented c