Reduction support for auto parallelization, Changes in omp_atomic expansion

Razya Ladelsky RAZYA@il.ibm.com
Mon Sep 10 17:46:00 GMT 2007


Hi,

This patch implements reductions' support for auto parallelization.
it is relative to Zdenek's merge of the parloop branch that was posted 
yesterday
(http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00763.html) 
Reduction support is enabled automatically when -ftree-parallelize-loop is 
enabled
and dumps messages when -fdump-tree-parloops-details is enabled.
(attached is the testcase reduction-1.c).

In addition, I followed Zdenek's concept (he also provided part of the 
code)
and changed the mechanism of gimplify/expand OMP_ATOMIC, to have "real" 
omp atomic expansion. The idea is to avoid full gimplification of omp 
atomic, and do it later in the omp expander.
The second part is not completely stable yet, there are some openmp 
regression 
tests failing. Zdenek has offered to help me with these failures. 
I'll post a follow-up patch soon that includes the fixes.

Thanks to Zdenek for his help,
Comments are welcome.
Razya


2007-09-10  Razya Ladelsky  <razya@il.ibm.com>

          * gimple-low.c (lower_stmt): Add OMP_ATOMIC.
          * gimplify.c (goa_lhs_expr_p): Export it.
            (goa_stabilize_expr): Change it to support the new omp_atomic 
            gimplification.
            (gimplify_omp_atomic_fetch_op, gimplify_omp_atomic_pipeline,
            gimplify_omp_atomic_mutex): Remove.
          * (gimplify_omp_atomic): Change it to simpliy gimpify the 
statement
            instead of expanding it.
        * omp-low.c (expand_omp_atomic, expand_omp_atomic_pipeline, 
            goa_stabilize_expr, expand_omp_atomic_mutex): New functions to 

            implement expansion of OMP_ATOMIC.
          (expand_omp, build_omp_regions_1, scan_omp_1, 
            expand_omp_atomic_fetch_op): Add support for OMP_ATOMIC.
          * tree-cfg.c (make_edges): add case for OMP_ATOMIC.
        * tree-gimple.c (is_gimple_stmt): Add OMP_ATOMIC.
        * tree-parloops.c (reduction_info): New structure for reduction.
            (reduction_list): New list to represent list of reductions per 
loop.
          (reduction_info_hash, reduction_info_eq, initialize_reductions,
            create_call_for_reduction, create_phi_for_local_result, 
            create_call_for_reduction_1, create_loads_for_reductions,
            create_final_loads_for_reduction): New functions.
          (loop_parallel_p): Identify reductions.
            (separate_decls_in_loop_name): Support reduction variables. 
            (separate_decls_in_loop): Add an argument, call 
            create_loads_for_reduction for each reduction.
            (canonicalize_loop_ivs): Identify reductions.
            (transform_to_exit_first_loop): Add reduction support. Remove 
assert.
            (gen_parallel_loop): call separate_decls_in_loop with 
          the new argument. Traverse reductions and call 
initialize_reductions, 
          create_call_for_reduction. 
            (parallelize_loops): Null the reduction list for each loop. 
            (add_field_for_name): Add fields for reductions.
        * tree-ssa-operands.c (get_expr_operands): Add a case for 
OMP_ATOMIC.
          * tree.h (OMP_DIRECTIVE_P): Add OMP_ATOMIC.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto_reductions.diff
Type: application/octet-stream
Size: 59321 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070910/ac9a16fb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reduction-1.c
Type: application/octet-stream
Size: 774 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070910/ac9a16fb/attachment-0001.obj>


More information about the Gcc-patches mailing list