[AMDGPU] Fix lowering enqueue_kernel
authorYaxun Liu <Yaxun.Liu@amd.com>
Wed, 11 Apr 2018 14:46:15 +0000 (14:46 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Wed, 11 Apr 2018 14:46:15 +0000 (14:46 +0000)
commit9381ae9791d57dd09fa10c22d52a17ca2bbcd4b2
treebf8c73e25d171d2d6f509c9fbd925493a0e23e91
parent2f326d453feea698996c1c3f104a92e4354cd40f
[AMDGPU] Fix lowering enqueue_kernel

Two issues were fixed:

runtime has difficulty to allocate memory for an external symbol of a
kernel and set the address of the external symbol, therefore make the runtime
handle of an enqueued kernel an ordinary global variable. Runtime only needs
to store the address of the loaded kernel to the handle and has verified
that this approach works.

handle the situation where __enqueue_kernel* gets inlined therefore
the enqueued kernel may be used through a constant expr instead
of an instruction.

Differential Revision: https://reviews.llvm.org/D45187

llvm-svn: 329815
llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp
llvm/test/CodeGen/AMDGPU/enqueue-kernel.ll