hfinkel added a comment.

In D61399#1488309 <https://reviews.llvm.org/D61399#1488309>, @ABataev wrote:

> In D61399#1488299 <https://reviews.llvm.org/D61399#1488299>, @hfinkel wrote:
>
> > In D61399#1488262 <https://reviews.llvm.org/D61399#1488262>, @ABataev wrote:
> >
> > > I don't like this implementation. Seems to me, it breaks one of the 
> > > OpenMP standard requirements: the program can be compiled without openmp 
> > > support. I assume, that with this includes the program won't be able to 
> > > be compiled without OpenMP support anymore because it may use some 
> > > device-specific math functions explicitly.
> > >  Instead, I would like to see some additional, device-scpecific math 
> > > header file, that must be included explicitly to support some 
> > > device-specific math functions. And we need to provide default 
> > > implementations for those extra math functions for all the platforms 
> > > we're going to support, including default host implementations.
> >
> >
> > Can you provide an example of a conforming program that can't be compiled 
> > without OpenMP support? Regardless of the use of any device-specific 
> > functions (which isn't covered by the standard, of course, but might be 
> > needed in practice), the code still needs to be compilable by the host in 
> > order to generate the host-fallback version. This doesn't change that. 
> > Thus, any program that uses anything from this math.h, etc. needs to 
> > compile for the host, and thus, likely compiles without OpenMP support. 
> > Maybe I'm missing your point, however.
>
>
> Assume we have something like this:
>
>   #pragma omp target if(cond)
>   a = __nv_xxxx(....);
>
>
> Instead of `__nv_xxx` you can try to use any Cuda-specific function, which is 
> not the part of the standard `math.h`/`cmath` files. Will it be compilable 
> even with OpenMP?


I don't think that this changes that one way or the other. Your example won't 
work, AFAIK, unless you do something like:

  #pragma omp target if(cond)
  #ifdef __NVPTX__
  a = __nv_xxxx(....);
  #else
  a = something_on_the_host;
  #endif

and anything from these headers that doesn't also have a host version will 
suffer the same fate: if it won't also compile for the host (one way or 
another), then it won't work.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61399/new/

https://reviews.llvm.org/D61399



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to