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

Georgios Rokos via Openmp-dev openmp-dev at lists.llvm.org
Fri Dec 1 11:56:10 PST 2017


Hi Daniel,

As Jonas said, support for declare target has not been upstreamed yet. I am
working on this right now. There is a Sema patch under review, once it gets
accepted I'll also upstream the codegen patch. Hopefully we'll get done
with this soon.

George



From:	Daniel Schürmann via Openmp-dev <openmp-dev at lists.llvm.org>
To:	openmp-dev <openmp-dev at lists.llvm.org>
Date:	01/12/2017 10:18
Subject:	[Openmp-dev] clang: Emit Target Functions when #pragma omp
            declare	target
Sent by:	"Openmp-dev" <openmp-dev-bounces at lists.llvm.org>



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
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_openmp-2Ddev&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=qJFsxTCvA8OSxFqEA7g0sy3-tW87hS-BunEYitahOog&m=itHoHX7egi7PhfIo-4Cm2EjWoZubgDZM8_HdvpD2Z7A&s=PEDqSA4pl3u1XF463qy7_rjTkbyNAlNQyU9Y_wB7VoQ&e=




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20171201/39b59820/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20171201/39b59820/attachment.gif>


More information about the Openmp-dev mailing list