aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2020-07-29 15:01:04 -0300
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-07-29 15:01:04 -0300
commitcbc80292ec99d1b6f10f2ce7e2c60603a6b98260 (patch)
tree8f5a82f1b7fdf4070ed100285968e6709145e159 /gcc
parent503e39b8fbe7ea13d5d65cb3a6f32ea308b09d65 (diff)
downloadgcc-cbc80292ec99d1b6f10f2ce7e2c60603a6b98260.zip
gcc-cbc80292ec99d1b6f10f2ce7e2c60603a6b98260.tar.gz
gcc-cbc80292ec99d1b6f10f2ce7e2c60603a6b98260.tar.bz2
Use number of jobs as parameter for balancing
Previously, we targeted each partition size to be equal half of total size. This commit adds a new parameter to the balancer to also consider the number of jobs provided as input. gcc/ChangeLog 2020-07-29 Giuliano Belinassi <giuliano.belinassi@usp.br> * lto-partition.c (balance_partitions): Accept number of jobs as argument.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cgraphunit.c2
-rw-r--r--gcc/jobserver.cc2
-rw-r--r--gcc/lto-partition.c8
-rw-r--r--gcc/lto-partition.h2
5 files changed, 12 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 79e5c1c..82462f2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2020-07-29 Giuliano Belinassi <giuliano.belinassi@usp.br>
+ * lto-partition.c (balance_partitions): Accept number of jobs as
+ argument.
+
+2020-07-29 Giuliano Belinassi <giuliano.belinassi@usp.br>
+
* cgraphunit.c (maybe_compile_in_parallel): Implement automatic
jobserver detection flag.
* jobserver.cc (jobserver_initialize): Check if Make fds are FIFOs.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index c9f413c..58ec25c 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2820,7 +2820,7 @@ static bool maybe_compile_in_parallel (void)
partition. If promote_statics is true, it also maps statics
to the same partition. If balance is true, try to balance the
partitions for compilation performance. */
- lto_merge_comdat_map (balance, promote_statics);
+ lto_merge_comdat_map (balance, promote_statics, num_jobs);
/* AUX pointers are used by partitioning code to bookkeep number of
partitions symbol is in. This is no longer needed. */
diff --git a/gcc/jobserver.cc b/gcc/jobserver.cc
index 9c6bcb6..1a266c9 100644
--- a/gcc/jobserver.cc
+++ b/gcc/jobserver.cc
@@ -100,7 +100,7 @@ bool jobserver_finalize ()
close (wfd);
rfd = wfd = -1;
- nonblock_node = false;
+ nonblock_mode = false;
jobserver_initialized = false;
return true;
diff --git a/gcc/lto-partition.c b/gcc/lto-partition.c
index a52fe8d..0dcd484 100644
--- a/gcc/lto-partition.c
+++ b/gcc/lto-partition.c
@@ -620,7 +620,7 @@ static void analyse_symbol (symtab_node *node, int set)
that it is not worth. */
static bool
-balance_partitions (union_find *ds, int n)
+balance_partitions (union_find *ds, int n, int jobs)
{
int *sizes, i, j;
int total_size = 0, max_size = -1;
@@ -664,7 +664,7 @@ balance_partitions (union_find *ds, int n)
if (total_size < param_min_partition_size)
return false;
- target_size = total_size / 3;
+ target_size = total_size / (jobs + 1);
/* Unite small partitions. */
for (i = 0, j = 0; j < n; ++j)
@@ -1039,7 +1039,7 @@ merge_contained_symbols (symtab_node *node, int set)
to globals. */
void
-lto_merge_comdat_map (bool balance, bool promote_statics)
+lto_merge_comdat_map (bool balance, bool promote_statics, int jobs)
{
symtab_node *node;
int n = 0;
@@ -1071,7 +1071,7 @@ lto_merge_comdat_map (bool balance, bool promote_statics)
FOR_EACH_SYMBOL (node)
node->aux = NULL;
- if (balance && !balance_partitions (&disjoint_sets, n))
+ if (balance && !balance_partitions (&disjoint_sets, n, jobs))
return;
build_ltrans_partitions (&disjoint_sets, n);
diff --git a/gcc/lto-partition.h b/gcc/lto-partition.h
index 0732103..5c1f966 100644
--- a/gcc/lto-partition.h
+++ b/gcc/lto-partition.h
@@ -41,4 +41,4 @@ void free_ltrans_partitions (void);
void lto_promote_statics_nonwpa (void);
void lto_check_usage_from_other_partitions (void);
void lto_max_no_alonevap_map (void);
-void lto_merge_comdat_map (bool, bool);
+void lto_merge_comdat_map (bool, bool, int);