[Openmp-dev] clang: Emit Target Functions when #pragma omp declare target

Jonas Hahnfeld via Openmp-dev openmp-dev at lists.llvm.org
Fri Dec 1 07:30:25 PST 2017


Hi Daniel,

I think Clang trunk doesn't yet have full codegen support for the 
declare target directive. Please see https://reviews.llvm.org/D39457 for 
a document with the current implementation status.

Regards,
Jonas

Am 2017-12-01 10:18, schrieb Daniel Schürmann via Openmp-dev:
> Hello!
> 
> I wanted to ask, if this behavior is on purpose or if I am missing 
> something:
> 
> To me it seems that using "#pragma omp declare target" has no effect
> on the code generation.
> The specification states that variables and functions are mapped to the 
> device.
> In my understanding, this means that device code should be emitted.
> 
> However, CGOpenMPRuntime::emitTargetGlobal() does only search for
> target #pragmas and doesn't check for OMPDeclareTargetDeclAttr. This
> check is done in ASTContext::DeclMustBeEmitted(), but it seems, this
> can never happen. The reason is that CodeGenModule::EmitGlobal()
> returns early after calling CGOpenMPRuntime::emitTargetGlobal(). I
> hope, this is understandable.
> 
> It might be that this problem never showed up when the device is x86
> as well. But I don't understand how Nvidia can compile e.g. lulesh
> like this...
> 
> My question is if the intended way would be to change
> emitTargetGlobal() to also emit functions/variables with
> OMPDeclareTargetDeclAttr.
> 
> Thanks in advance,
> Daniel
> 
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list