On 09/17/2014 01:49 AM, Jakub Jelinek wrote:
> On Wed, Sep 17, 2014 at 10:44:12AM +0200, Tobias Burnus wrote:
>> Cesar Philippidis wrote:
>>> The patch introduces the following OpenACC/PTX-specific built-ins:
>> ...
>>
>> It is not completely clear how they are supposed to get used. Should the
>> user call them directly in some cases? Or are they only used internally?
>>
>> acc_on_device sounds like a function which would be in C/C++ made available
>> to the user via #define acc_on_device __builtin_acc_on_device.
> 
> And not just providing acc_on_device prototype in some header?  Without
> looking at the OpenACC standard, it sounds like this function could be
> similar to omp_is_initial_device, so can and should be handled supposedly
> similarly.

All of the functions are internal except for acc_on_device. We do have a
proper interface for it, but it's part of the libgomp runtime. Should I
remove acc_on_device from this patch until the runtime is ready?

>> However, the rest looks as if it should rather be an internal function
>> instead of a builtin. Or should the user really ever call the builtin
>> directly?
> 
> GOMP_* functions are builtins and not internal functions too, all those
> functions are library functions, while the user typically doesn't call them
> directly, they still are implemented in the library.  Internal functions are
> used for something that doesn't have a library implementation and is not
> something user can call directly.

All of the GOACC_* functions introduced in this patch are internal
functions without library functions, although that may change for
GOACC_get_thread_num and GOACC_get_num_threads. Is there a better way to
handle internal functions or is it correct as-is? I'm not that familiar
with built-in functions.

>> Regarding Fortran: Builtins aren't directly available to the user. You have 
>> to
>> wrap them into an intrinsic to make them available. If they have to be made
>> available via a module (e.g. via "module acc) - you have to create a virtual
>> module, which provides the intrinsic. If you don't want to convert the whole
>> module, you could create an auxiliar module (e.g. acc_internal_) which 
>> provides
>> only those bits - and then include it ("use,intrinsic :: ...") it in the
>> main module - written in normal Fortran.
> 
> For the user callable fortran functions, for OpenMP libgomp just provides
> *_ entrypoints to * functions.  Perhaps acc_on_device_ could be provided
> too.

Cesar

Reply via email to