public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH GCC][07/13]Preserve data references for whole distribution life time
@ 2017-06-12 17:03 Bin Cheng
  2017-06-13 11:14 ` Richard Biener
  0 siblings, 1 reply; 6+ messages in thread
From: Bin Cheng @ 2017-06-12 17:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

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

Hi,
This patch collects and preserves all data references in loop for whole
distribution life time.  It will be used afterwards.

Bootstrap and test on x86_64 and AArch64.  Is it OK?

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

	* tree-loop-distribution.c (datarefs_vec, datarefs_map): New
	global var.
	(create_rdg_vertices): Use datarefs_vec directly.
	(free_rdg): Don't free data references.
	(build_rdg): Update use.  Don't free data references.
	(distribute_loop): Compute global variable for data references.
	Bail out if there are too many data references.

[-- Attachment #2: 0007-preserve-datarefs-20170607.txt --]
[-- Type: text/plain, Size: 4832 bytes --]

From 78dd9322e9c3e5af2c736997fdbd2f71285eb5c0 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Fri, 9 Jun 2017 12:09:03 +0100
Subject: [PATCH 07/14] preserve-datarefs-20170607.txt

---
 gcc/tree-loop-distribution.c | 58 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 44 insertions(+), 14 deletions(-)

diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index e1f5bce..0b16024 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -69,6 +69,12 @@ along with GCC; see the file COPYING3.  If not see
 /* The loop (nest) to be distributed.  */
 static vec<loop_p> *loop_nest;
 
+/* Vector of data references in the loop to be distributed.  */
+static vec<data_reference_p> *datarefs_vec;
+
+/* Map of data reference in the loop to a unique id.  */
+static hash_map<data_reference_p, int> *datarefs_map;
+
 /* A Reduced Dependence Graph (RDG) vertex representing a statement.  */
 struct rdg_vertex
 {
@@ -339,8 +345,7 @@ create_rdg_cd_edges (struct graph *rdg, control_dependences *cd, loop_p loop)
    if that failed.  */
 
 static bool
-create_rdg_vertices (struct graph *rdg, vec<gimple *> stmts, loop_p loop,
-		     vec<data_reference_p> *datarefs)
+create_rdg_vertices (struct graph *rdg, vec<gimple *> stmts, loop_p loop)
 {
   int i;
   gimple *stmt;
@@ -360,12 +365,12 @@ create_rdg_vertices (struct graph *rdg, vec<gimple *> stmts, loop_p loop,
       if (gimple_code (stmt) == GIMPLE_PHI)
 	continue;
 
-      unsigned drp = datarefs->length ();
-      if (!find_data_references_in_stmt (loop, stmt, datarefs))
+      unsigned drp = datarefs_vec->length ();
+      if (!find_data_references_in_stmt (loop, stmt, datarefs_vec))
 	return false;
-      for (unsigned j = drp; j < datarefs->length (); ++j)
+      for (unsigned j = drp; j < datarefs_vec->length (); ++j)
 	{
-	  data_reference_p dr = (*datarefs)[j];
+	  data_reference_p dr = (*datarefs_vec)[j];
 	  if (DR_IS_READ (dr))
 	    RDGV_HAS_MEM_READS (v) = true;
 	  else
@@ -449,7 +454,7 @@ free_rdg (struct graph *rdg)
       if (v->data)
 	{
 	  gimple_set_uid (RDGV_STMT (v), -1);
-	  free_data_refs (RDGV_DATAREFS (v));
+	  (RDGV_DATAREFS (v)).release ();
 	  free (v->data);
 	}
     }
@@ -459,22 +464,20 @@ free_rdg (struct graph *rdg)
 
 /* Build the Reduced Dependence Graph (RDG) with one vertex per statement of
    LOOP, and one edge per flow dependence or control dependence from control
-   dependence CD.  */
+   dependence CD.  During visiting each statement, data references are also
+   collected and recorded in global data DATAREFS_VEC.  */
 
 static struct graph *
 build_rdg (struct loop *loop, control_dependences *cd)
 {
   struct graph *rdg;
-  vec<data_reference_p> datarefs;
 
   /* Create the RDG vertices from the stmts of the loop nest.  */
   auto_vec<gimple *, 10> stmts;
   stmts_from_loop (loop, &stmts);
   rdg = new_graph (stmts.length ());
-  datarefs.create (10);
-  if (!create_rdg_vertices (rdg, stmts, loop, &datarefs))
+  if (!create_rdg_vertices (rdg, stmts, loop))
     {
-      datarefs.release ();
       free_rdg (rdg);
       return NULL;
     }
@@ -484,8 +487,6 @@ build_rdg (struct loop *loop, control_dependences *cd)
   if (cd)
     create_rdg_cd_edges (rdg, cd, loop);
 
-  datarefs.release ();
-
   return rdg;
 }
 
@@ -1522,6 +1523,7 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
       return 0;
     }
 
+  datarefs_vec = new vec<data_reference_p> ();
   rdg = build_rdg (loop, cd);
   if (!rdg)
     {
@@ -1532,8 +1534,33 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
 
       loop_nest->release ();
       delete loop_nest;
+      free_data_refs (*datarefs_vec);
+      delete datarefs_vec;
       return 0;
     }
+  if (datarefs_vec->length () > 64)
+    {
+      if (dump_file && (dump_flags & TDF_DETAILS))
+	fprintf (dump_file,
+		 "Loop %d not distributed: more than 64 memory references.\n",
+		 loop->num);
+
+      free_rdg (rdg);
+      loop_nest->release ();
+      delete loop_nest;
+      free_data_refs (*datarefs_vec);
+      delete datarefs_vec;
+      return 0;
+    }
+
+  data_reference_p dref;
+  datarefs_map = new hash_map<data_reference_p, int>;
+  for (i = 0; datarefs_vec->iterate (i, &dref); ++i)
+    {
+      int *slot = datarefs_map->get ((*datarefs_vec)[i]);
+      gcc_assert (slot == NULL);
+      datarefs_map->put ((*datarefs_vec)[i], i);
+    }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     dump_rdg (dump_file, rdg);
@@ -1741,6 +1768,9 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
  ldist_done:
   loop_nest->release ();
   delete loop_nest;
+  free_data_refs (*datarefs_vec);
+  delete datarefs_vec;
+  delete datarefs_map;
 
   FOR_EACH_VEC_ELT (partitions, i, partition)
     partition_free (partition);
-- 
1.9.1


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

* Re: [PATCH GCC][07/13]Preserve data references for whole distribution life time
  2017-06-12 17:03 [PATCH GCC][07/13]Preserve data references for whole distribution life time Bin Cheng
@ 2017-06-13 11:14 ` Richard Biener
  2017-06-19 13:34   ` Bin.Cheng
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2017-06-13 11:14 UTC (permalink / raw)
  To: Bin Cheng; +Cc: gcc-patches, nd

On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> This patch collects and preserves all data references in loop for whole
> distribution life time.  It will be used afterwards.
>
> Bootstrap and test on x86_64 and AArch64.  Is it OK?

+/* Vector of data references in the loop to be distributed.  */
+static vec<data_reference_p> *datarefs_vec;
+
+/* Map of data reference in the loop to a unique id.  */
+static hash_map<data_reference_p, int> *datarefs_map;
+

no need to make those pointers.  It's not a unique id but
the index into the datarefs_vec vector, right?

loop distribution doesn't yet use dr->aux so it would be nice
to avoid the hash_map in favor of using that field.

#define DR_INDEX (dr) ((uintptr_t)(dr)->aux)

+  if (datarefs_vec->length () > 64)

There is PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS)
with a default value of 1000.  Please use that instead of magic numbers.

+    {
+      if (dump_file && (dump_flags & TDF_DETAILS))
+       fprintf (dump_file,
+                "Loop %d not distributed: more than 64 memory references.\n",
+                loop->num);
+
+      free_rdg (rdg);
+      loop_nest->release ();
+      delete loop_nest;
+      free_data_refs (*datarefs_vec);
+      delete datarefs_vec;
+      return 0;
+    }

auto_* were so nice ...

> Thanks,
> bin
> 2017-06-07  Bin Cheng  <bin.cheng@arm.com>
>
>         * tree-loop-distribution.c (datarefs_vec, datarefs_map): New
>         global var.
>         (create_rdg_vertices): Use datarefs_vec directly.
>         (free_rdg): Don't free data references.
>         (build_rdg): Update use.  Don't free data references.
>         (distribute_loop): Compute global variable for data references.
>         Bail out if there are too many data references.

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

* Re: [PATCH GCC][07/13]Preserve data references for whole distribution life time
  2017-06-13 11:14 ` Richard Biener
