public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH GCC]Refine comment and set type for partition merged from SCC
@ 2017-10-11 16:21 Bin Cheng
  2017-10-12 14:00 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Bin Cheng @ 2017-10-11 16:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

Hi,
When reading the code I found it's could be confusing without comment.
This patch adds comment explaining why we want merge PARALLEL type
partitions in a SCC, even though the result partition can no longer
be executed in parallel.  It also sets type of the result partition
to sequential.
Bootstrap and test on x86_64 and AArch64.  Is it OK?

Thanks,
bin
2017-10-10  Bin Cheng  <bin.cheng@arm.com>

	* tree-loop-distribution.c (break_alias_scc_partitions): Add comment
	and set PTYPE_SEQUENTIAL for merged partition.

[-- Attachment #2: merge-parallel-scc.txt --]
[-- Type: text/plain, Size: 2017 bytes --]

diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 9ffac53..dc429cf 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -2062,7 +2062,7 @@ break_alias_scc_partitions (struct graph *rdg,
       auto_vec<enum partition_type> scc_types;
       struct partition *partition, *first;
 
-      /* If all paritions in a SCC has the same type, we can simply merge the
+      /* If all partitions in a SCC have the same type, we can simply merge the
 	 SCC.  This loop finds out such SCCS and record them in bitmap.  */
       bitmap_set_range (sccs_to_merge, 0, (unsigned) num_sccs);
       for (i = 0; i < num_sccs; ++i)
@@ -2075,6 +2075,10 @@ break_alias_scc_partitions (struct graph *rdg,
 	      if (pg->vertices[j].component != i)
 		continue;
 
+	      /* Note we Merge partitions of parallel type on purpose, though
+		 the result partition is sequential.  The reason is vectorizer
+		 can do more accurate runtime alias check in this case.  Also
+		 it results in more conservative distribution.  */
 	      if (first->type != partition->type)
 		{
 		  bitmap_clear_bit (sccs_to_merge, i);
@@ -2096,7 +2100,7 @@ break_alias_scc_partitions (struct graph *rdg,
       if (bitmap_count_bits (sccs_to_merge) != (unsigned) num_sccs)
 	{
 	  /* Run SCC finding algorithm again, with alias dependence edges
-	     skipped.  This is to topologically sort paritions according to
+	     skipped.  This is to topologically sort partitions according to
 	     compilation time known dependence.  Note the topological order
 	     is stored in the form of pg's post order number.  */
 	  num_sccs_no_alias = graphds_scc (pg, NULL, pg_skip_alias_edge);
@@ -2139,6 +2143,8 @@ break_alias_scc_partitions (struct graph *rdg,
 	      data = (struct pg_vdata *)pg->vertices[k].data;
 	      gcc_assert (data->id == k);
 	      data->partition = NULL;
+	      /* The result partition of merged SCC must be sequential.  */
+	      first->type = PTYPE_SEQUENTIAL;
 	    }
 	}
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH GCC]Refine comment and set type for partition merged from SCC
  2017-10-11 16:21 [PATCH GCC]Refine comment and set type for partition merged from SCC Bin Cheng
@ 2017-10-12 14:00 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-10-12 14:00 UTC (permalink / raw)
  To: Bin Cheng; +Cc: gcc-patches, nd

On Wed, Oct 11, 2017 at 6:10 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> When reading the code I found it's could be confusing without comment.
> This patch adds comment explaining why we want merge PARALLEL type
> partitions in a SCC, even though the result partition can no longer
> be executed in parallel.  It also sets type of the result partition
> to sequential.
> Bootstrap and test on x86_64 and AArch64.  Is it OK?

Ok.

Richard.

> Thanks,
> bin
> 2017-10-10  Bin Cheng  <bin.cheng@arm.com>
>
>         * tree-loop-distribution.c (break_alias_scc_partitions): Add comment
>         and set PTYPE_SEQUENTIAL for merged partition.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-12 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 16:21 [PATCH GCC]Refine comment and set type for partition merged from SCC Bin Cheng
2017-10-12 14:00 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).