[Openmp-dev] clang: Emit Target Functions when #pragma omp declare target
Daniel Schürmann via Openmp-dev
openmp-dev at lists.llvm.org
Fri Dec 1 07:18:21 PST 2017
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
More information about the Openmp-dev
mailing list