public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][3/3][PR65460] Mark offloaded functions as parallelized
@ 2015-03-18 17:22 Tom de Vries
  2015-03-19 11:05 ` Tom de Vries
  0 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2015-03-18 17:22 UTC (permalink / raw)
  To: GCC Patches, Richard Biener

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

Hi,

this patch fixes PR65460.

The patch marks offloaded functions as parallelized, which means the parloops 
pass no longer attempts to modify that function.

Bootstrapped and reg-tested on x86_64.

OK for stage4 trunk?

Thanks,
- Tom

[-- Attachment #2: 0003-Mark-offloaded-functions-as-parallelized.patch --]
[-- Type: text/x-patch, Size: 682 bytes --]

Mark offloaded functions as parallelized

2015-03-18  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65460
	* omp-low.c (expand_omp_target): Call mark_parallelized_function for
	child_fn.
---
 gcc/omp-low.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index c5c0ccf..e7ceee2 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8801,6 +8801,7 @@ expand_omp_target (struct omp_region *region)
     {
       child_fn = gimple_omp_target_child_fn (entry_stmt);
       child_cfun = DECL_STRUCT_FUNCTION (child_fn);
+      mark_parallelized_function (child_fn);
     }
 
   /* Supported by expand_omp_taskreg, but not here.  */
-- 
1.9.1


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

* Re: [PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-03-18 17:22 [PATCH][3/3][PR65460] Mark offloaded functions as parallelized Tom de Vries
@ 2015-03-19 11:05 ` Tom de Vries
  2015-03-20 11:38   ` Tom de Vries
  0 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2015-03-19 11:05 UTC (permalink / raw)
  To: GCC Patches, Richard Biener

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

On 18-03-15 18:22, Tom de Vries wrote:
> Hi,
>
> this patch fixes PR65460.
>
> The patch marks offloaded functions as parallelized, which means the parloops
> pass no longer attempts to modify that function.

Updated patch to postpone mark_parallelized_function until the corresponding 
cgraph_node is available, to ensure it works with the updated 
mark_parallelized_function from patch 2/3.

Bootstrapped and reg-tested on x86_64.

OK for stage4 trunk?

Thanks,
- Tom


[-- Attachment #2: 0003-Mark-offloaded-functions-as-parallelized.patch --]
[-- Type: text/x-patch, Size: 777 bytes --]

Mark offloaded functions as parallelized

2015-03-18  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65460
	* omp-low.c (expand_omp_target): Call mark_parallelized_function for
	child_fn.
---
 gcc/omp-low.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index a49a6eb..7195aa3 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8938,6 +8938,7 @@ expand_omp_target (struct omp_region *region)
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
       cgraph_node::add_new_function (child_fn, true);
+      mark_parallelized_function (child_fn);
 
 #ifdef ENABLE_OFFLOADING
       /* Add the new function to the offload table.  */
-- 
1.9.1


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

* Re: [PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-03-19 11:05 ` Tom de Vries
@ 2015-03-20 11:38   ` Tom de Vries
  2015-03-21 22:31     ` Tom de Vries
  2015-04-17 10:08     ` [PING][PATCH][3/3][PR65460] " Tom de Vries
  0 siblings, 2 replies; 11+ messages in thread
From: Tom de Vries @ 2015-03-20 11:38 UTC (permalink / raw)
  To: GCC Patches, Richard Biener

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

On 19-03-15 12:05, Tom de Vries wrote:
> On 18-03-15 18:22, Tom de Vries wrote:
>> Hi,
>>
>> this patch fixes PR65460.
>>
>> The patch marks offloaded functions as parallelized, which means the parloops
>> pass no longer attempts to modify that function.
>
> Updated patch to postpone mark_parallelized_function until the corresponding
> cgraph_node is available, to ensure it works with the updated
> mark_parallelized_function from patch 2/3.
>

Updated to eliminate mark_parallelized_function.

Bootstrapped and reg-tested on x86_64.

OK for stage4?

Thanks,
- Tom

[-- Attachment #2: 0003-Mark-offloaded-functions-as-parallelized.patch --]
[-- Type: text/x-patch, Size: 803 bytes --]

Mark offloaded functions as parallelized

2015-03-20  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65460
	* omp-low.c (expand_omp_target): Set parallelized_function on
	cgraph_node for child_fn.
---
 gcc/omp-low.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 5ca9e84..9be39b7 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8937,6 +8937,7 @@ expand_omp_target (struct omp_region *region)
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
       cgraph_node::add_new_function (child_fn, true);
+      cgraph_node::get (child_fn)->parallelized_function = 1;
 
 #ifdef ENABLE_OFFLOADING
       /* Add the new function to the offload table.  */
-- 
1.9.1


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

* Re: [PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-03-20 11:38   ` Tom de Vries
@ 2015-03-21 22:31     ` Tom de Vries
  2015-03-25  8:30       ` Thomas Schwinge
  2015-04-17 10:08     ` [PING][PATCH][3/3][PR65460] " Tom de Vries
  1 sibling, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2015-03-21 22:31 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: GCC Patches, Richard Biener, Jakub Jelinek

On 20-03-15 12:38, Tom de Vries wrote:
> On 19-03-15 12:05, Tom de Vries wrote:
>> On 18-03-15 18:22, Tom de Vries wrote:
>>> Hi,
>>>
>>> this patch fixes PR65460.
>>>
>>> The patch marks offloaded functions as parallelized, which means the parloops
>>> pass no longer attempts to modify that function.
>>
>> Updated patch to postpone mark_parallelized_function until the corresponding
>> cgraph_node is available, to ensure it works with the updated
>> mark_parallelized_function from patch 2/3.
>>
>
> Updated to eliminate mark_parallelized_function.
>
> Bootstrapped and reg-tested on x86_64.
>
> OK for stage4?
>

Thomas,

as requested, applied to gomp-4_0-branch.

Thanks,
- Tom

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

* Re: [PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-03-21 22:31     ` Tom de Vries
@ 2015-03-25  8:30       ` Thomas Schwinge
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Schwinge @ 2015-03-25  8:30 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches, Richard Biener, Jakub Jelinek

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

Hi Tom!

On Sat, 21 Mar 2015 23:30:51 +0100, Tom de Vries <Tom_deVries@mentor.com> wrote:
> On 20-03-15 12:38, Tom de Vries wrote:
> > On 19-03-15 12:05, Tom de Vries wrote:
> >> On 18-03-15 18:22, Tom de Vries wrote:
> >>> this patch fixes PR65460.
> >>>
> >>> The patch marks offloaded functions as parallelized, which means the parloops
> >>> pass no longer attempts to modify that function.
> >>
> >> Updated patch to postpone mark_parallelized_function until the corresponding
> >> cgraph_node is available, to ensure it works with the updated
> >> mark_parallelized_function from patch 2/3.
> >
> > Updated to eliminate mark_parallelized_function.
> >
> > Bootstrapped and reg-tested on x86_64.
> >
> > OK for stage4?
> 
> as requested, applied to gomp-4_0-branch.

Thanks!


Committed to gomp-4_0-branch in r221652:

commit 68c0851cb7ce420d5d938d7f0d9247adf79190a5
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Mar 25 08:28:09 2015 +0000

    Use ChangeLog.gomp on gomp-4_0-branch.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@221652 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog      |   34 ----------------------------------
 gcc/ChangeLog.gomp |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index 48dca87..e474fc8 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,37 +1,3 @@
-2015-03-21  Tom de Vries  <tom@codesourcery.com>
-
-	PR tree-optimization/65460
-	* omp-low.c (expand_omp_target): Set parallelized_function on
-	cgraph_node for child_fn.
-
-2015-03-21  Tom de Vries  <tom@codesourcery.com>
-
-	backport from trunk:
-	2015-03-21  Tom de Vries  <tom@codesourcery.com>
-
-	PR tree-optimization/65458
-	* cgraph.c (cgraph_node::dump): Handle parallelized_function field.
-	* cgraph.h (cgraph_node): Add parallelized_function field.
-	* lto-cgraph.c (lto_output_node): Write parallelized_function field.
-	(input_overwrite_node): Read parallelized_function field.
-	* omp-low.c (expand_omp_taskreg, finalize_task_copyfn): Set
-	parallelized_function on cgraph_node for child_fn.
-	* tree-parloops.c: Add include of plugin-api.h, ipa-ref.h and cgraph.h.
-	Remove include of gt-tree-parloops.h.
-	(parallelized_functions): Remove static variable.
-	(parallelized_function_p): Rewrite using parallelized_function field of
-	cgraph_node.
-	(create_loop_fn): Remove adding to parallelized_functions.
-	* Makefile.in (GTFILES): Remove tree-parloops.c
-
-2015-03-21  Tom de Vries  <tom@codesourcery.com>
-
-	backport from trunk:
-	2015-03-18  Tom de Vries  <tom@codesourcery.com>
-
-	* tree-parloops.c (parallelize_loops): Make static.
-	* tree-parloops.h (parallelize_loops): Remove extern declaration.
-
 2015-03-11  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* config/nvptx/nvptx.h (LIBSTDCXX): Define to "gcc".
diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 6ed6962..b499d04 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,37 @@
+2015-03-21  Tom de Vries  <tom@codesourcery.com>
+
+	PR tree-optimization/65460
+	* omp-low.c (expand_omp_target): Set parallelized_function on
+	cgraph_node for child_fn.
+
+2015-03-21  Tom de Vries  <tom@codesourcery.com>
+
+	backport from trunk:
+	2015-03-21  Tom de Vries  <tom@codesourcery.com>
+
+	PR tree-optimization/65458
+	* cgraph.c (cgraph_node::dump): Handle parallelized_function field.
+	* cgraph.h (cgraph_node): Add parallelized_function field.
+	* lto-cgraph.c (lto_output_node): Write parallelized_function field.
+	(input_overwrite_node): Read parallelized_function field.
+	* omp-low.c (expand_omp_taskreg, finalize_task_copyfn): Set
+	parallelized_function on cgraph_node for child_fn.
+	* tree-parloops.c: Add include of plugin-api.h, ipa-ref.h and cgraph.h.
+	Remove include of gt-tree-parloops.h.
+	(parallelized_functions): Remove static variable.
+	(parallelized_function_p): Rewrite using parallelized_function field of
+	cgraph_node.
+	(create_loop_fn): Remove adding to parallelized_functions.
+	* Makefile.in (GTFILES): Remove tree-parloops.c
+
+2015-03-21  Tom de Vries  <tom@codesourcery.com>
+
+	backport from trunk:
+	2015-03-18  Tom de Vries  <tom@codesourcery.com>
+
+	* tree-parloops.c (parallelize_loops): Make static.
+	* tree-parloops.h (parallelize_loops): Remove extern declaration.
+
 2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* tree-core.h: Don't include "gomp-constants.h".


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

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

* [PING][PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-03-20 11:38   ` Tom de Vries
  2015-03-21 22:31     ` Tom de Vries
@ 2015-04-17 10:08     ` Tom de Vries
  2015-06-08 12:33       ` [PING^2][PATCH][3/3][PR65460] " Tom de Vries
  1 sibling, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2015-04-17 10:08 UTC (permalink / raw)
  To: GCC Patches, Richard Biener

On 20-03-15 12:38, Tom de Vries wrote:
> On 19-03-15 12:05, Tom de Vries wrote:
>> On 18-03-15 18:22, Tom de Vries wrote:
>>> Hi,
>>>
>>> this patch fixes PR65460.
>>>
>>> The patch marks offloaded functions as parallelized, which means the parloops
>>> pass no longer attempts to modify that function.
>>
>> Updated patch to postpone mark_parallelized_function until the corresponding
>> cgraph_node is available, to ensure it works with the updated
>> mark_parallelized_function from patch 2/3.
>>
>
> Updated to eliminate mark_parallelized_function.
>
> Bootstrapped and reg-tested on x86_64.
>
> OK for stage4?
>

ping.

OK for stage1?

Thanks,
- Tom

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

* [PING^2][PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-04-17 10:08     ` [PING][PATCH][3/3][PR65460] " Tom de Vries
@ 2015-06-08 12:33       ` Tom de Vries
  2015-06-09 11:12         ` Richard Biener
  0 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2015-06-08 12:33 UTC (permalink / raw)
  To: GCC Patches, Richard Biener

