This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, PR82428] Add __builtin_goacc_{gang,worker,vector}_{id,size}


On 01/15/2018 11:44 AM, Jakub Jelinek wrote:
On Mon, Jan 15, 2018 at 11:39:28AM +0100, Tom de Vries wrote:
Does OpenACC have some term for the 3 dimensions/kinds of parallelism?

openacc spec: "OpenACC exposes these three levels of parallelism via gang,
worker and vector parallelism."

So, maybe we abbreviate to: 'parlevel' or 'par_level'?

Is there some enum describing those 3 already?

There's no enum type in openacc.h or gomp-constants.h.

There's an enumeration of int constants from gomp-constants.h:
...
#define GOMP_DIM_GANG   0
#define GOMP_DIM_WORKER 1
#define GOMP_DIM_VECTOR 2
...
which I'm currently using as argument.

Given the amount of trouble that having an enum type as argument for
acc_on_device has given us, I'm not sure that we want an enum type as
argument for these builtins. [ See the comments and kludge related to c++ in
the https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01529.html patch for
PR82391 Fold acc_on_device with const arg. ]

Sure, the argument to the builtin should be just int.

Right.

 I'm talking about
what would users use and what would be documented in extend.texi.

And that is precisely my concern. Say that we define:
...
enum goacc_parlevel_t { gang = 0, worker = 1, vector = 2 };
...
and define as interface:
...
int __builtin_goacc_parlevel_id (enum goacc_parlevel_t);
...
but define the builtin with int argument.

Then we run into the same trouble as for acc_on_device: in c++ the __builtin_goacc_parlevel_id (enum goacc_parlevel_t) does not map onto the __builtin_goacc_parlevel_id (int), and we need to employ a kludge to make it so (the current kludge for acc_on_device is the inline function in openacc.h. The patch mentioned above replaces that kludge with another one: testing for name and signature of the function).

It can be just number of course.  parlevel is fine for me.


So, in summary, I propose as interface:
- int __builtin_goacc_parlevel_id (int);
- int __builtin_goacc_parlevel_size (int);
with arguments 0, 1, and 2 meaning gang, worker and vector.

Thanks,
- Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]