@ 2017-06-19 13:34   ` Bin.Cheng
  2017-06-19 15:16     ` Richard Biener
  0 siblings, 1 reply; 6+ messages in thread
From: Bin.Cheng @ 2017-06-19 13:34 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On Tue, Jun 13, 2017 at 12:14 PM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>> Hi,
>> This patch collects and preserves all data references in loop for whole
>> distribution life time.  It will be used afterwards.
>>
>> Bootstrap and test on x86_64 and AArch64.  Is it OK?
>
> +/* Vector of data references in the loop to be distributed.  */
> +static vec<data_reference_p> *datarefs_vec;
> +
> +/* Map of data reference in the loop to a unique id.  */
> +static hash_map<data_reference_p, int> *datarefs_map;
> +
>
> no need to make those pointers.  It's not a unique id but
> the index into the datarefs_vec vector, right?
>
> loop distribution doesn't yet use dr->aux so it would be nice
> to avoid the hash_map in favor of using that field.
>
> #define DR_INDEX (dr) ((uintptr_t)(dr)->aux)
>
> +  if (datarefs_vec->length () > 64)
>
> There is PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS)
> with a default value of 1000.  Please use that instead of magic numbers.
>
> +    {
> +      if (dump_file && (dump_flags & TDF_DETAILS))
> +       fprintf (dump_file,
> +                "Loop %d not distributed: more than 64 memory references.\n",
> +                loop->num);
> +
> +      free_rdg (rdg);
> +      loop_nest->release ();
> +      delete loop_nest;
> +      free_data_refs (*datarefs_vec);
> +      delete datarefs_vec;
> +      return 0;
> +    }
>
> auto_* were so nice ...
Hi Richard,
This is the updated patch.  It removes datarefs_map as well as checks
number of data references against the parameter.  Is it OK?

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

    * tree-loop-distribution.c (params.h): Include header file.
    (MAX_DATAREFS_NUM, DR_INDEX): New macro.
    (datarefs_vec): New global var.
    (create_rdg_vertices): Use datarefs_vec directly.
    (free_rdg): Don't free data references.
    (build_rdg): Update use.  Don't free data references.
    (distribute_loop): Compute global variable for data references.
    Bail out if there are too many data references.

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

