public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/65458] New: parloops transforms omp-generated functions
@ 2015-03-18  7:45 vries at gcc dot gnu.org
  2015-03-18 11:28 ` [Bug tree-optimization/65458] parloops transforms omp-thread functions rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2015-03-18  7:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65458

            Bug ID: 65458
           Summary: parloops transforms omp-generated functions
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org

parloops parallelizes loops by:
- analyzing dependencies
- lowering the loop body
- annotating the loop with omp parallel and loop pragmas
- omp-expanding the loop into a seperate function
- replacing the loop with a call to a runtime function, which will run the
  split-off function in several threads.

Parloops has a mechanism to not process again functions that were created by
parloops (parallelized_function_p).

However, if a source file contains omp pragmas that cause loops to be
transformed and split off into seperate functions, there is nothing stopping
parloops from processing those functions again. The result is a thread function
that itself again creates threads.

Look for instance at:
...
gcc -fopenmp -O2 -std=c99 src/gcc/testsuite/gcc.dg/gomp/pr25990.c -S
-fdump-tree-all-all -ftree-parallelize-loops=2
...

We can see main._omp_fn.1._loopfn.0 in this list:
...
$ grep Function pr25990.c.123t.parloops 
;; Function main._omp_fn.0 (main._omp_fn.0, funcdef_no=1, decl_uid=2010,
cgraph_uid=1, symbol_order=1)
;; Function main._omp_fn.1 (main._omp_fn.1, funcdef_no=2, decl_uid=2047,
cgraph_uid=2, symbol_order=2)
;; Function main (main, funcdef_no=0, decl_uid=1739, cgraph_uid=0,
symbol_order=0) (executed once)
;; Function main._omp_fn.1._loopfn.0 (main._omp_fn.1._loopfn.0, funcdef_no=3,
decl_uid=2397, cgraph_uid=14, symbol_order=14)
;; Function main._loopfn.1 (main._loopfn.1, funcdef_no=4, decl_uid=2512,
cgraph_uid=15, symbol_order=15)
...

I think we should handle functions splitt off by omp processing conservatively
in parloops.


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

* [Bug tree-optimization/65458] parloops transforms omp-thread functions
  2015-03-18  7:45 [Bug tree-optimization/65458] New: parloops transforms omp-generated functions vries at gcc dot gnu.org
@ 2015-03-18 11:28 ` rguenth at gcc dot gnu.org
  2015-03-19  7:27 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-18 11:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65458

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-18
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Agreed.


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

* [Bug tree-optimization/65458] parloops transforms omp-thread functions
  2015-03-18  7:45 [Bug tree-optimization/65458] New: parloops transforms omp-generated functions vries at gcc dot gnu.org
  2015-03-18 11:28 ` [Bug tree-optimization/65458] parloops transforms omp-thread functions rguenth at gcc dot gnu.org
@ 2015-03-19  7:27 ` vries at gcc dot gnu.org
  2015-03-21 12:55 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2015-03-19  7:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65458

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #35051|0                           |1
        is obsolete|                            |

--- Comment #3 from vries at gcc dot gnu.org ---
Created attachment 35061
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35061&action=edit
updated tentative patch

Updated patch that uses new cgraph_node field parallelized_function, following
up on comments from Jakub at
https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00967.html . Currently Testing.


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

* [Bug tree-optimization/65458] parloops transforms omp-thread functions
  2015-03-18  7:45 [Bug tree-optimization/65458] New: parloops transforms omp-generated functions vries at gcc dot gnu.org
  2015-03-18 11:28 ` [Bug tree-optimization/65458] parloops transforms omp-thread functions rguenth at gcc dot gnu.org
  2015-03-19  7:27 ` vries at gcc dot gnu.org
@ 2015-03-21 12:55 ` vries at gcc dot gnu.org
  2015-03-21 13:02 ` vries at gcc dot gnu.org
  2015-03-22  8:53 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2015-03-21 12:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65458

--- Comment #4 from vries at gcc dot gnu.org ---
Author: vries
Date: Sat Mar 21 10:14:10 2015
New Revision: 221551

URL: https://gcc.gnu.org/viewcvs?rev=221551&root=gcc&view=rev
Log:
Mark omp thread functions as parallelized

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

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/cgraph.c
    trunk/gcc/cgraph.h
    trunk/gcc/lto-cgraph.c
    trunk/gcc/omp-low.c
    trunk/gcc/tree-parloops.c


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

* [Bug tree-optimization/65458] parloops transforms omp-thread functions
  2015-03-18  7:45 [Bug tree-optimization/65458] New: parloops transforms omp-generated functions vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-03-21 12:55 ` vries at gcc dot gnu.org
@ 2015-03-21 13:02 ` vries at gcc dot gnu.org
  2015-03-22  8:53 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2015-03-21 13:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65458

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |vries at gcc dot gnu.org

--- Comment #5 from vries at gcc dot gnu.org ---
Committed patch, marking resolved fixed.


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

* [Bug tree-optimization/65458] parloops transforms omp-thread functions
  2015-03-18  7:45 [Bug tree-optimization/65458] New: parloops transforms omp-generated functions vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-03-21 13:02 ` vries at gcc dot gnu.org
@ 2015-03-22  8:53 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2015-03-22  8:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65458

--- Comment #6 from vries at gcc dot gnu.org ---
Author: vries
Date: Sat Mar 21 22:22:44 2015
New Revision: 221561

URL: https://gcc.gnu.org/viewcvs?rev=221561&root=gcc&view=rev
Log:
Mark omp thread functions as parallelized

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

Modified:
    branches/gomp-4_0-branch/gcc/ChangeLog
    branches/gomp-4_0-branch/gcc/Makefile.in
    branches/gomp-4_0-branch/gcc/cgraph.c
    branches/gomp-4_0-branch/gcc/cgraph.h
    branches/gomp-4_0-branch/gcc/lto-cgraph.c
    branches/gomp-4_0-branch/gcc/omp-low.c
    branches/gomp-4_0-branch/gcc/tree-parloops.c


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

end of thread, other threads:[~2015-03-21 22:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18  7:45 [Bug tree-optimization/65458] New: parloops transforms omp-generated functions vries at gcc dot gnu.org
2015-03-18 11:28 ` [Bug tree-optimization/65458] parloops transforms omp-thread functions rguenth at gcc dot gnu.org
2015-03-19  7:27 ` vries at gcc dot gnu.org
2015-03-21 12:55 ` vries at gcc dot gnu.org
2015-03-21 13:02 ` vries at gcc dot gnu.org
2015-03-22  8:53 ` vries at gcc dot gnu.org

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