From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2154 invoked by alias); 21 Dec 2012 18:38:09 -0000 Received: (qmail 2143 invoked by uid 22791); 21 Dec 2012 18:38:07 -0000 X-SWARE-Spam-Status: No, hits=-5.0 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-qa0-f48.google.com (HELO mail-qa0-f48.google.com) (209.85.216.48) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Dec 2012 18:37:48 +0000 Received: by mail-qa0-f48.google.com with SMTP id l8so3716984qaq.14 for ; Fri, 21 Dec 2012 10:37:46 -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=Ny1cXSHWo8pSzCVxb15yKwr1dhvO84mlYqUTmzjeko4=; b=bPvl0oSAJGetBgvw2vtsCD2HjUNAi8bcRxMVQ+wA1rmgoNxKHNdjNxvWldjGzL2cC6 NLXDDzvN9Yv2Mr7cWjxbqMwfEfY+XNazBDpAcrsjV6TWFCOU05vLZjlZ8xPZz2CqqT22 wOZ9PK3b9sEP7jJfphk9a+npTwz28z5EksKonZD6dh0y91G5cQblrgKv0eVJ0/Ssw+VR dYXRhBoqaADK2i7lLrGLscZ8lJ3WHz+vxjKnTC9s21we8y3MR8OQ9dRub+RT6MNdpIDW 9YVMrVoX+UDvrGgl7HQwEUr0Sqa8S2U3uuAI8NOOLBXnsuQ3ye+sHPSOfaN5+qZdyL1R I7Ow== MIME-Version: 1.0 Received: by 10.224.31.196 with SMTP id z4mr7366758qac.20.1356115066354; Fri, 21 Dec 2012 10:37:46 -0800 (PST) Received: by 10.229.10.77 with HTTP; Fri, 21 Dec 2012 10:37:46 -0800 (PST) In-Reply-To: <20121221092532.GA7055@kam.mff.cuni.cz> References: <20121221064539.0E1A7100704@rong.mtv.corp.google.com> <20121221092532.GA7055@kam.mff.cuni.cz> Date: Fri, 21 Dec 2012 18:38:00 -0000 Message-ID: Subject: Re: atomic update of profile counters (issue7000044) From: Rong Xu To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org, davidxl@google.com, pinskia@gmail.com, reply@codereview.appspotmail.com Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQn136NjDMNbQteho9P1FZRXVTt2JTEvyK3hN7fxGqzRfArbgY2Co1LdUM0vRlqYy00gbCb0HsmiFrZweWThpciJ61PMoxrqZNb8iRg8BDx5YohvmwAkd39bKJNboasIiS1izkVTY7xoYgj6nZXP7Fz82gtMH3BXmknxpSgts2DpYmvctrEKtm5V1P9LBtWmqvx3akgm 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/msg01335.txt.bz2 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