* Re: [PATCH GCC][07/13]Preserve data references for whole distribution life time
  2017-06-19 13:34   ` Bin.Cheng
@ 2017-06-19 15:16     ` Richard Biener
  2017-06-19 15:59       ` Bin.Cheng
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2017-06-19 15:16 UTC (permalink / raw)
  To: Bin.Cheng; +Cc: gcc-patches

On Mon, Jun 19, 2017 at 3:34 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> On Tue, Jun 13, 2017 at 12:14 PM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>>> Hi,
>>> This patch collects and preserves all data references in loop for whole
>>> distribution life time.  It will be used afterwards.
>>>
>>> Bootstrap and test on x86_64 and AArch64.  Is it OK?
>>
>> +/* Vector of data references in the loop to be distributed.  */
>> +static vec<data_reference_p> *datarefs_vec;
>> +
>> +/* Map of data reference in the loop to a unique id.  */
>> +static hash_map<data_reference_p, int> *datarefs_map;
>> +
>>
>> no need to make those pointers.  It's not a unique id but
>> the index into the datarefs_vec vector, right?
>>
>> loop distribution doesn't yet use dr->aux so it would be nice
>> to avoid the hash_map in favor of using that field.
>>
>> #define DR_INDEX (dr) ((uintptr_t)(dr)->aux)
>>
>> +  if (datarefs_vec->length () > 64)
>>
>> There is PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS)
>> with a default value of 1000.  Please use that instead of magic numbers.
>>
>> +    {
>> +      if (dump_file && (dump_flags & TDF_DETAILS))
>> +       fprintf (dump_file,
>> +                "Loop %d not distributed: more than 64 memory references.\n",
>> +                loop->num);
>> +
>> +      free_rdg (rdg);
>> +      loop_nest->release ();
>> +      delete loop_nest;
>> +      free_data_refs (*datarefs_vec);
>> +      delete datarefs_vec;
>> +      return 0;
>> +    }
>>
>> auto_* were so nice ...
> Hi Richard,
> This is the updated patch.  It removes datarefs_map as well as checks
> number of data references against the parameter.  Is it OK?

ENOPATCH

> Thanks,
> bin
> 2017-06-07  Bin Cheng  <bin.cheng@arm.com>
>
>     * tree-loop-distribution.c (params.h): Include header file.
>     (MAX_DATAREFS_NUM, DR_INDEX): New macro.
>     (datarefs_vec): New global var.
>     (create_rdg_vertices): Use datarefs_vec directly.
>     (free_rdg): Don't free data references.
>     (build_rdg): Update use.  Don't free data references.
>     (distribute_loop): Compute global variable for data references.
>     Bail out if there are too many data references.

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

* Re: [PATCH GCC][07/13]Preserve data references for whole distribution life time
  2017-06-19 15:16     ` Richard Biener
