[PATCH, OpenACC] Add support for gang local storage allocation in shared memory

Julian Brown julian@codesourcery.com
Thu Aug 16 15:47:00 GMT 2018


On Wed, 15 Aug 2018 21:56:54 +0200
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:

> On 15 August 2018 18:46:37 CEST, Julian Brown
> <julian@codesourcery.com> wrote:
> >On Mon, 13 Aug 2018 12:06:21 -0700
> >Cesar Philippidis <cesar@codesourcery.com> wrote:  
> 
> atttribute has more t than strictly necessary. 
> Don't like signed integer levels where they should be some unsigned. 
> Also don't like single switch cases instead of if.
> And omitting function comments even if the hook way above is
> documented may be ok ish but is a bit lazy ;)

Here's a new version with those comments addressed. I also changed the
logic around a little to avoid adding decls to the vec in omp_context
which would never be given the gang-private attribute.

Re-tested with offloading to NVPTX.

OK?

Julian

2018-08-10  Julian Brown  <julian@codesourcery.com>
            Chung-Lin Tang  <cltang@codesourcery.com>

        gcc/
        * config/nvptx/nvptx.c (tree-hash-traits.h): Include.
        (gangprivate_shared_size): New global variable.
        (gangprivate_shared_align): Likewise.
        (gangprivate_shared_sym): Likewise.
        (gangprivate_shared_hmap): Likewise.
        (nvptx_option_override): Initialize gangprivate_shared_sym,
        gangprivate_shared_align.
        (nvptx_file_end): Output gangprivate_shared_sym.
        (nvptx_goacc_expand_accel_var): New function.
        (nvptx_set_current_function): New function.
        (TARGET_SET_CURRENT_FUNCTION): Define hook.
        (TARGET_GOACC_EXPAND_ACCEL): Likewise.
        * doc/tm.texi (TARGET_GOACC_EXPAND_ACCEL_VAR): Document new hook.
        * doc/tm.texi.in (TARGET_GOACC_EXPAND_ACCEL_VAR): Likewise.
        * expr.c (expand_expr_real_1): Remap decls marked with the
        "oacc gangprivate" attribute.
        * omp-low.c (omp_context): Add oacc_partitioning_level and
        oacc_addressable_var_decls fields.
        (new_omp_context): Initialize oacc_addressable_var_decls in new
        omp_context.
        (delete_omp_context): Delete oacc_addressable_var_decls in old
        omp_context.
        (lower_oacc_head_tail): Record partitioning-level count in omp context.
        (oacc_record_private_var_clauses, oacc_record_vars_in_bind)
        (mark_oacc_gangprivate): New functions.
        (lower_omp_for): Call oacc_record_private_var_clauses with "for"
        clauses.  Call mark_oacc_gangprivate for gang-partitioned loops.
        (lower_omp_target): Call oacc_record_private_var_clauses with "target"
        clauses.
        Call mark_oacc_gangprivate for offloaded target regions.
        (lower_omp_1): Call vars_in_bind for GIMPLE_BIND within OMP regions.
        * target.def (expand_accel_var): New hook.

        libgomp/
        * testsuite/libgomp.oacc-c-c++-common/gang-private-1.c: New test.
        * testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: New test.
        * testsuite/libgomp.oacc-c/pr85465.c: New test.
        * testsuite/libgomp.oacc-fortran/gangprivate-attrib-1.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gang-local-storage-in-shm-5.diff
Type: text/x-patch
Size: 19358 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180816/291e80ea/attachment.bin>


More information about the Gcc-patches mailing list