From patchwork Mon Apr 4 13:27:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 64994 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1187712lbc; Mon, 4 Apr 2016 06:28:15 -0700 (PDT) X-Received: by 10.98.65.14 with SMTP id o14mr20528854pfa.151.1459776495464; Mon, 04 Apr 2016 06:28:15 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id rl12si510300pab.36.2016.04.04.06.28.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Apr 2016 06:28:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-424331-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-424331-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-424331-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=A5igG0RhsZnZ4cAivc DCSKbCO/H3b9G1or1uXPpV72mN3heUiDWedQ/J4fj3qnoD7QDgi/dfpXCzjk4qL3 cjaO7eZJO0GtBr8q96JEeRgZvWG0j7Zbl1gBY7iFdSE0WEUVeY5xkpe4W2jv5wmN 1QZoBVLv4aPkWWFFxeCvOlIwE= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=oYTnzSHafAjkL6NCH6rbEOtU YhI=; b=L7qAREzLJX1BbRUM+Ni01xO55MNn+h6kZ77HGXXryohekip3M7RSCaLz HGCSJjUCmcP+S5I+QNW5swfGgAC+ANZhCY7A1kY1GyJJ8ZWPp35BvC2ErmtSQ5LQ a9JeM5oeYGRXBGQ5ra85PSARK40kfRRlZr/uMX5aTEX/8uz76pQ= Received: (qmail 8874 invoked by alias); 4 Apr 2016 13:28:00 -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 8854 invoked by uid 89); 4 Apr 2016 13:27:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=estimated, hubicka@ucw.cz, D*ucw.cz, hubickaucwcz X-HELO: mail-ig0-f182.google.com Received: from mail-ig0-f182.google.com (HELO mail-ig0-f182.google.com) (209.85.213.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 04 Apr 2016 13:27:49 +0000 Received: by mail-ig0-f182.google.com with SMTP id gy3so18064783igb.0 for ; Mon, 04 Apr 2016 06:27:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=ho04onxe+Cq74A1pob1dhB1QyGvfBhajKafTnSc4hX4=; b=CEwIKvmd9OqXGfZeSb9ONqP63cYAGXVpjEjTHpOOgU2Nxz+dTH0Cm0k5itPesp/CcA WboyPaQPVSbb29ApFPVKaHYpIupSKIZGiwrKqEV+1ioV/qOfJLH4pjvdtDHb8JGQ+eYg kNFOKvQlRgkK67Jwq4aFimJXuLQ/PsTTQeKVJAlDFP1trImgOm76ZFzUGupZUDmPRFM1 J1VbUfTCs50nXuNuZeOKJabsiBH/ozfacHAPcr8flvVBe26LOSUYtA0aPvKKVeCYxwUo ZVaRVqprQ6kcjC9KMWlp4976yJ04m1PUqX/Ppu53w/cYfIUDAHdE5njBI2NM7Y+tiTgR tNOg== X-Gm-Message-State: AD7BkJI4543WF85lrrBjYNiQnVTWoqZvNwq08UqkWOmpSkxR1YkOIzKlVhEG2nQ8idLrOHJBycwBtYD7fKwIBwyH MIME-Version: 1.0 X-Received: by 10.50.111.72 with SMTP id ig8mr2164543igb.46.1459776467667; Mon, 04 Apr 2016 06:27:47 -0700 (PDT) Received: by 10.36.196.5 with HTTP; Mon, 4 Apr 2016 06:27:47 -0700 (PDT) In-Reply-To: <20160404120030.GD14122@kam.mff.cuni.cz> References: <20160404120030.GD14122@kam.mff.cuni.cz> Date: Mon, 4 Apr 2016 18:57:47 +0530 Message-ID: Subject: Re: [RFC] introduce --param max-lto-partition for having an upper bound on partition size From: Prathamesh Kulkarni To: Jan Hubicka Cc: Richard Biener , gcc Patches , Ramana Radhakrishnan X-IsSubscribed: yes On 4 April 2016 at 17:30, Jan Hubicka wrote: >> > Um not sure if I understood correctly. >> > Do we want to constrain individual partition size by adding parameter >> > lto-max-partition >> > for balanced partitioning but not for -flto-partition=one >> > case (since latter would also change semantics of =one) ? >> >> Yes, I think so. > > Yep, I agree. Having partition one that produces multiple partitions doesn't seem to make much sense. > Given that we have such not so predictable target specific limits on size of single translation unit > we can handle, I suppose adding a resonable limit to the default balanced partitioning makes more sense. > One can always push the behaviour you intend by setting max partitions to 1 (I suppose max size should > have precedence over max partitions) Thanks for the suggestions, I have updated the patch. Is it OK if it passes bootstrap+test ? Thanks, Prathamesh > > Honza >> >> Richard. >> >> > Thanks, >> > Prathamesh >> > > >> > > Richard. >> > > >> > > -- >> > > Richard Biener >> > > SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg) >> > >> > >> >> -- >> Richard Biener >> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg) diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 9eb63c2..bc0c612 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -511,9 +511,20 @@ lto_balanced_map (int n_lto_partitions) varpool_order.qsort (varpool_node_cmp); /* Compute partition size and create the first partition. */ + if (PARAM_VALUE (MIN_PARTITION_SIZE) > PARAM_VALUE (MAX_PARTITION_SIZE)) + fatal_error (input_location, "min partition size cannot be greater than max partition size"); + partition_size = total_size / n_lto_partitions; if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE)) partition_size = PARAM_VALUE (MIN_PARTITION_SIZE); + else if (partition_size > PARAM_VALUE (MAX_PARTITION_SIZE)) + { + n_lto_partitions = total_size / PARAM_VALUE (MAX_PARTITION_SIZE); + if (total_size % PARAM_VALUE (MAX_PARTITION_SIZE)) + n_lto_partitions++; + partition_size = total_size / n_lto_partitions; + } + npartitions = 1; partition = new_partition (""); if (symtab->dump_file) diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 9dd513f..294b8a4 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -3112,6 +3112,12 @@ do_whole_program_analysis (void) timevar_pop (TV_WHOPR_WPA); timevar_push (TV_WHOPR_PARTITIONING); + + if (flag_lto_partition != LTO_PARTITION_BALANCED + && PARAM_VALUE (MAX_PARTITION_SIZE) != INT_MAX) + fatal_error (input_location, "--param max-lto-partition should only" + " be used with balanced partitioning\n"); + if (flag_lto_partition == LTO_PARTITION_1TO1) lto_1_to_1_map (); else if (flag_lto_partition == LTO_PARTITION_MAX) diff --git a/gcc/params.def b/gcc/params.def index 9362c15..b6055ff 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -1029,6 +1029,11 @@ DEFPARAM (MIN_PARTITION_SIZE, "Minimal size of a partition for LTO (in estimated instructions).", 1000, 0, 0) +DEFPARAM (MAX_PARTITION_SIZE, + "lto-max-partition", + "Maximal size of a partition for LTO (in estimated instructions).", + INT_MAX, 0, INT_MAX) + /* Diagnostic parameters. */ DEFPARAM (CXX_MAX_NAMESPACES_FOR_DIAGNOSTIC_HELP,