This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [OpenACC 0/7] host_data construct
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Julian Brown <julian at codesourcery dot com>
- Cc: James Norris <jnorris at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Nathan Sidwell <Nathan_Sidwell at mentor dot com>
- Date: Tue, 1 Dec 2015 09:30:08 +0100
- Subject: Re: [OpenACC 0/7] host_data construct
- Authentication-results: sourceware.org; auth=none
- References: <56293476 dot 5020801 at codesourcery dot com> <562A578E dot 4080907 at codesourcery dot com> <20151026183422 dot GW478 at tucnak dot redhat dot com> <20151102183339 dot 365c3d33 at octopus> <20151112111621 dot 657650bc at octopus> <20151118124747 dot 30a2ec5d at octopus> <20151119131345 dot GX5675 at tucnak dot redhat dot com> <20151119142650 dot 5a8842e4 at octopus> <20151119155723 dot GA5675 at tucnak dot redhat dot com> <20151130193034 dot 71143aa4 at octopus>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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