This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Next set of OpenACC changes: Fortran
- From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, gfortran <fortran at gcc dot gnu dot org>, Bernd Schmidt <bernds at codesourcery dot com>, Cesar Philippidis <cesar at codesourcery dot com>, Chung-Lin Tang <cltang at codesourcery dot com>, James Norris <jnorris at codesourcery dot com>, Joseph Myers <joseph at codesourcery dot com>, Julian Brown <julian at codesourcery dot com>, Tom de Vries <tom at codesourcery dot com>
- Date: Tue, 5 May 2015 12:42:25 +0200
- Subject: Re: Next set of OpenACC changes: Fortran
- Authentication-results: sourceware.org; auth=none
- References: <87sibbpfpx dot fsf at schwinge dot name> <87h9rrpfi5 dot fsf at schwinge dot name>
On 5 May 2015 at 10:58, Thomas Schwinge <thomas@codesourcery.com> wrote:
> Hi!
+/* Node in the linked list used for storing !$oacc declare constructs. */
The clause is called $ACC declare, isn't it?
> + for (oc = new_oc; oc; oc = oc->next)
> + {
> + c = oc->clauses;
> + for (n = c->lists[OMP_LIST_MAP]; n != NULL; n = n->next)
> + n->sym->mark = 0;
> + }
> +
> + for (oc = new_oc; oc; oc = oc->next)
> + {
> + c = oc->clauses;
> + for (n = c->lists[OMP_LIST_MAP]; n != NULL; n = n->next)
> + {
> + if (n->sym->mark)
> + {
> + gfc_error ("Symbol %qs present on multiple clauses at %C",
> + n->sym->name);
> + return MATCH_ERROR;
> + }
> + else
> + n->sym->mark = 1;
> + }
> + }
> +
> + for (oc = new_oc; oc; oc = oc->next)
> + {
> + c = oc->clauses;
> + for (n = c->lists[OMP_LIST_MAP]; n != NULL; n = n->next)
> + n->sym->mark = 1;
> + }
Much code for setting n->sym->mark = 1. What am i missing?
> +
> + ns->oacc_declare = new_oc;
> +
> return MATCH_YES;
> }
>
> @@ -1304,10 +1580,21 @@ match
> gfc_match_oacc_update (void)
> {
> gfc_omp_clauses *c;
> - if (gfc_match_omp_clauses (&c, OACC_UPDATE_CLAUSES, false, false, true)
> + locus here = gfc_current_locus;
> +
> + if (gfc_match_omp_clauses (&c, OACC_UPDATE_CLAUSES,
> + OACC_UPDATE_CLAUSE_DEVICE_TYPE_MASK, false,
> + false, true)
> != MATCH_YES)
> return MATCH_ERROR;
>
> + if (!c->lists[OMP_LIST_MAP])
> + {
> + gfc_error ("%<acc update%> must contain at least one "
> + "%<device%> or %<host/self%> clause at %L", &here);
> + return MATCH_ERROR;
$ACC UPDATE instead of %<acc update %> ?
> - else if (code->ext.omp_clauses->gang
> - && code->ext.omp_clauses->worker
> - && code->ext.omp_clauses->vector)
> + if (code->ext.omp_clauses->tile_list && code->ext.omp_clauses->gang
> + && code->ext.omp_clauses->worker && code->ext.omp_clauses->vector)
conditions on separate lines, please.
> - for (list = OMP_LIST_DEVICE_RESIDENT;
> - list <= OMP_LIST_DEVICE_RESIDENT; list++)
> - for (n = ns->oacc_declare_clauses->lists[list]; n; n = n->next)
> - {
> - n->sym->mark = 0;
> - if (n->sym->attr.flavor == FL_PARAMETER)
> - gfc_error ("PARAMETER object %qs is not allowed at %L", n->sym->name, &loc);
> - }
> + for (list = OMP_LIST_DEVICE_RESIDENT;
> + list <= OMP_LIST_DEVICE_RESIDENT; list++)
> + for (n = oc->clauses->lists[list]; n; n = n->next)
> + {
> + n->sym->mark = 0;
> + if (n->sym->attr.flavor == FL_PARAMETER)
> + gfc_error ("PARAMETER object %qs is not allowed at %L",
> + n->sym->name, &loc);
> + }
>
> - for (list = OMP_LIST_DEVICE_RESIDENT;
> - list <= OMP_LIST_DEVICE_RESIDENT; list++)
> - for (n = ns->oacc_declare_clauses->lists[list]; n; n = n->next)
> - {
> - if (n->sym->mark)
> - gfc_error ("Symbol %qs present on multiple clauses at %L",
> - n->sym->name, &loc);
> - else
> - n->sym->mark = 1;
> - }
> + for (list = OMP_LIST_DEVICE_RESIDENT;
> + list <= OMP_LIST_DEVICE_RESIDENT; list++)
> + for (n = oc->clauses->lists[list]; n; n = n->next)
> + {
> + if (n->sym->mark)
> + gfc_error ("Symbol %qs present on multiple clauses at %L",
> + n->sym->name, &loc);
> + else
> + n->sym->mark = 1;
> + }
>
> - for (n = ns->oacc_declare_clauses->lists[OMP_LIST_DEVICE_RESIDENT]; n;
> - n = n->next)
> - check_array_not_assumed (n->sym, loc, "DEVICE_RESIDENT");
> + for (n = oc->clauses->lists[OMP_LIST_DEVICE_RESIDENT]; n; n = n->next)
> + check_array_not_assumed (n->sym, loc, "DEVICE_RESIDENT");
> +
> + for (n = oc->clauses->lists[OMP_LIST_MAP]; n; n = n->next)
> + {
> + if (n->expr && n->expr->ref->type == REF_ARRAY)
> + gfc_error ("Subarray: %qs not allowed in $!ACC DECLARE at %L",
> + n->sym->name, &loc);
> + }
> + }
> }
The ->mark setting looks complicated (as noted above)?
thanks,