[gomp4] (NVPTX) thread barriers after OpenACC worker loops

Julian Brown julian@codesourcery.com
Mon Jun 8 12:04:00 GMT 2015


Hi,

This patch adds a thread barrier after worker loops for OpenACC, in
accordance with OpenACC 2.0a section 2.7.3 (worker loops): "All workers
will complete execution of their assigned iterations before any worker
proceeds beyond the end of the loop.". (This is quite target-specific:
work to alleviate that is still ongoing.)

Barriers are "special" in that they should not be cloned or subject to
excessive code motion: to that end, barriers placed after loops have
their (outgoing) edge set to EDGE_ABNORMAL. That seems to suffice to
keep the barriers in the right places.

This passes libgomp testing when applied on gomp4 branch, and fixes the
previously-broken worker-partn-5.c and worker-partn-6.c tests, on top
of my previous patches:

https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02612.html
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00307.html

(ping!), but unfortunately (again, with the above patches) appears to
interact badly with Cesar's patch for vector state propagation:

https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00371.html

I haven't yet investigated why (I reverted that patch in my local
series in order to test the attached patch).

FYI,

Julian

ChangeLog

    gcc/
    * omp-low.c (build_oacc_threadbarrier): New function.
    (oacc_loop_needs_threadbarrier_p): New function.
    (expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
    Insert threadbarrier after worker loops.
    (find_omp_for_region_data): Rename to...
    (find_omp_for_region_gwv): This. Return mask, rather than modifying
    REGION structure.
    (build_omp_regions_1): Move modification of REGION structure to
    here, after calling above function with new name.
    (generate_oacc_broadcast): Use new build_oacc_threadbarrier
    function.
    (make_gimple_omp_edges): Make edges out of OpenACC worker loop exit
    block abnormal.
    * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Add
    BUILT_IN_GOACC_THREADBARRIER.

    libgomp/
    * testsuite/libgomp.oacc-c-c++-common/worker-partn-5.c: Remove
    XFAIL.
    * testsuite/libgomp.oacc-c-c++-common/worker-partn-6.c: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threadbarrier-after-wv-loops-2.diff
Type: text/x-patch
Size: 7142 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150608/68a53556/attachment.bin>


More information about the Gcc-patches mailing list