On 01-10-2019 14:45, Chung-Lin Tang wrote:

> Index: gcc/config/nvptx/nvptx.c
> ===================================================================
> --- gcc/config/nvptx/nvptx.c  (revision 276406)
> +++ gcc/config/nvptx/nvptx.c  (working copy)
> @@ -68,6 +68,10 @@
>  #include "attribs.h"
>  #include "tree-vrp.h"
>  #include "tree-ssa-operands.h"
> +#include "tree-pretty-print.h"
> +#include "gimple-pretty-print.h"
> +#include "tree-cfg.h"
> +#include "gimple-ssa.h"
>  #include "tree-ssanames.h"
>  #include "gimplify.h"
>  #include "tree-phinodes.h"
> @@ -6437,6 +6441,226 @@ nvptx_set_current_function (tree fndecl)
>    oacc_bcast_partition = 0;
>  }
>  
> +static void
> +nvptx_expand_to_rtl_hook (void)
> +{
> +  /* For utilizing CUDA .param kernel arguments, we detect and modify
> +     the gimple of offloaded child functions, here before RTL expansion,
> +     starting with standard OMP form:
> +      foo._omp_fn.0 (const struct .omp_data_t.8 & restrict .omp_data_i) { 
> ... }
> +   
> +     and transform it into a style where the OMP data record fields are
> +     "exploded" into individual scalar arguments:
> +      foo._omp_fn.0 (int * a, int * b, int * c) { ... }
> +
> +     Note that there are implicit assumptions of how OMP lowering (and/or 
> other
> +     intervening passes) behaves contained in this transformation code;
> +     if those passes change in their output, this code may possibly need
> +     updating.  */
> +
> +  if (lookup_attribute ("omp target entrypoint",
> +                     DECL_ATTRIBUTES (current_function_decl))
> +      /* The rather indirect manner in which OpenMP target functions are
> +      launched makes this transformation only valid for OpenACC currently.
> +      TODO: e.g. write_omp_entry(), nvptx_declare_function_name(), etc.
> +      needs changes for this to work with OpenMP.  */
> +      && lookup_attribute ("oacc function",
> +                        DECL_ATTRIBUTES (current_function_decl)))
> +    {

Please do an early-return here.

Otherwise, no comments to the code as such.

Thanks,
- Tom

Reply via email to