From patchwork Tue May 26 14:13:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 476488 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 35C7C1402B5 for ; Wed, 27 May 2015 00:14:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ApInXeXL; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=xlxpAkkhrJt+UFHnwv6lFr6OS9pVqtKFh1r+sPbCJvxbza xJnL7hgbMh0iOrGQMvnarGJpkQ5ANt9EKzGWNrFcULzWKAjZaYWTulMIwY/iKlOt E8fO4oeVJB6JUIRPp84wPeDy2Jp+fw8Ks3Gkyma+jRIcvRfcLAvoUvX7m1vd8= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=JydvP880nTXHLVOWycJETd9W1Iw=; b=ApInXeXL6QpMm+mMxk3o ++wUYxtpepFprs7nxpBmCi/I84FrgUCTFrPSmf3QZCoGNmh8tA8BR/1WNYXGettt aowj3z4vnlhyqKU9ziKypsaaxAljdxy04UmsyQRlpoK2/PrbvmHlahkPUZkRkL3o JBkjjEpya2uI9c4rGQyWhSw= Received: (qmail 102931 invoked by alias); 26 May 2015 14:13:50 -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 102833 invoked by uid 89); 26 May 2015 14:13:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, KAM_STOCKGEN autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Tue, 26 May 2015 14:13:40 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C9C7CABB3 for ; Tue, 26 May 2015 14:13:36 +0000 (UTC) Message-ID: <55647F90.8060803@suse.cz> Date: Tue, 26 May 2015 16:13:36 +0200 From: =?UTF-8?B?TWFydGluIExpxaFrYQ==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: GCC Patches Subject: [PATCH] LTO balanced map: add stats about insns and symbols. X-IsSubscribed: yes Hello. Following patch enhanced dump output for LTO balanced map. Sample output: Partition sizes: partition 0 contains 2413 (13.33%) symbols and 56646 (3.62%) insns partition 1 contains 2006 (11.08%) symbols and 55901 (3.57%) insns partition 2 contains 1954 (10.79%) symbols and 61054 (3.90%) insns partition 3 contains 1234 (6.82%) symbols and 61331 (3.92%) insns partition 4 contains 2024 (11.18%) symbols and 60955 (3.89%) insns partition 5 contains 2332 (12.88%) symbols and 61030 (3.90%) insns partition 6 contains 2294 (12.67%) symbols and 60585 (3.87%) insns partition 7 contains 1044 (5.77%) symbols and 56854 (3.63%) insns partition 8 contains 1390 (7.68%) symbols and 60877 (3.89%) insns partition 9 contains 1891 (10.44%) symbols and 56356 (3.60%) insns partition 10 contains 1172 (6.47%) symbols and 56990 (3.64%) insns partition 11 contains 2099 (11.59%) symbols and 57168 (3.65%) insns partition 12 contains 2444 (13.50%) symbols and 60830 (3.88%) insns partition 13 contains 1610 (8.89%) symbols and 51294 (3.28%) insns partition 14 contains 1949 (10.76%) symbols and 61142 (3.90%) insns partition 15 contains 2256 (12.46%) symbols and 60634 (3.87%) insns partition 16 contains 2951 (16.30%) symbols and 61536 (3.93%) insns partition 17 contains 1968 (10.87%) symbols and 62862 (4.01%) insns partition 18 contains 2298 (12.69%) symbols and 62748 (4.01%) insns partition 19 contains 1679 (9.27%) symbols and 61772 (3.94%) insns partition 20 contains 2265 (12.51%) symbols and 61851 (3.95%) insns partition 21 contains 2234 (12.34%) symbols and 62310 (3.98%) insns partition 22 contains 2345 (12.95%) symbols and 62185 (3.97%) insns partition 23 contains 1816 (10.03%) symbols and 60530 (3.87%) insns partition 24 contains 2655 (14.66%) symbols and 63232 (4.04%) insns partition 25 contains 1782 (9.84%) symbols and 45523 (2.91%) insns partition 26 contains 2217 (12.25%) symbols and 67405 (4.30%) insns partition 27 contains 2642 (14.59%) symbols and 66556 (4.25%) insns partition 28 contains 2454 (13.55%) symbols and 66748 (4.26%) insns partition 29 contains 2637 (14.57%) symbols and 66711 (4.26%) insns partition 30 contains 2244 (12.39%) symbols and 51957 (3.32%) insns Patch can bootstrap on x86_64-linux-gnu and can build Firefox and Inkscape with LTO enabled. Ready for trunk? Thanks, Martin From 43570a062df7edd02a8936d99ca7790eb20fd84f Mon Sep 17 00:00:00 2001 From: mliska Date: Tue, 26 May 2015 15:04:20 +0200 Subject: [PATCH] LTO balanced map: add stats about insns and symbols. gcc/lto/ChangeLog: 2015-05-26 Martin Liska * lto-partition.c (new_partition): Reset number of symbols. (add_symbol_to_partition_1): Increment number of symbols. (undo_partition): Decrement number of symbols. (lto_balanced_map): Dump number of symbols and insns that belong to a partition. * lto-partition.h (struct ltrans_partition_def): Add symbol counter. --- gcc/lto/lto-partition.c | 25 ++++++++++++++++++++++++- gcc/lto/lto-partition.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 235b735..8c72d9e 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -73,6 +73,7 @@ new_partition (const char *name) part->encoder = lto_symtab_encoder_new (false); part->name = name; part->insns = 0; + part->symbols = 0; ltrans_partitions.safe_push (part); return part; } @@ -157,6 +158,8 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node) gcc_assert (c != SYMBOL_EXTERNAL && (c == SYMBOL_DUPLICATE || !symbol_partitioned_p (node))); + part->symbols++; + lto_set_symtab_encoder_in_partition (part->encoder, node); if (symbol_partitioned_p (node)) @@ -274,6 +277,7 @@ undo_partition (ltrans_partition partition, unsigned int n_nodes) { symtab_node *node = lto_symtab_encoder_deref (partition->encoder, n_nodes); + partition->symbols--; cgraph_node *cnode; /* After UNDO we no longer know what was visited. */ @@ -462,7 +466,7 @@ lto_balanced_map (int n_lto_partitions) auto_vec varpool_order; int i; struct cgraph_node *node; - int total_size = 0, best_total_size = 0; + int original_total_size, total_size = 0, best_total_size = 0; int partition_size; ltrans_partition partition; int last_visited_node = 0; @@ -488,6 +492,8 @@ lto_balanced_map (int n_lto_partitions) total_size += inline_summaries->get (node)->size; } + original_total_size = total_size; + /* Streaming works best when the source units do not cross partition boundaries much. This is because importing function from a source unit tends to import a lot of global trees defined there. We should @@ -782,6 +788,23 @@ lto_balanced_map (int n_lto_partitions) add_sorted_nodes (next_nodes, partition); free (order); + + if (symtab->dump_file) + { + fprintf (symtab->dump_file, "\nPartition sizes:\n"); + unsigned partitions = ltrans_partitions.length (); + + for (unsigned i = 0; i < partitions ; i++) + { + ltrans_partition p = ltrans_partitions[i]; + fprintf (symtab->dump_file, "partition %d contains %d (%2.2f%%)" + " symbols and %d (%2.2f%%) insns\n", i, p->symbols, + 100.0 * p->symbols / n_nodes, p->insns, + 100.0 * p->insns / original_total_size); + } + + fprintf (symtab->dump_file, "\n"); + } } /* Return true if we must not change the name of the NODE. The name as diff --git a/gcc/lto/lto-partition.h b/gcc/lto/lto-partition.h index 10065f9..a44e8e7 100644 --- a/gcc/lto/lto-partition.h +++ b/gcc/lto/lto-partition.h @@ -26,6 +26,7 @@ struct ltrans_partition_def lto_symtab_encoder_t encoder; const char * name; int insns; + int symbols; hash_set *initializers_visited; }; -- 2.1.4