@ 2017-06-19 15:59       ` Bin.Cheng
  2017-06-20 11:25         ` Richard Biener
  0 siblings, 1 reply; 6+ messages in thread
From: Bin.Cheng @ 2017-06-19 15:59 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

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

On Mon, Jun 19, 2017 at 4:16 PM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Mon, Jun 19, 2017 at 3:34 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
>> On Tue, Jun 13, 2017 at 12:14 PM, Richard Biener
>> <richard.guenther@gmail.com> wrote:
>>> On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>>>> Hi,
>>>> This patch collects and preserves all data references in loop for whole
>>>> distribution life time.  It will be used afterwards.
>>>>
>>>> Bootstrap and test on x86_64 and AArch64.  Is it OK?
>>>
>>> +/* Vector of data references in the loop to be distributed.  */
>>> +static vec<data_reference_p> *datarefs_vec;
>>> +
>>> +/* Map of data reference in the loop to a unique id.  */
>>> +static hash_map<data_reference_p, int> *datarefs_map;
>>> +
>>>
>>> no need to make those pointers.  It's not a unique id but
>>> the index into the datarefs_vec vector, right?
>>>
>>> loop distribution doesn't yet use dr->aux so it would be nice
>>> to avoid the hash_map in favor of using that field.
>>>
>>> #define DR_INDEX (dr) ((uintptr_t)(dr)->aux)
>>>
>>> +  if (datarefs_vec->length () > 64)
>>>
>>> There is PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS)
>>> with a default value of 1000.  Please use that instead of magic numbers.
>>>
>>> +    {
>>> +      if (dump_file && (dump_flags & TDF_DETAILS))
>>> +       fprintf (dump_file,
>>> +                "Loop %d not distributed: more than 64 memory references.\n",
>>> +                loop->num);
>>> +
>>> +      free_rdg (rdg);
>>> +      loop_nest->release ();
>>> +      delete loop_nest;
>>> +      free_data_refs (*datarefs_vec);
>>> +      delete datarefs_vec;
>>> +      return 0;
>>> +    }
>>>
>>> auto_* were so nice ...
>> Hi Richard,
>> This is the updated patch.  It removes datarefs_map as well as checks
>> number of data references against the parameter.  Is it OK?
>
> ENOPATCH
Ah Sorry for that.

Thanks,
bin
>
>> Thanks,
>> bin
>> 2017-06-07  Bin Cheng  <bin.cheng@arm.com>
>>
>>     * tree-loop-distribution.c (params.h): Include header file.
>>     (MAX_DATAREFS_NUM, DR_INDEX): New macro.
>>     (datarefs_vec): New global var.
>>     (create_rdg_vertices): Use datarefs_vec directly.
>>     (free_rdg): Don't free data references.
>>     (build_rdg): Update use.  Don't free data references.
>>     (distribute_loop): Compute global variable for data references.
>>     Bail out if there are too many data references.

[-- Attachment #2: 0006-preserve-datarefs-20170609.txt.patch --]
[-- Type: text/x-patch, Size: 4708 bytes --]

From 4e0c23380e82465e6865dac017b13ac5791cba5d Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Fri, 9 Jun 2017 12:09:03 +0100
Subject: [PATCH 06/13] preserve-datarefs-20170609.txt

---
 gcc/tree-loop-distribution.c | 53 ++++++++++++++++++++++++++++++++------------
 1 file changed, 39 insertions(+), 14 deletions(-)

diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 8183090..a013556 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -63,12 +63,22 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa.h"
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
+#include "params.h"
 #include "tree-vectorizer.h"
 
 
+#define MAX_DATAREFS_NUM \
+	((unsigned) PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS))
+
 /* The loop (nest) to be distributed.  */
 static vec<loop_p> loop_nest;
 