On 17/04/15 12:08, Tom de Vries wrote:
> On 20-03-15 12:38, Tom de Vries wrote:
>> On 19-03-15 12:05, Tom de Vries wrote:
>>> On 18-03-15 18:22, Tom de Vries wrote:
>>>> Hi,
>>>>
>>>> this patch fixes PR65460.
>>>>
>>>> The patch marks offloaded functions as parallelized, which means the
>>>> parloops
>>>> pass no longer attempts to modify that function.
>>>
>>> Updated patch to postpone mark_parallelized_function until the
>>> corresponding
>>> cgraph_node is available, to ensure it works with the updated
>>> mark_parallelized_function from patch 2/3.
>>>
>>
>> Updated to eliminate mark_parallelized_function.
>>
>> Bootstrapped and reg-tested on x86_64.
>>
>> OK for stage4?
>>
>
> ping.

ping^2. Original post at 
https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01063.html .

>
> OK for stage1?
>

Thanks,
- Tom


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

* Re: [PING^2][PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-06-08 12:33       ` [PING^2][PATCH][3/3][PR65460] " Tom de Vries
@ 2015-06-09 11:12         ` Richard Biener
  2015-06-09 14:12           ` Tom de Vries
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Biener @ 2015-06-09 11:12 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches

On Mon, 8 Jun 2015, Tom de Vries wrote:

> On 17/04/15 12:08, Tom de Vries wrote:
> > On 20-03-15 12:38, Tom de Vries wrote:
> > > On 19-03-15 12:05, Tom de Vries wrote:
> > > > On 18-03-15 18:22, Tom de Vries wrote:
> > > > > Hi,
> > > > > 
> > > > > this patch fixes PR65460.
> > > > > 
> > > > > The patch marks offloaded functions as parallelized, which means the
> > > > > parloops
> > > > > pass no longer attempts to modify that function.
> > > > 
> > > > Updated patch to postpone mark_parallelized_function until the
> > > > corresponding
> > > > cgraph_node is available, to ensure it works with the updated
> > > > mark_parallelized_function from patch 2/3.
> > > > 
> > > 
> > > Updated to eliminate mark_parallelized_function.
> > > 
> > > Bootstrapped and reg-tested on x86_64.
> > > 
> > > OK for stage4?
> > > 
> > 
> > ping.
> 
> ping^2. Original post at
> https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01063.html .

Ok, but shouldn't it be set before calling add_new_function as
add_new_function might run passes that wouldn't identify the
function as parallelized?

Richard.

> > 
> > OK for stage1?
> > 
> 
> Thanks,
> - Tom
> 
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)

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

* Re: [PING^2][PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-06-09 11:12         ` Richard Biener
@ 2015-06-09 14:12           ` Tom de Vries
  2015-06-09 23:46             ` Thomas Schwinge
  0 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2015-06-09 14:12 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

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

On 09/06/15 13:07, Richard Biener wrote:
> On Mon, 8 Jun 2015, Tom de Vries wrote:
>
>> On 17/04/15 12:08, Tom de Vries wrote:
>>> On 20-03-15 12:38, Tom de Vries wrote:
>>>> On 19-03-15 12:05, Tom de Vries wrote:
>>>>> On 18-03-15 18:22, Tom de Vries wrote:
>>>>>> Hi,
>>>>>>
>>>>>> this patch fixes PR65460.
>>>>>>
>>>>>> The patch marks offloaded functions as parallelized, which means the
>>>>>> parloops
>>>>>> pass no longer attempts to modify that function.
>>>>>
>>>>> Updated patch to postpone mark_parallelized_function until the
>>>>> corresponding
>>>>> cgraph_node is available, to ensure it works with the updated
>>>>> mark_parallelized_function from patch 2/3.
>>>>>
>>>>
>>>> Updated to eliminate mark_parallelized_function.
>>>>
>>>> Bootstrapped and reg-tested on x86_64.
>>>>
>>>> OK for stage4?
>>>>
>>>
>>> ping.
>>
>> ping^2. Original post at
>> https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01063.html .
>
> Ok, but shouldn't it be set before calling add_new_function as
> add_new_function might run passes that wouldn't identify the
> function as parallelized?
>

Hm, indeed sometimes add_new_function executes some passes itself, 
besides queueing the function for further processing. I suppose the 
existing settings of parallelized_function should be modified in a 
similar way.

I'll bootstrap and reg-test attached two patches on x86_64, and commit 
unless objections.

Thanks,
- Tom

[-- Attachment #2: 0001-Mark-function-parallelized_function-before-add_new_f.patch --]
[-- Type: text/x-patch, Size: 1400 bytes --]

Mark function parallelized_function before add_new_function

2015-06-09  Tom de Vries  <tom@codesourcery.com>

	* omp-low.c (finalize_task_copyfn, expand_omp_taskreg): Mark function
	parallelized_function before add_new_function.
---
 gcc/omp-low.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index f322416..2045e48 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1552,8 +1552,9 @@ finalize_task_copyfn (gomp_task *task_stmt)
   pop_cfun ();
 
   /* Inform the callgraph about the new function.  */
+  cgraph_node *node = cgraph_node::get_create (child_fn);
+  node->parallelized_function = 1;
   cgraph_node::add_new_function (child_fn, false);
-  cgraph_node::get (child_fn)->parallelized_function = 1;
 }
 
 /* Destroy a omp_context data structures.  Called through the splay tree
@@ -5589,8 +5590,9 @@ expand_omp_taskreg (struct omp_region *region)
 
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
+      cgraph_node *node = cgraph_node::get_create (child_fn);
+      node->parallelized_function = 1;
       cgraph_node::add_new_function (child_fn, true);
-      cgraph_node::get (child_fn)->parallelized_function = 1;
 
       /* Fix the callgraph edges for child_cfun.  Those for cfun will be
 	 fixed in a following pass.  */
-- 
1.9.1


[-- Attachment #3: 0002-Mark-offloaded-functions-as-parallelized.patch --]
[-- Type: text/x-patch, Size: 791 bytes --]

Mark offloaded functions as parallelized

2015-06-09  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65460
	* omp-low.c (expand_omp_target): Set parallelized_function on
	cgraph_node for child_fn.
---
 gcc/omp-low.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2045e48..77716bf6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8959,6 +8959,8 @@ expand_omp_target (struct omp_region *region)
 
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
+      cgraph_node *node = cgraph_node::get_create (child_fn);
+      node->parallelized_function = 1;
       cgraph_node::add_new_function (child_fn, true);
 
 #ifdef ENABLE_OFFLOADING
-- 
1.9.1


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

* Re: [PING^2][PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-06-09 14:12           ` Tom de Vries
@ 2015-06-09 23:46             ` Thomas Schwinge
  2015-06-10  8:26               ` Tom de Vries
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Schwinge @ 2015-06-09 23:46 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches, Richard Biener

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

Hi Tom!

On Tue, 9 Jun 2015 16:12:12 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
> On 09/06/15 13:07, Richard Biener wrote:
> > On Mon, 8 Jun 2015, Tom de Vries wrote:
> >
> >> On 17/04/15 12:08, Tom de Vries wrote:
> >>> On 20-03-15 12:38, Tom de Vries wrote:
> >>>> On 19-03-15 12:05, Tom de Vries wrote:
> >>>>> On 18-03-15 18:22, Tom de Vries wrote:
> >>>>>> this patch fixes PR65460.
> >>>>>>
> >>>>>> The patch marks offloaded functions as parallelized, which means the
> >>>>>> parloops
> >>>>>> pass no longer attempts to modify that function.

> > Ok, but shouldn't it be set before calling add_new_function as
> > add_new_function might run passes that wouldn't identify the
> > function as parallelized?
> 
> Hm, indeed sometimes add_new_function executes some passes itself, 
> besides queueing the function for further processing. I suppose the 
> existing settings of parallelized_function should be modified in a 
> similar way.

(I took note of this small change of the trunk patch vs. the version
present on gomp-4_0-branch, and will adapt the latter as required as part
of the next merge.)

> I'll bootstrap and reg-test attached two patches on x86_64, and commit 
> unless objections.

> Mark offloaded functions as parallelized
> 
> 2015-06-09  Tom de Vries  <tom@codesourcery.com>
> 
> 	PR tree-optimization/65460
> 	* omp-low.c (expand_omp_target): Set parallelized_function on
> 	cgraph_node for child_fn.

(Committed to trunk in r224303.)

> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -8959,6 +8959,8 @@ expand_omp_target (struct omp_region *region)
>  
>        /* Inform the callgraph about the new function.  */
>        DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
> +      cgraph_node *node = cgraph_node::get_create (child_fn);

Would you please committ a fix: in offloading configurations
(ENABLE_OFFLOADING), this new node variable will clash with an existing
definition a little later:

> +      node->parallelized_function = 1;
>        cgraph_node::add_new_function (child_fn, true);
>  
>  #ifdef ENABLE_OFFLOADING
|        /* Add the new function to the offload table.  */
|        vec_safe_push (offload_funcs, child_fn);
|  #endif
|  
|        /* Fix the callgraph edges for child_cfun.  Those for cfun will be
|  	 fixed in a following pass.  */
|        push_cfun (child_cfun);
|        cgraph_edge::rebuild_edges ();
|  
|  #ifdef ENABLE_OFFLOADING
|        /* Prevent IPA from removing child_fn as unreachable, since there are no
|  	 refs from the parent function to child_fn in offload LTO mode.  */
|        struct cgraph_node *node = cgraph_node::get (child_fn);
|        node->mark_force_output ();
|  #endif


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* Re: [PING^2][PATCH][3/3][PR65460] Mark offloaded functions as parallelized
  2015-06-09 23:46             ` Thomas Schwinge
@ 2015-06-10  8:26               ` Tom de Vries
  0 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2015-06-10  8:26 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: GCC Patches, Richard Biener

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

On 10/06/15 00:15, Thomas Schwinge wrote:
> Hi Tom!
>
> On Tue, 9 Jun 2015 16:12:12 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> On 09/06/15 13:07, Richard Biener wrote:
>>> On Mon, 8 Jun 2015, Tom de Vries wrote:
>>>
>>>> On 17/04/15 12:08, Tom de Vries wrote:
>>>>> On 20-03-15 12:38, Tom de Vries wrote:
>>>>>> On 19-03-15 12:05, Tom de Vries wrote:
>>>>>>> On 18-03-15 18:22, Tom de Vries wrote:
>>>>>>>> this patch fixes PR65460.
>>>>>>>>
>>>>>>>> The patch marks offloaded functions as parallelized, which means the
>>>>>>>> parloops
>>>>>>>> pass no longer attempts to modify that function.
>
>>> Ok, but shouldn't it be set before calling add_new_function as
>>> add_new_function might run passes that wouldn't identify the
>>> function as parallelized?
>>
>> Hm, indeed sometimes add_new_function executes some passes itself,
>> besides queueing the function for further processing. I suppose the
>> existing settings of parallelized_function should be modified in a
>> similar way.
>
> (I took note of this small change of the trunk patch vs. the version
> present on gomp-4_0-branch, and will adapt the latter as required as part
> of the next merge.)
>
>> I'll bootstrap and reg-test attached two patches on x86_64, and commit
>> unless objections.
>
>> Mark offloaded functions as parallelized
>>
>> 2015-06-09  Tom de Vries  <tom@codesourcery.com>
>>
>> 	PR tree-optimization/65460
>> 	* omp-low.c (expand_omp_target): Set parallelized_function on
>> 	cgraph_node for child_fn.
>
> (Committed to trunk in r224303.)
>
>> --- a/gcc/omp-low.c
>> +++ b/gcc/omp-low.c
>> @@ -8959,6 +8959,8 @@ expand_omp_target (struct omp_region *region)
>>
>>         /* Inform the callgraph about the new function.  */
>>         DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
>> +      cgraph_node *node = cgraph_node::get_create (child_fn);
>
> Would you please committ a fix: in offloading configurations
> (ENABLE_OFFLOADING), this new node variable will clash with an existing
> definition a little later:
>
>> +      node->parallelized_function = 1;
>>         cgraph_node::add_new_function (child_fn, true);
>>
>>   #ifdef ENABLE_OFFLOADING
> |        /* Add the new function to the offload table.  */
> |        vec_safe_push (offload_funcs, child_fn);
> |  #endif
> |
> |        /* Fix the callgraph edges for child_cfun.  Those for cfun will be
> |  	 fixed in a following pass.  */
> |        push_cfun (child_cfun);
> |        cgraph_edge::rebuild_edges ();
> |
> |  #ifdef ENABLE_OFFLOADING
> |        /* Prevent IPA from removing child_fn as unreachable, since there are no
> |  	 refs from the parent function to child_fn in offload LTO mode.  */
> |        struct cgraph_node *node = cgraph_node::get (child_fn);
> |        node->mark_force_output ();
> |  #endif
>

Committed attached patch to trunk as obvious. Build and tested in 
ENABLE_OFFLOADING configuration on top of gomp-4_0-branch.

Thanks,
- Tom

[-- Attachment #2: 0001-Fix-build-for-ENABLE_OFFLOADING-in-expand_omp_target.patch --]
[-- Type: text/x-patch, Size: 849 bytes --]

Fix build for ENABLE_OFFLOADING in expand_omp_target

2015-06-10  Tom de Vries  <tom@codesourcery.com>

	* omp-low.c (expand_omp_target): Remove duplicate declaration of node.
---
 gcc/omp-low.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 77716bf6..72c431e 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8976,8 +8976,7 @@ expand_omp_target (struct omp_region *region)
 #ifdef ENABLE_OFFLOADING
       /* Prevent IPA from removing child_fn as unreachable, since there are no
 	 refs from the parent function to child_fn in offload LTO mode.  */
-      struct cgraph_node *node = cgraph_node::get (child_fn);
-      node->mark_force_output ();
+      cgraph_node::get (child_fn)->mark_force_output ();
 #endif
 
       /* Some EH regions might become dead, see PR34608.  If
-- 
1.9.1


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

end of thread, other threads:[~2015-06-10  8:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 17:22 [PATCH][3/3][PR65460] Mark offloaded functions as parallelized Tom de Vries
2015-03-19 11:05 ` Tom de Vries
2015-03-20 11:38   ` Tom de Vries
2015-03-21 22:31     ` Tom de Vries
2015-03-25  8:30       ` Thomas Schwinge
2015-04-17 10:08     ` [PING][PATCH][3/3][PR65460] " Tom de Vries
2015-06-08 12:33       ` [PING^2][PATCH][3/3][PR65460] " Tom de Vries
2015-06-09 11:12         ` Richard Biener
2015-06-09 14:12           ` Tom de Vries
2015-06-09 23:46             ` Thomas Schwinge
2015-06-10  8:26               ` Tom de Vries

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).