This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/65458] New: parloops transforms omp-generated functions


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]