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). The target code can perhaps be done by streaming LTO IL for the target device into special sections during normal compilation and a linker plugin invoked for -fopenmp could then collect those if any, compile the code with a different backend and link both the host program and whatever is needed for the target device. Jakub