From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29183 invoked by alias); 28 Dec 2012 19:35:20 -0000 Received: (qmail 29113 invoked by uid 22791); 28 Dec 2012 19:35:19 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-wg0-f50.google.com (HELO mail-wg0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Dec 2012 19:35:14 +0000 Received: by mail-wg0-f50.google.com with SMTP id es5so5030372wgb.5 for ; Fri, 28 Dec 2012 11:35:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=jZuFaPZdSfDHRVLBSixMc2rwmDB3LZxfNYYA6L3DOKQ=; b=VNFfoL1Xl1HuUGkOM0A7FHBuYC9BrnNqarIXUzApLQy09gHmoJXWBBhw/TYcZYBTIf 4Jg+HvbZnls6XnllYruXGkg0m8o32o51E/SY22+mhiFDgMupccHp/VeXdTa6PVoPpXuX kUrgOU2W9fc8vIwY5EyGMLbQT+3CP21lXd8eIivq69zLdxNw8Z4pDDUCo0VnvOqDlRLA KVKLKXWZ5+10Bg3uPoPrstJE15Sd2obMX73daqL4dH8Seylu4/+N0hqIrRGOlJqeLFDd W4/fOkULBhomFzSzqZreAa3PLpbFinewKvTF6jLahrDi73fz88eToQvL8XTVMjTm+Len nz6Q== MIME-Version: 1.0 Received: by 10.194.119.33 with SMTP id kr1mr55696856wjb.4.1356723313007; Fri, 28 Dec 2012 11:35:13 -0800 (PST) Received: by 10.216.31.67 with HTTP; Fri, 28 Dec 2012 11:35:12 -0800 (PST) In-Reply-To: References: <20121221064539.0E1A7100704@rong.mtv.corp.google.com> <20121221092532.GA7055@kam.mff.cuni.cz> Date: Fri, 28 Dec 2012 19:35:00 -0000 Message-ID: Subject: Re: atomic update of profile counters (issue7000044) From: Xinliang David Li To: Rong Xu Cc: Jan Hubicka , GCC Patches , Andrew Pinski , reply@codereview.appspotmail.com Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnvtW3stZWEUIGGfI3eZXCHMLeDcE0H6IFq1C9Io0+bdV9wkMQCj9sAELlrXZPnS69us2nEhtChvE9ZCW7ZP/tBmoi1yDX5eL9kOoVrzR8IqzSCOfPdydRLO2YaG5uPrRKGLG5y9Xpud5qa+1H0QGwsRMYtMBX66o9xA3nxQ2dvLu8S/M193mxrlsAuyeKGYKRQnLcQ X-IsSubscribed: yes 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/msg01457.txt.bz2 It would be great if this can make into gcc4.8. The patch has close to 0 impact on code stability. David On Fri, Dec 28, 2012 at 11:32 AM, Rong Xu wrote: > Hi Honza, > > In the other thread of discussion (similar patch in google-4_7 > branch), you said you were thinking if to let this patch into trunk in > stage 3. Can you give some update? > > Thanks, > > -Rong > > On Fri, Dec 21, 2012 at 10:37 AM, Rong Xu wrote: >> On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka wrote: >>>> 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? >> >> From http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins, >> it says: >> "If a particular operation cannot be implemented on the target >> processor, a warning is generated and a call an external function is >> generated. " >> >> So I think there will be a warning and eventually a link error of unsat. >> >> Thanks, >> >> -Rong >> >> >>> >>> Honza