This is the mail archive of the gcc-patches@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]

[PATCH] Reduction support for automatic parallelization, OMP_ATOMIC Changes


Hi,

This is a follow-up patch to 
http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00891.html
The prior patch failed for a few testcases of libgomp.
This patch passes successfully.
The main problem was lowering the OMP_ATOMIC.
Although it should be a simple statement, sometimes implicit 
conversions make the OMP_ATOMIC expression more complex, so it does not
fit the gimple form well.
To overcome this problem, OMP_ATOMIC was split into two codes: 
OMP_ATOMIC_LOAD and OMP_ATOMIC_ATORE.

the sequence will now be :

   OMP_LOAD (tmp, mem)
   val = some computations involving tmp;
   OMP_STORE (val) 

(these two new codes are described in tree.def)

The reduction code was also adapted to use these codes, 
and I added a new testsuite directory autopar including a few 
reduction tests.
I also moved the parallelization test that Zdenek provided with 
the autopar patch from tree-ssa directory to autopar.

Thanks to Zdenek who provided the bulk part of the omp_atomic 
gimplify/expand code.

Bootstrapped & regtested on x86.
O.K. for mainline?


2007-09-23  Razya Ladelsky 
              Zdenek Dvorak 

          * expr.c (expand_expr_real_1): add cases for OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
          * Makefile.in: add dependency to expr.o and to tree-parloops.o
          * tree-pretty-print.c (dump_generic_node): Add OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
          * tree.h (OMP_DIRECTIVE_P): add OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
          * gimple-low.c (lower_stmt): Add OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
          * gimplify.c (gimplify_expr): Add OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE. 
            (gimplify_omp_atomic_fetch_op, gimplify_omp_atomic_pipeline,
            gimplify_omp_atomic_mutex): Remove.
           (gimplify_omp_atomic): Change it to simply gimplify the 
statement
            instead of expanding it.
        * omp-low.c: Add includes to optabs.h, cfgloop.h.
            (expand_omp_atomic, expand_omp_atomic_pipeline, 
            goa_stabilize_expr, expand_omp_atomic_mutex, 
            expand_omp_atomic_fetch_op): New functions to implement 
expansion of OMP_ATOMIC.
          (expand_omp, build_omp_regions_1): Add support for 
OMP_ATOMIC_LOAD/OMP_ATOMIC_STORE.
          * tree-cfg.c (make_edges): add case for OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
        * tree-gimple.c (is_gimple_stmt): Add OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
        * tree-parloops.c: add include to tree-vectorizer.h. 
            (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-vectorizer.h (vect_analyze_loop_form): Add declaration.
          * tree-vect-analyze.c (vect_analyze_loop_form): export it.
          * tree.def: add definitions for OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
          * tree-inline.c (estimate_num_insns_1): add cases for 
OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE.
          * tree-cfg.c (make_edges): Add OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE.
          * tree-ssa-operands.c (get_addr_dereference_operands): New 
function. Subroutine of 
            get_indirect_ref_operands.
            (get_indirect_ref_operands): Call 
get_addr_dereference_operands.
            (get_expr_operands): Support OMP_ATOMIC_LOAD, 
OMP_ATOMIC_STORE. 
          * testsuite/gcc.dg/gomp/atomic-3.c: Search for string on ompexp 
dump instead 
            of gimple dump.
          * testsuite/gcc.dg/gomp/atomic-9.c: Same.
          * testsuite/gcc.dg/gomp/atomic-10.c: Same.
          * testsuite/g++.dg/gomp/atomic-3.C: Same.
          * testsuite/g++.dg/gomp/atomic-9.C: Same.
          * testsuite/g++.dg/gomp/atomic-10.C: Same.
          * testsite/gcc.dg/autopar: New directory.
          * testsite/gcc.dg/autopar/autopar.exp: New driver.
          * testsite/gcc.dg/autopar/reduc-1.c: New test.
          * testsite/gcc.dg/autopar/reduc-1char.c: New test.
          * testsite/gcc.dg/autopar/reduc-1short.c: New test.
          * testsite/gcc.dg/autopar/reduc-2.c: New test. 
          * testsite/gcc.dg/autopar/reduc-2char.c: New test. 
          * testsite/gcc.dg/autopar/reduc-2short.c: New test.
          * testsite/gcc.dg/autopar/reduc-3.c: New test.
          * testsite/gcc.dg/autopar/reduc-6.c: New test.
          * testsite/gcc.dg/autopar/reduc-7.c: New test.
          * testsite/gcc.dg/autopar/reduc-8.c: New test.
          * testsite/gcc.dg/autopar/reduc-9.c: New test.
 

Attachment: auto_reductions.diff
Description: Binary data


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