Hi! For reference, here's my rationale for OpenACC on this topic:
On Tue, 17 Dec 2013 07:17:31 +0100, Jakub Jelinek <ja...@redhat.com> wrote: > On Tue, Dec 17, 2013 at 03:51:14AM +0000, Iyer, Balaji V wrote: > > Hi Jakub, > > I will work on this, but I need a couple clarifications about some of > > your comments. Please see below: > > > > > > +#define CILK_SIMD_FN_CLAUSE_MASK \ > > > > + ( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SIMDLEN) > > > \ > > > > + | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LINEAR) > > > \ > > > > + | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_UNIFORM) > > > \ > > > > + | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_INBRANCH) > > > \ > > > > + | (OMP_CLAUSE_MASK_1 << > > > PRAGMA_OMP_CLAUSE_NOTINBRANCH)) > > > > > > I thought you'd instead add there PRAGMA_CILK_CLAUSE_VECTORLENGTH, > > > PRAGMA_CILK_CLAUSE_MASK and PRAGMA_CILK_CLAUSE_NOMASK (or > > > similar). > > > > > > > I looked at OpenACC implementation and they seem to use the OMP_CLAUSE_* > > (line # 11174 in c-parser.c) > > It uses just PRAGMA_OMP_CLAUSE_NONE, which really means no clauses at all (I > think it is for now). Right, that's only for now. > > Also, If I created CILK_CLAUSE_* variants, I have to re-create another > > function similar to c_parser_omp_all_clauses, whose workings will be > > identical to the c_parser_omp_all_clauses. Is that OK with you? > > No, I'd remove enum pragma_cilk_clause altogether and fold it into the end of > pragma_omp_clause, as: > PRAGMA_CILK_CLAUSE_VECTORLENGTH, > PRAGMA_CILK_CLAUSE_MASK, > PRAGMA_CILK_CLAUSE_NOMASK, > PRAGMA_CILK_CLAUSE_NONE = PRAGMA_OMP_CLAUSE_NONE, > PRAGMA_CILK_CLAUSE_LINEAR = PRAGMA_OMP_CLAUSE_LINEAR, > PRAGMA_CILK_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE, > PRAGMA_CILK_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, > PRAGMA_CILK_CLAUSE_LASTPRIVATE = PRAGMA_OMP_CLAUSE_LASTPRIVATE, > PRAGMA_CILK_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION > so that you can use it in the same bitmasks. Hmm, indeed my inclination (and what I have implemented in my working trees) has been to literally re-use the existing PRAGMA_OMP_* ones for OpenACC, without adding new aliasesm, and extend/add new ones as required. My understanding/reasoning is that PRAGMA_OMP_* just literally represents a parser token of a pragma line (see the one-to-one translation in c-parser.c:c_parser_omp_clause_name, for example). This means that »#pragma omp parallel copyin ([...])« and »#pragma acc parallel copyin ([...])« can share the same PRAGMA_OMP_CLAUSE_COPYIN, even though it means something different to both of them; PRAGMA_OMP_CLAUSE_* alone doesn't convey any meaning (apart from the token/"string" used in the pragma line), and it gets its meaning only if interpreted as part of a Open* construct/directive. Just like many other tokens only get their semantic meaning when parsed inside a specific language construct. For OpenACC, the disambiguation, that is, translation from PRAGMA_OMP_CLAUSE_* to OMP_CLAUSE_*... > That way, you don't have to change anything in c_parser_omp_all_clauses, > just add handling of the 3 clauses that don't have OpenMP counterparts. ... then indeed happens in a new c_parser_oacc_all_clauses, which parses all the applicable PRAGMA_OMP_CLAUSE_* according to the OpenACC semantics. For example, said PRAGMA_OMP_CLAUSE_COPYIN is translated to OMP_CLAUSE_MAP with OMP_CLAUSE_MAP_TO, and the (new) PRAGMA_OMP_CLAUSE_PRESENT_OR_COPYOUT (which is only interpreted/valid inside OpenACC contexts) is translated to OMP_CLAUSE_MAP with (new) OMP_CLAUSE_MAP_PRESENT_OR_FROM (which is only interpreted/valid inside OpenACC contexts). Grüße, Thomas
pgpplSmD1S2Jc.pgp
Description: PGP signature