Automatic parallelization in GCC

Automatic parallelization distributes sequential code into multi-threaded code. It automatically generates parallel (multi-threaded) code for specific loop constructs using the gomp library.

The first version of the code, allowing parallelization of inner-most loops that carry no dependences, was contributed by Zdenek Dvorak and Sebastian Pop (integrated to GCC 4.3). The feature later was enhanced with reduction dependencies support by Razya Ladelsky (GCC 4.3).

Number of threads is currently determined by the user via the compile command (-ftree-parallelize-loops=4)

There are simple profitability conditions:

  1. Based on the profile information to determine how frequently the loop is executed,
  2. Examining whether the number of iterations is large enough to create new threads

If a loop satisfies the correctness and profitability conditions, GIMPLE_OMP_PARALLEL and GIMPLE_OMP_FOR codes are added (and OMP_ATOMIC for reduction support), and later expanded by the omp expansion machinery.

Li Feng has summarized capabilities in AutoparRelated

Current work on autopr focuses on integration with Graphite framework to leverage the sophisticated loop nest analysis and transformations in Graphite, and the ability to parallelize simple loops in autopar pass (synchronization free) to expose parallelizing opportunities for complicated loops.

See also Automatic Parallelization in Graphite

The plan for initial steps of integration (by Li Feng) is detailed in http://gcc.gnu.org/ml/gcc/2009-04/msg00572.html and will be done in Graphite branch.

None: AutoParInGCC (last edited 2009-05-25 14:52:53 by RazyaLadelsky)