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]

Re: [OpenACC 0/7] host_data construct


On Mon, Nov 30, 2015 at 07:30:34PM +0000, Julian Brown wrote:
>     Julian Brown  <julian@codesourcery.com>
>     Cesar Philippidis  <cesar@codesourcery.com>
>     James Norris  <James_Norris@mentor.com>
> 
>     gcc/
>     * c-family/c-pragma.c (oacc_pragmas): Add PRAGMA_OACC_HOST_DATA.
>     * c-family/c-pragma.h (pragma_kind): Add PRAGMA_OACC_HOST_DATA.

c-family/, c/ and cp/ subdirectories have their own ChangeLog, so you need
to split the entry into multiple ChangeLog files and remove the directory
prefixes.

> @@ -6120,6 +6121,9 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
>  					 (splay_tree_key) decl);
>  		  if (n2)
>  		    {
> +		      if (octx->region_type == ORT_ACC_HOST_DATA)
> +		        error ("variable %qE declared in enclosing "
> +			       "host_data region", DECL_NAME (decl));

%<host_data%> instead?
>  		      nflags |= GOVD_MAP;
>  		      goto found_outer;
>  		    }
> @@ -6418,6 +6422,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
>        case OMP_TARGET_DATA:
>        case OMP_TARGET_ENTER_DATA:
>        case OMP_TARGET_EXIT_DATA:
> +      case OACC_HOST_DATA:
>  	ctx->target_firstprivatize_array_bases = true;
>        default:
>  	break;
> @@ -6683,6 +6688,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
>  	    case OMP_TARGET_DATA:
>  	    case OMP_TARGET_ENTER_DATA:
>  	    case OMP_TARGET_EXIT_DATA:
> +	    case OACC_HOST_DATA:
>  	      if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
>  		  || (OMP_CLAUSE_MAP_KIND (c)
>  		      == GOMP_MAP_FIRSTPRIVATE_REFERENCE))
> @@ -6695,6 +6701,22 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
>  	    }
>  	  if (remove)
>  	    break;
> +	  if (DECL_P (decl) && outer_ctx && (region_type & ORT_ACC))
> +	    {
> +	      struct gimplify_omp_ctx *octx;
> +	      for (octx = outer_ctx; octx; octx = octx->outer_context)
> +	        {
> +		  if (!(octx->region_type & (ORT_TARGET_DATA | ORT_TARGET)))
> +		    break;

Wouldn't it be better to do
		if (octx->region_type != ORT_ACC_HOST_DATA)
		  continue;
here, thus only lookup if you really want to use it?

> +		  splay_tree_node n2
> +		    = splay_tree_lookup (octx->variables,
> +					 (splay_tree_key) decl);
> +		  if (n2 && octx->region_type == ORT_ACC_HOST_DATA)

and remove the && ... part from the condition?

> +		    error_at (OMP_CLAUSE_LOCATION (c), "variable %qE "
> +			      "declared in enclosing host_data region",
> +			      DECL_NAME (decl));
> +		}
> +	    }
>  	  if (OMP_CLAUSE_SIZE (c) == NULL_TREE)
>  	    OMP_CLAUSE_SIZE (c) = DECL_P (decl) ? DECL_SIZE_UNIT (decl)
>  				  : TYPE_SIZE_UNIT (TREE_TYPE (decl));

Ok with those changes.

	Jakub


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