From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31003 invoked by alias); 21 Dec 2012 09:25:40 -0000 Received: (qmail 30988 invoked by uid 22791); 21 Dec 2012 09:25:39 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Dec 2012 09:25:34 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 83ED05419A6; Fri, 21 Dec 2012 10:25:32 +0100 (CET) Date: Fri, 21 Dec 2012 09:25:00 -0000 From: Jan Hubicka To: Rong Xu Cc: gcc-patches@gcc.gnu.org, davidxl@google.com, hubicka@ucw.cz, pinskia@gmail.com, reply@codereview.appspotmail.com Subject: Re: atomic update of profile counters (issue7000044) Message-ID: <20121221092532.GA7055@kam.mff.cuni.cz> References: <20121221064539.0E1A7100704@rong.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121221064539.0E1A7100704@rong.mtv.corp.google.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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 X-SW-Source: 2012-12/txt/msg01288.txt.bz2 > Hi, > > This patch adds support of atomic update of profiles counters. The goal is to improve > the poor counter values for highly thread programs. > > The atomic update is under a new option -fprofile-gen-atomic= > N=0: default, no atomic update > N=1: atomic update edge counters. > N=2: atomic update some of value profile counters (currently indirect-call and one value profile). > N=3: both edge counter and the above value profile counters. > Other value: fall back to the default. > > This patch is a simple porting of the version in google-4_7 branch. It uses __atomic_fetch_add > based on Andrew Pinski's suggestion. Note I did not apply to all the value profiles as > the indirect-call profile is the most relevant one here. > > Test with bootstrap. > > Comments and suggestions are welcomed. > > Thanks, > > -Rong > > > 2012-12-20 Rong Xu > > * libgcc/libgcov.c (__gcov_one_value_profiler_body_atomic): New > function. Atomic update profile counters. > (__gcov_one_value_profiler_atomic): Ditto. > (__gcov_indirect_call_profiler_atomic): Ditto. > * gcc/gcov-io.h: Macros for atomic update. > * gcc/common.opt: New option. > * gcc/tree-profile.c (gimple_init_edge_profiler): Atomic > update profile counters. > (gimple_gen_edge_profiler): Ditto. The patch looks resonable. Eventually we probably should provide rest of the value counters in thread safe manner. What happens on targets not having atomic operations? Honza