Hi! On Thu, 13 Nov 2014 14:02:37 +0100, Jakub Jelinek <ja...@redhat.com> wrote: > > void > > init_pragma (void) > > { > > + if (flag_openacc) > > + { > > + const int n_oacc_pragmas > > + = sizeof (oacc_pragmas) / sizeof (*oacc_pragmas); > > + int i; > > + > > + for (i = 0; i < n_oacc_pragmas; ++i) > > + cpp_register_deferred_pragma (parse_in, "acc", oacc_pragmas[i].name, > > + oacc_pragmas[i].id, true, true); > > + } > > + > > if (flag_openmp) > > { > > const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof > > (*omp_pragmas); > > Is -fopenmp -fopenacc tested not to run out of number of supported pragmas > by libcpp?
We're running (some limited amount of) combined OpenACC/OpenMP compile testing, yes. > > -/* All clauses defined by OpenMP 2.5, 3.0, 3.1 and 4.0. > > +/* All clauses defined by OpenACC 2.0, and OpenMP 2.5, 3.0, 3.1, and 4.0. > > Used internally by both C and C++ parsers. */ > > typedef enum pragma_omp_clause { > > PRAGMA_OMP_CLAUSE_NONE = 0, > > > > PRAGMA_OMP_CLAUSE_ALIGNED, > > + PRAGMA_OMP_CLAUSE_ASYNC, > > PRAGMA_OMP_CLAUSE_COLLAPSE, > > + PRAGMA_OMP_CLAUSE_COPY, > > PRAGMA_OMP_CLAUSE_COPYIN, > > + PRAGMA_OMP_CLAUSE_COPYOUT, > > PRAGMA_OMP_CLAUSE_COPYPRIVATE, > > + PRAGMA_OMP_CLAUSE_CREATE, > > PRAGMA_OMP_CLAUSE_DEFAULT, > > + PRAGMA_OMP_CLAUSE_DELETE, > > PRAGMA_OMP_CLAUSE_DEPEND, > > PRAGMA_OMP_CLAUSE_DEVICE, > > + PRAGMA_OMP_CLAUSE_DEVICEPTR, > > PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, > > PRAGMA_OMP_CLAUSE_FINAL, > > PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, > > PRAGMA_OMP_CLAUSE_FOR, > > PRAGMA_OMP_CLAUSE_FROM, > > + PRAGMA_OMP_CLAUSE_HOST, > > PRAGMA_OMP_CLAUSE_IF, > > PRAGMA_OMP_CLAUSE_INBRANCH, > > PRAGMA_OMP_CLAUSE_LASTPRIVATE, > > @@ -90,16 +106,24 @@ typedef enum pragma_omp_clause { > > PRAGMA_OMP_CLAUSE_MERGEABLE, > > PRAGMA_OMP_CLAUSE_NOTINBRANCH, > > PRAGMA_OMP_CLAUSE_NOWAIT, > > + PRAGMA_OMP_CLAUSE_NUM_GANGS, > > PRAGMA_OMP_CLAUSE_NUM_TEAMS, > > PRAGMA_OMP_CLAUSE_NUM_THREADS, > > + PRAGMA_OMP_CLAUSE_NUM_WORKERS, > > PRAGMA_OMP_CLAUSE_ORDERED, > > PRAGMA_OMP_CLAUSE_PARALLEL, > > + PRAGMA_OMP_CLAUSE_PRESENT, > > + PRAGMA_OMP_CLAUSE_PRESENT_OR_COPY, > > + PRAGMA_OMP_CLAUSE_PRESENT_OR_COPYIN, > > + PRAGMA_OMP_CLAUSE_PRESENT_OR_COPYOUT, > > + PRAGMA_OMP_CLAUSE_PRESENT_OR_CREATE, > > PRAGMA_OMP_CLAUSE_PRIVATE, > > PRAGMA_OMP_CLAUSE_PROC_BIND, > > PRAGMA_OMP_CLAUSE_REDUCTION, > > PRAGMA_OMP_CLAUSE_SAFELEN, > > PRAGMA_OMP_CLAUSE_SCHEDULE, > > PRAGMA_OMP_CLAUSE_SECTIONS, > > + PRAGMA_OMP_CLAUSE_SELF, > > PRAGMA_OMP_CLAUSE_SHARED, > > PRAGMA_OMP_CLAUSE_SIMDLEN, > > PRAGMA_OMP_CLAUSE_TASKGROUP, > > @@ -107,6 +131,8 @@ typedef enum pragma_omp_clause { > > PRAGMA_OMP_CLAUSE_TO, > > PRAGMA_OMP_CLAUSE_UNIFORM, > > PRAGMA_OMP_CLAUSE_UNTIED, > > + PRAGMA_OMP_CLAUSE_VECTOR_LENGTH, > > + PRAGMA_OMP_CLAUSE_WAIT, > > Like for CILK, I'd strongly prefer if for the clauses that are > specific to OpenACC only you'd use PRAGMA_OACC_CLAUSE_* instead, > and put them after the PRAGMA_CILK_* enum values. > If you want to have PRAGMA_OACC_CLAUSE_ aliases also for the > clauses shared in between OpenMP and OpenACC, feel free to add > aliases like Cilk+ has them. It is unfortunately lots of new clauses > and we are getting close to the 64 clauses limit :( when they are used > in bitmasks. I still don't like this very much, because we'll then get a "mess" of PRAGMA_OMP_CLAUSE_* intermixed with PRAGMA_OACC_CLAUSE_*. I understand, for example, PRAGMA_OMP_CLAUSE_REDUCTION to just be a "numeric representation" of the "reduction" string -- and then, it doesn't make too much sense to me to express this both as PRAGMA_OMP_CLAUSE_REDUCTION and PRAGMA_OACC_CLAUSE_REDUCTION, or, similarly, to switch back and forth between PRAGMA_OMP_CLAUSE_* and PRAGMA_OACC_CLAUSE_*. Yet, that's just the point that I'm making, so I'll defer if there's no consensus to be found here. Chung-Lin also had a suggestion to make; what do you think of this? --- c-family/c-common.h (revision 442892) +++ c-family/c-common.h (working copy) @@ -1076,138 +1076,17 @@ extern void pp_dir_change (cpp_reader *, const cha extern bool check_missing_format_attribute (tree, tree); /* In c-omp.c */ -#if HOST_BITS_PER_WIDE_INT >= 64 -typedef unsigned HOST_WIDE_INT omp_clause_mask; -# define OMP_CLAUSE_MASK_1 ((omp_clause_mask) 1) -#else -struct omp_clause_mask +#include <bitset> +typedef std::bitset<128> omp_clause_mask; +/* Provide '&' before full transition to set() method. */ +static inline omp_clause_mask +operator & (const omp_clause_mask& a, const omp_clause_mask& b) { - inline omp_clause_mask (); - inline omp_clause_mask (unsigned HOST_WIDE_INT l); - inline omp_clause_mask (unsigned HOST_WIDE_INT l, - unsigned HOST_WIDE_INT h); - inline omp_clause_mask &operator &= (omp_clause_mask); - inline omp_clause_mask &operator |= (omp_clause_mask); - inline omp_clause_mask operator ~ () const; - inline omp_clause_mask operator & (omp_clause_mask) const; - inline omp_clause_mask operator | (omp_clause_mask) const; - inline omp_clause_mask operator >> (int); - inline omp_clause_mask operator << (int); - inline bool operator == (omp_clause_mask) const; - inline bool operator != (omp_clause_mask) const; - unsigned HOST_WIDE_INT low, high; -}; - -inline -omp_clause_mask::omp_clause_mask () -{ + omp_clause_mask tmp = a; + return (tmp &= b); } +#define OMP_CLAUSE_MASK_1 (omp_clause_mask (1)) -inline -omp_clause_mask::omp_clause_mask (unsigned HOST_WIDE_INT l) -: low (l), high (0) -{ -} - -inline -omp_clause_mask::omp_clause_mask (unsigned HOST_WIDE_INT l, - unsigned HOST_WIDE_INT h) -: low (l), high (h) -{ -} - -inline omp_clause_mask & -omp_clause_mask::operator &= (omp_clause_mask b) -{ - low &= b.low; - high &= b.high; - return *this; -} - -inline omp_clause_mask & -omp_clause_mask::operator |= (omp_clause_mask b) -{ - low |= b.low; - high |= b.high; - return *this; -} - -inline omp_clause_mask -omp_clause_mask::operator ~ () const -{ - omp_clause_mask ret (~low, ~high); - return ret; -} - -inline omp_clause_mask -omp_clause_mask::operator | (omp_clause_mask b) const -{ - omp_clause_mask ret (low | b.low, high | b.high); - return ret; -} - -inline omp_clause_mask -omp_clause_mask::operator & (omp_clause_mask b) const -{ - omp_clause_mask ret (low & b.low, high & b.high); - return ret; -} - -inline omp_clause_mask -omp_clause_mask::operator << (int amount) -{ - omp_clause_mask ret; - if (amount >= HOST_BITS_PER_WIDE_INT) - { - ret.low = 0; - ret.high = low << (amount - HOST_BITS_PER_WIDE_INT); - } - else if (amount == 0) - ret = *this; - else - { - ret.low = low << amount; - ret.high = (low >> (HOST_BITS_PER_WIDE_INT - amount)) - | (high << amount); - } - return ret; -} - -inline omp_clause_mask -omp_clause_mask::operator >> (int amount) -{ - omp_clause_mask ret; - if (amount >= HOST_BITS_PER_WIDE_INT) - { - ret.low = high >> (amount - HOST_BITS_PER_WIDE_INT); - ret.high = 0; - } - else if (amount == 0) - ret = *this; - else - { - ret.low = (high << (HOST_BITS_PER_WIDE_INT - amount)) - | (low >> amount); - ret.high = high >> amount; - } - return ret; -} - -inline bool -omp_clause_mask::operator == (omp_clause_mask b) const -{ - return low == b.low && high == b.high; -} - -inline bool -omp_clause_mask::operator != (omp_clause_mask b) const -{ - return low != b.low || high != b.high; -} - -# define OMP_CLAUSE_MASK_1 omp_clause_mask (1) -#endif - enum c_omp_clause_split { C_OMP_CLAUSE_SPLIT_TARGET = 0, Grüße, Thomas
pgpJaZ6CFv2r6.pgp
Description: PGP signature