From patchwork Wed May 2 18:45:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 156534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1D842B6FAF for ; Thu, 3 May 2012 04:45:36 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1336589137; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Mail-Followup-To:Cc:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=K56P6gJk2xFM4jW/qqfU hUMH8Jk=; b=E+vh27CXP7WsT4Dl/DG6JK+yrt3zRzWty+1LKnj2fA6Ig8ZogcbD ANQBw+t9bTaJMDQdbr6GK25yXqRNdBp8Wf8nHiEG+MHEe9gKJAMejBw6o12QTtT8 LLRGx4ezgPUSVkXg9Hd9Ass+E2vi3Hat35l+ysbDrdYOZmy/UHVsodY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Mail-Followup-To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=iyBqt2Cqnp5KcMkLudDyWv0oqczZqSCIb5EBr0vStzb9Zej6Gkx/h6m6XbGsxZ FAtp/BZTbWEFd4DSq+lyYf/GtT5z6565M4XUpzkx88CBLKXDc05aerDeLaUCcLOw y67eWtlmj/5cV3tNMkZPxS0lhSe15QDy823iQdiy04RUw=; Received: (qmail 18281 invoked by alias); 2 May 2012 18:45:33 -0000 Received: (qmail 18271 invoked by uid 22791); 2 May 2012 18:45:32 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wg0-f51.google.com (HELO mail-wg0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 May 2012 18:45:17 +0000 Received: by wgbed3 with SMTP id ed3so822604wgb.8 for ; Wed, 02 May 2012 11:45:16 -0700 (PDT) Received: by 10.180.89.9 with SMTP id bk9mr16630465wib.11.1335984316270; Wed, 02 May 2012 11:45:16 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk. [82.133.89.107]) by mx.google.com with ESMTPS id ea6sm45822699wib.5.2012.05.02.11.45.14 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 May 2012 11:45:15 -0700 (PDT) From: Richard Sandiford To: Ian Lance Taylor Mail-Followup-To: Ian Lance Taylor , nick clifton , gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Cc: nick clifton , gcc-patches@gcc.gnu.org Subject: Re: No documentation of -fsched-pressure-algorithm References: <87sjfl5gc6.fsf@Gift.fritz.box> <878vhdxgnm.fsf@talisman.home> <4F9FA0B1.4090004@redhat.com> <4FA00548.3020504@redhat.com> <87pqanssrk.fsf@talisman.home> Date: Wed, 02 May 2012 19:45:10 +0100 In-Reply-To: (Ian Lance Taylor's message of "Tue, 01 May 2012 11:19:50 -0700") Message-ID: <87zk9qpgll.fsf@talisman.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 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 Ian Lance Taylor writes: > Richard Sandiford writes: >> Well, given the replies from you, Ian and Vlad (when reviewing the patch), >> I feel once again in a minority of one here :-) but... I just don't >> think we should be advertising this sort of stuff to users. Not because >> I'm trying to be cliquey, but because any time the user ends up having >> to use stuff like this represents a failure on the part of the compiler. > > I think it's perfectly reasonable to have tuning knobs that are reserved > for experts or people with too much time on their hands. I just think > that we already have a mechanism for that via --param. For --param the > docs say > > The names of specific parameters, and the meaning of the values, are > tied to the internals of the compiler, and are subject to change > without notice in future releases. > > I think that is the kind of thing you are talking about. I think that > for compiler tuning knobs we should use the mechanism that already > exists, rather than introducing a new mechanism of undocumented -f > options. OK, fair enough. How does this patch look? I tested it before I got Richard E's message, but it still seems the weight of opinion is behind --param. Bootstrapped & regression-tested on x86_64-linux-gnu. Which I know is meaningful because I forgot the PARAM_VALUE in the first cut and got a bunch of extra ICEs. I also tried the --param values out to make sure that the right algorithm was being chosen, and that the default was unchanged. OK to install? Richard gcc/ * doc/invoke.texi (sched-pressure-algorithm): Document new --param. * common.opt (fsched-pressure-algorithm=): Remove. * flag-types.h (sched_pressure_algorithm): Move to... * sched-int.h (sched_pressure_algorithm): ...here. * params.def (sched-pressure-algorithm): New param. * haifa-sched.c (sched_init): Use it to initialize sched_pressure. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi 2012-05-01 21:36:18.091969459 +0100 +++ gcc/doc/invoke.texi 2012-05-02 19:38:02.725960400 +0100 @@ -9329,6 +9329,17 @@ Set the maximum number of instructions e reassociated tree. This parameter overrides target dependent heuristics used by default if has non zero value. +@item sched-pressure-algorithm +Choose between the two available implementations of +@option{-fsched-pressure}. Algorithm 1 is the original implementation +and is the more likely to prevent instructions from being reordered. +Algorithm 2 was designed to be a compromise between the relatively +conservative approach taken by algorithm 1 and the rather aggressive +approach taken by the default scheduler. It relies more heavily on +having a regular register file and accurate register pressure classes. +See @file{haifa-sched.c} in the GCC sources for more details. + +The default choice depends on the target. @end table @end table Index: gcc/common.opt =================================================================== --- gcc/common.opt 2012-05-01 21:36:18.092969459 +0100 +++ gcc/common.opt 2012-05-02 19:21:36.166989085 +0100 @@ -1665,19 +1665,6 @@ fsched-pressure Common Report Var(flag_sched_pressure) Init(0) Optimization Enable register pressure sensitive insn scheduling -fsched-pressure-algorithm= -Common Joined RejectNegative Enum(sched_pressure_algorithm) Var(flag_sched_pressure_algorithm) Init(SCHED_PRESSURE_WEIGHTED) --fsched-pressure-algorithm=[weighted|model] Set the pressure-scheduling algorithm - -Enum -Name(sched_pressure_algorithm) Type(enum sched_pressure_algorithm) UnknownError(unknown % algorithm %qs) - -EnumValue -Enum(sched_pressure_algorithm) String(weighted) Value(SCHED_PRESSURE_WEIGHTED) - -EnumValue -Enum(sched_pressure_algorithm) String(model) Value(SCHED_PRESSURE_MODEL) - fsched-spec Common Report Var(flag_schedule_speculative) Init(1) Optimization Allow speculative motion of non-loads Index: gcc/flag-types.h =================================================================== --- gcc/flag-types.h 2012-05-01 21:36:18.093969459 +0100 +++ gcc/flag-types.h 2012-05-02 19:21:36.150989087 +0100 @@ -106,14 +106,6 @@ enum symbol_visibility }; #endif -/* The algorithm used to implement -fsched-pressure. */ -enum sched_pressure_algorithm -{ - SCHED_PRESSURE_NONE, - SCHED_PRESSURE_WEIGHTED, - SCHED_PRESSURE_MODEL -}; - /* The algorithm used for the integrated register allocator (IRA). */ enum ira_algorithm { Index: gcc/sched-int.h =================================================================== --- gcc/sched-int.h 2012-05-01 21:36:18.092969459 +0100 +++ gcc/sched-int.h 2012-05-02 19:21:36.166989085 +0100 @@ -37,6 +37,14 @@ #define GCC_SCHED_INT_H enum sched_pass_id_t { SCHED_PASS_UNKNOWN, SCHED_RGN_PASS, SCHED_EBB_PASS, SCHED_SMS_PASS, SCHED_SEL_PASS }; +/* The algorithm used to implement -fsched-pressure. */ +enum sched_pressure_algorithm +{ + SCHED_PRESSURE_NONE, + SCHED_PRESSURE_WEIGHTED, + SCHED_PRESSURE_MODEL +}; + typedef VEC (basic_block, heap) *bb_vec_t; typedef VEC (rtx, heap) *insn_vec_t; typedef VEC (rtx, heap) *rtx_vec_t; Index: gcc/params.def =================================================================== --- gcc/params.def 2012-05-01 21:36:18.092969459 +0100 +++ gcc/params.def 2012-05-02 19:21:36.175989085 +0100 @@ -979,6 +979,12 @@ DEFPARAM (PARAM_MAX_TRACKED_STRLENS, "track string lengths", 1000, 0, 0) +/* Keep this in sync with the sched_pressure_algorithm enum. */ +DEFPARAM (PARAM_SCHED_PRESSURE_ALGORITHM, + "sched-pressure-algorithm", + "Which -fsched-pressure algorithm to apply", + 1, 1, 2) + /* Local variables: mode:c Index: gcc/haifa-sched.c =================================================================== --- gcc/haifa-sched.c 2012-05-01 21:36:18.092969459 +0100 +++ gcc/haifa-sched.c 2012-05-02 19:21:36.148989087 +0100 @@ -6230,7 +6230,8 @@ sched_init (void) if (flag_sched_pressure && !reload_completed && common_sched_info->sched_pass_id == SCHED_RGN_PASS) - sched_pressure = flag_sched_pressure_algorithm; + sched_pressure = ((enum sched_pressure_algorithm) + PARAM_VALUE (PARAM_SCHED_PRESSURE_ALGORITHM)); else sched_pressure = SCHED_PRESSURE_NONE;