From patchwork Fri Aug 2 07:50:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1141015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-506060-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EhIy3PRl"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 460K8k5zjVz9s3Z for ; Fri, 2 Aug 2019 17:50:45 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=mBzXU9nz3/X0TWKo VBEh2Fpdc8F8dI9WVEZLXUPMl06tPVYhBHzU3327BzR4WNI0rMpZE1qX+LI/XXkK QQKEzAy4jz2abbvpph4ug/+4ZObwnjtPnQRS6ewmsY2u7B2i1MJ3zpVlhR7gVkAl FJuja6S9UtlVcg6pE4nT8dHQfYA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=jCsqlSQ/MMh8qT3p9VlyVx EihbU=; b=EhIy3PRl214Fdny60Ng0GOXLDkTabx1ZxWae1Cp3pZ3OcTD5LkVm3r eurd9Rf37cNsR2l2zRU98BuKm0H0KNAIUWQk6SZYzA6UM7hCB7eRseb6G+2r8ADV 3SWCbDX8QG/9vN6O4l3fn0F270BvJpfVjCLafhqvgDDYY7OFbOKy0= Received: (qmail 8428 invoked by alias); 2 Aug 2019 07:50:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 8414 invoked by uid 89); 2 Aug 2019 07:50:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Aug 2019 07:50:37 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B61BB81388 for ; Fri, 2 Aug 2019 09:50:34 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EJ3_MrrJSk5X for ; Fri, 2 Aug 2019 09:50:34 +0200 (CEST) Received: from arcturus.home (adijon-653-1-80-34.w90-33.abo.wanadoo.fr [90.33.75.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 772CC81385 for ; Fri, 2 Aug 2019 09:50:34 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Small tweaks to profile parameters Date: Fri, 02 Aug 2019 09:50:41 +0200 Message-ID: <3730821.cy1dvssRTS@arcturus.home> MIME-Version: 1.0 Hi, some users tried to tweak the profile parameters in order to get more inlining and did the tweaking backwards, i.e. they actually got less inlining without realizing it. So the attached patch reworks the description of the 4 profile parameters as well as changes a couple of things: 1. it gracefully handles a hot-bb-count-fraction of 0, 2. it sets the range of unlikely-bb-count-fraction to (0, 0) like the others. Tested on x86_64-suse-linux, OK for the mainline? 2019-08-02 Eric Botcazou * doc/invoke.texi (hot-bb-count-fraction): Rework description. (hot-bb-count-ws-permille): Likewise. (hot-bb-frequency-fraction): Likewise. (unlikely-bb-count-fraction): Likewise. * params.def (hot-bb-count-fraction): Rework description. (hot-bb-count-ws-permille): Likewise. (hot-bb-frequency-fraction): Likewise. (unlikely-bb-count-fraction): Likewise. Remove min and max values. * predict.c (get_hot_bb_threshold): Deal with zero HOT_BB_COUNT_FRACTION. Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 273907) +++ doc/invoke.texi (working copy) @@ -11442,14 +11442,39 @@ for vectorizer. Value -1 means no limit. The maximum number of iterations of a loop the brute-force algorithm for analysis of the number of iterations of the loop tries to evaluate. +@item hot-bb-count-fraction +The denominator n of fraction 1/n of the maximal execution count of a +basic block in the entire program that a basic block needs to at least +have in order to be considered hot. The default is 10000, which means +that a basic block is considered hot if its execution count is greater +than 1/10000 of the maximal execution count. 0 means that it is never +considered hot. Used in non-LTO mode. + @item hot-bb-count-ws-permille -A basic block profile count is considered hot if it contributes to -the given permillage (i.e.@: 0...1000) of the entire profiled execution. +The number of most executed permilles, ranging from 0 to 1000, of the +profiled execution of the entire program to which the execution count +of a basic block must be part of in order to be considered hot. The +default is 990, which means that a basic block is considered hot if +its execution count contributes to the upper 990 permilles, or 99.0%, +of the profiled execution of the entire program. 0 means that it is +never considered hot. Used in LTO mode. @item hot-bb-frequency-fraction -Select fraction of the entry block frequency of executions of basic block in -function given basic block needs to have to be considered hot. +The denominator n of fraction 1/n of the execution frequency of the +entry block of a function that a basic block of this function needs +to at least have in order to be considered hot. The default is 1000, +which means that a basic block is considered hot in a function if it +is executed more frequently than 1/1000 of the frequency of the entry +block of the function. 0 means that it is never considered hot. +@item unlikely-bb-count-fraction +The denominator n of fraction 1/n of the number of profiled runs of +the entire program below which the execution count of a basic block +must be in order for the basic block to be considered unlikely executed. +The default is 20, which means that a basic block is considered unlikely +executed if it is executed in fewer than 1/20, or 5%, of the runs of +the program. 0 means that it is always considered unlikely executed. + @item max-predicted-iterations The maximum number of loop iterations we predict statically. This is useful in cases where a function contains a single loop with known bound and @@ -12129,11 +12154,6 @@ A threshold on the average loop count considered b The number of cycles the swing modulo scheduler considers when checking conflicts using DFA. -@item hot-bb-count-fraction -Select fraction of the maximal count of repetitions of basic block -in program given basic block needs -to have to be considered hot (used in non-LTO mode) - @item max-inline-insns-recursive-auto The maximum number of instructions non-inline function can grow to via recursive inlining. @@ -12171,10 +12191,6 @@ Maximum number of arrays per scop. @item max-vartrack-reverse-op-size Max. size of loc list for which reverse ops should be added. -@item unlikely-bb-count-fraction -The minimum fraction of profile runs a given basic block execution count -must be not to be considered unlikely. - @item tracer-dynamic-coverage-feedback The percentage of function, weighted by execution frequency, that must be covered by trace formation. Index: params.def =================================================================== --- params.def (revision 273907) +++ params.def (working copy) @@ -427,23 +427,31 @@ DEFPARAM(PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD, DEFPARAM(HOT_BB_COUNT_FRACTION, "hot-bb-count-fraction", - "Select fraction of the maximal count of repetitions of basic block in program given basic " - "block needs to have to be considered hot (used in non-LTO mode).", + "The denominator n of fraction 1/n of the maximal execution count of " + "a basic block in the entire program that a basic block needs to at " + "least have in order to be considered hot (used in non-LTO mode).", 10000, 0, 0) + DEFPARAM(HOT_BB_COUNT_WS_PERMILLE, "hot-bb-count-ws-permille", - "A basic block profile count is considered hot if it contributes to " - "the given permillage of the entire profiled execution (used in LTO mode).", + "The number of most executed permilles of the profiled execution of " + "the entire program to which the execution count of a basic block " + "must be part of in order to be considered hot (used in LTO mode).", 990, 0, 1000) + DEFPARAM(HOT_BB_FREQUENCY_FRACTION, "hot-bb-frequency-fraction", - "Select fraction of the maximal frequency of executions of basic block in function given basic block needs to have to be considered hot.", + "The denominator n of fraction 1/n of the execution frequency of the " + "entry block of a function that a basic block of this function needs " + "to at least have in order to be considered hot.", 1000, 0, 0) DEFPARAM(UNLIKELY_BB_COUNT_FRACTION, "unlikely-bb-count-fraction", - "The minimum fraction of profile runs a given basic block execution count must be not to be considered unlikely.", - 20, 1, 10000) + "The denominator n of fraction 1/n of the number of profiled runs of " + "the entire program below which the execution count of a basic block " + "must be in order for the basic block to be considered unlikely.", + 20, 0, 0) DEFPARAM (PARAM_ALIGN_THRESHOLD, "align-threshold", Index: predict.c =================================================================== --- predict.c (revision 273983) +++ predict.c (working copy) @@ -132,8 +132,12 @@ get_hot_bb_threshold () { if (min_count == -1) { - gcov_type t = profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION); - set_hot_bb_threshold (t); + const int hot_frac = PARAM_VALUE (HOT_BB_COUNT_FRACTION); + const gcov_type min_hot_count + = hot_frac + ? profile_info->sum_max / hot_frac + : (gcov_type)profile_count::max_count; + set_hot_bb_threshold (min_hot_count); if (dump_file) fprintf (dump_file, "Setting hotness threshold to %" PRId64 ".\n", min_count);