On Tue, 2013-05-07 at 17:34 +0200, Jakub Jelinek wrote: > On Tue, May 07, 2013 at 11:02:08AM +0200, Tobias Burnus wrote: > > Richard Biener wrote: > > >We're going to look at supporting HSA from GCC (which would make > > >it more or less trivial to also target openCL I think) > > > > For the friends of link-time optimization (LTO): > > > > Unless I missed some fine point in OpenACC and OpenMP's target, they > > only work with directives which are locally visible. Thus, if one > > does a function call in the device/target section, it can only be > > placed on the accelerator if the function can be inlined. > > No, OpenMP 4.0 has > #pragma omp declare target > ... > #pragma omp end declare target > where you can define/declare functions and variables in that ... and those > are all marked for cloning for the target device (guess parsing of > the above construct is going to just add "omp declare target" attribute > to all those variables/functions and we'd then just clone the functions > and map the variables into the target code).
Additional examples of such "special" functions are (1) the OpenMP / Cilk+ SIMD functions (aka "elemental functions), for which programmers make assertions such as that they can do with weaker forward progress guarantees (eg, no locks in SIMD code), and (2) transaction-safe functions for TM (but there the programmer doesn't make an assertion, but a requirement. Both might or might not need special code being generated. OpenACC 2.0 also proposes a similar feature (but the description didn't seem like a finished spec back when I read it). So, this isn't just about accelerators. Torvald