public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/65458] New: parloops transforms omp-generated functions
Date: Wed, 18 Mar 2015 07:45:00 -0000	[thread overview]
Message-ID: <bug-65458-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-03-18  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  7:45 vries at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65458-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).