+/* Vector of data references in the loop to be distributed.  */
+static vec<data_reference_p> datarefs_vec;
+
+/* Store index of data reference in aux field.  */
+#define DR_INDEX(dr)      ((uintptr_t) (dr)->aux)
+
 /* A Reduced Dependence Graph (RDG) vertex representing a statement.  */
 struct rdg_vertex
 {
@@ -339,8 +349,7 @@ create_rdg_cd_edges (struct graph *rdg, control_dependences *cd, loop_p loop)
    if that failed.  */
 
 static bool
-create_rdg_vertices (struct graph *rdg, vec<gimple *> stmts, loop_p loop,
-		     vec<data_reference_p> *datarefs)
+create_rdg_vertices (struct graph *rdg, vec<gimple *> stmts, loop_p loop)
 {
   int i;
   gimple *stmt;
@@ -360,12 +369,12 @@ create_rdg_vertices (struct graph *rdg, vec<gimple *> stmts, loop_p loop,
       if (gimple_code (stmt) == GIMPLE_PHI)
 	continue;
 
-      unsigned drp = datarefs->length ();
-      if (!find_data_references_in_stmt (loop, stmt, datarefs))
+      unsigned drp = datarefs_vec.length ();
+      if (!find_data_references_in_stmt (loop, stmt, &datarefs_vec))
 	return false;
-      for (unsigned j = drp; j < datarefs->length (); ++j)
+      for (unsigned j = drp; j < datarefs_vec.length (); ++j)
 	{
-	  data_reference_p dr = (*datarefs)[j];
+	  data_reference_p dr = datarefs_vec[j];
 	  if (DR_IS_READ (dr))
 	    RDGV_HAS_MEM_READS (v) = true;
 	  else
@@ -449,7 +458,7 @@ free_rdg (struct graph *rdg)
       if (v->data)
 	{
 	  gimple_set_uid (RDGV_STMT (v), -1);
-	  free_data_refs (RDGV_DATAREFS (v));
+	  (RDGV_DATAREFS (v)).release ();
 	  free (v->data);
 	}
     }
@@ -459,22 +468,20 @@ free_rdg (struct graph *rdg)
 
 /* Build the Reduced Dependence Graph (RDG) with one vertex per statement of
    LOOP, and one edge per flow dependence or control dependence from control
-   dependence CD.  */
+   dependence CD.  During visiting each statement, data references are also
+   collected and recorded in global data DATAREFS_VEC.  */
 
 static struct graph *
 build_rdg (struct loop *loop, control_dependences *cd)
 {
   struct graph *rdg;
-  vec<data_reference_p> datarefs;
 
   /* Create the RDG vertices from the stmts of the loop nest.  */
   auto_vec<gimple *, 10> stmts;
   stmts_from_loop (loop, &stmts);
   rdg = new_graph (stmts.length ());
-  datarefs.create (10);
-  if (!create_rdg_vertices (rdg, stmts, loop, &datarefs))
+  if (!create_rdg_vertices (rdg, stmts, loop))
     {
-      datarefs.release ();
       free_rdg (rdg);
       return NULL;
     }
@@ -484,8 +491,6 @@ build_rdg (struct loop *loop, control_dependences *cd)
   if (cd)
     create_rdg_cd_edges (rdg, cd, loop);
 
-  datarefs.release ();
-
   return rdg;
 }
 
@@ -1518,6 +1523,7 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
       return 0;
     }
 
+  datarefs_vec.create (20);
   rdg = build_rdg (loop, cd);
   if (!rdg)
     {
@@ -1527,9 +1533,27 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
 		 loop->num);
 
       loop_nest.release ();
+      free_data_refs (datarefs_vec);
+      return 0;
+    }
+
+  if (datarefs_vec.length () > MAX_DATAREFS_NUM)
+    {
+      if (dump_file && (dump_flags & TDF_DETAILS))
+	fprintf (dump_file,
+		 "Loop %d not distributed: too many memory references.\n",
+		 loop->num);
+
+      free_rdg (rdg);
+      loop_nest.release ();
+      free_data_refs (datarefs_vec);
       return 0;
     }
 
+  data_reference_p dref;
+  for (i = 0; datarefs_vec.iterate (i, &dref); ++i)
+    dref->aux = (void *) (uintptr_t) i;
+
   if (dump_file && (dump_flags & TDF_DETAILS))
     dump_rdg (dump_file, rdg);
 
@@ -1735,6 +1759,7 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
 
  ldist_done:
   loop_nest.release ();
+  free_data_refs (datarefs_vec);
 
   FOR_EACH_VEC_ELT (partitions, i, partition)
     partition_free (partition);
-- 
1.9.1


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

* Re: [PATCH GCC][07/13]Preserve data references for whole distribution life time
  2017-06-19 15:59       ` Bin.Cheng
@ 2017-06-20 11:25         ` Richard Biener
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Biener @ 2017-06-20 11:25 UTC (permalink / raw)
  To: Bin.Cheng; +Cc: gcc-patches

On Mon, Jun 19, 2017 at 5:59 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> On Mon, Jun 19, 2017 at 4:16 PM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Mon, Jun 19, 2017 at 3:34 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
>>> On Tue, Jun 13, 2017 at 12:14 PM, Richard Biener
>>> <richard.guenther@gmail.com> wrote:
>>>> On Mon, Jun 12, 2017 at 7:02 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>>>>> Hi,
>>>>> This patch collects and preserves all data references in loop for whole
>>>>> distribution life time.  It will be used afterwards.
>>>>>
>>>>> Bootstrap and test on x86_64 and AArch64.  Is it OK?
>>>>
>>>> +/* Vector of data references in the loop to be distributed.  */
>>>> +static vec<data_reference_p> *datarefs_vec;
>>>> +
>>>> +/* Map of data reference in the loop to a unique id.  */
>>>> +static hash_map<data_reference_p, int> *datarefs_map;
>>>> +
>>>>
>>>> no need to make those pointers.  It's not a unique id but
>>>> the index into the datarefs_vec vector, right?
>>>>
>>>> loop distribution doesn't yet use dr->aux so it would be nice
>>>> to avoid the hash_map in favor of using that field.
>>>>
>>>> #define DR_INDEX (dr) ((uintptr_t)(dr)->aux)
>>>>
>>>> +  if (datarefs_vec->length () > 64)
>>>>
>>>> There is PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS)
>>>> with a default value of 1000.  Please use that instead of magic numbers.
>>>>
>>>> +    {
>>>> +      if (dump_file && (dump_flags & TDF_DETAILS))
>>>> +       fprintf (dump_file,
>>>> +                "Loop %d not distributed: more than 64 memory references.\n",
>>>> +                loop->num);
>>>> +
>>>> +      free_rdg (rdg);
>>>> +      loop_nest->release ();
>>>> +      delete loop_nest;
>>>> +      free_data_refs (*datarefs_vec);
>>>> +      delete datarefs_vec;
>>>> +      return 0;
>>>> +    }
>>>>
>>>> auto_* were so nice ...
>>> Hi Richard,
>>> This is the updated patch.  It removes datarefs_map as well as checks
>>> number of data references against the parameter.  Is it OK?
>>
>> ENOPATCH
> Ah Sorry for that.

Ok.

Richard.

> Thanks,
> bin
>>
>>> Thanks,
>>> bin
>>> 2017-06-07  Bin Cheng  <bin.cheng@arm.com>
>>>
>>>     * tree-loop-distribution.c (params.h): Include header file.
>>>     (MAX_DATAREFS_NUM, DR_INDEX): New macro.
>>>     (datarefs_vec): New global var.
>>>     (create_rdg_vertices): Use datarefs_vec directly.
>>>     (free_rdg): Don't free data references.
>>>     (build_rdg): Update use.  Don't free data references.
>>>     (distribute_loop): Compute global variable for data references.
>>>     Bail out if there are too many data references.

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

end of thread, other threads:[~2017-06-20 11:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-12 17:03 [PATCH GCC][07/13]Preserve data references for whole distribution life time Bin Cheng
2017-06-13 11:14 ` Richard Biener
2017-06-19 13:34   ` Bin.Cheng
2017-06-19 15:16     ` Richard Biener
2017-06-19 15:59       ` Bin.Cheng
2017-06-20 11:25         ` 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).