On Wed, Jun 29, 2016 at 04:11:31PM +0200, Thomas Schwinge wrote: > > >> Actually, I relaxed non-acc routines by excluding > > >> calls to builtin functions, including those prefixed with _gfortran_. > > >> Nvptx does have a newlib c library, and it also has a subset of > > >> libgfortran. Still, this solution is probably not optimal. > > > > > > I don't really like that, hardcoding prefixes or whatever is available > > > (you have quite some subset of libc, libm etc. available too) in the > > > compiler looks very hackish. What is wrong with complaining during > > > linking of the offloaded code? > > ACK. Jakub, do I understand you correctly, that you basically say that > every function declaration that is in scope inside offloaded regions (for > example, GCC builtin functions, or standard library functions declared in > target compiler's header files) is permitted to be called in offloaded > regions, and the offloading compiler will then either be able to resolve > these (nvptx back end knows about trigonometric functions, for example, > and a lot of functions are available in the nvptx libc), or otherwise > error out during the offloading compilation (during linking), gracefully > without terminating the target compilation (that "gracefully" bit is > currently missing -- that's for another day). That is, all such > functions are implicitly callable as OpenACC "seq" functions (which means > that they don't internally use gang/worker/vector parallelism). In > particular, all these functions do *not* need to be marked with an > explicit "#pragma acc routine seq" directive. (Functions internally > using gang/worker/vector parallelism will need to be marked > appropriately, using a "#pragma acc routine gang/worker/vector" > directive.) That's how I understand your comment above, and your earlier > comments on this topic, and also is what I think should be done.
Yes. Well, OpenMP doesn't have different kinds of target functions, just one. And at least the current spec doesn't require that target regions or declare target functions only call functions declared target, I guess mainly because that would require that all the C/C++ headers are OpenMP aware and declare everything that has the offloading counterpart. For user code, of course users have to declare their routines, otherwise it just can't be offloaded, and the implementation runtime is a very fuzzy thing outside of the standard. Jakub