This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch,openacc] use firstprivate pointers for subarrays in c and c++
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Cesar Philippidis <cesar at codesourcery dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 24 May 2016 08:09:55 +0200
- Subject: Re: [patch,openacc] use firstprivate pointers for subarrays in c and c++
- Authentication-results: sourceware.org; auth=none
- References: <573244BE dot 5010708 at codesourcery dot com> <20160520094231 dot GF28550 at tucnak dot redhat dot com> <5743BD19 dot 4090708 at codesourcery dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, May 23, 2016 at 07:31:53PM -0700, Cesar Philippidis wrote:
> @@ -12559,7 +12560,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
> t = OMP_CLAUSE_DECL (c);
> if (TREE_CODE (t) == TREE_LIST)
> {
> - if (handle_omp_array_sections (c, ort & C_ORT_OMP))
> + if (handle_omp_array_sections (c, ort & (C_ORT_OMP | C_ORT_ACC)))
> {
> remove = true;
> break;
You haven't touched the /c/ handle_omp_array_sections{,_1}. As I said, I believe
you can just drop the is_omp argument altogether (unlike C++), or, pass for
consistency ort itself there as well. But I bet the argument will be
unused.
> --- a/gcc/cp/semantics.c
> +++ b/gcc/cp/semantics.c
> @@ -4472,7 +4472,7 @@ omp_privatize_field (tree t, bool shared)
> static tree
> handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
> bool &maybe_zero_len, unsigned int &first_non_one,
> - bool is_omp)
> + enum c_omp_region_type ort)
> {
> tree ret, low_bound, length, type;
> if (TREE_CODE (t) != TREE_LIST)
> @@ -4484,7 +4484,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
> t = TREE_OPERAND (t, 0);
> ret = t;
> if (TREE_CODE (t) == COMPONENT_REF
> - && is_omp
> + && ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP || ort == C_ORT_ACC)
> && (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
> || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO
> || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FROM)
This hunk looks wrong, I'd expect just && ort == C_ORT_OMP.
OpenACC to my knowledge doesn't have mapping of fields,
at least you reject copy(var.field) so it would surprise me
if you wanted to allow copy(var.field[:]).
And #pragma omp declare simd doesn't have any clauses for which it would
call handle_omp_array_sections* at all.
> @@ -4545,11 +4545,12 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
> return ret;
> }
>
> - if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
> + if ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP
> + && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
ort == C_ORT_OMP is enough.
> @@ -4988,7 +4989,7 @@ handle_omp_array_sections (tree c, bool is_omp)
> || (TREE_CODE (t) == COMPONENT_REF
> && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE))
> return false;
> - if (is_omp)
> + if ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP || ort == C_ORT_ACC)
if (ort == C_ORT_OMP || ort == C_ORT_ACC)
Jakub