[PATCH] D38134: [OpenCL] Emit enqueued block as kernel
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 21 07:49:03 PDT 2017
yaxunl created this revision.
Herald added a subscriber: nhaehnle.
In OpenCL the kernel function and non-kernel function has different calling conventions.
For certain targets they have different argument ABIs. Also kernels have special function
attributes and metadata for runtime to launch them.
The blocks passed to enqueue_kernel is supposed to be executed as kernels. As such,
the block invoke function should be emitted as kernel with proper calling convention,
argument ABI, function attributes and metadata.
However, currently Clang does not emit enqueued blocks as kernels, which causes issues
such as address space of captured variables.
This patch emits enqueued block as kernel. If a block is both called directly and passed
to enqueue_kernel, separate functions will be generated.
https://reviews.llvm.org/D38134
Files:
lib/CodeGen/CGBlocks.cpp
lib/CodeGen/CGBlocks.h
lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGOpenCLRuntime.cpp
lib/CodeGen/CGOpenCLRuntime.h
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenFunction.h
lib/CodeGen/CodeGenTypes.h
lib/CodeGen/TargetInfo.cpp
lib/CodeGen/TargetInfo.h
test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
test/CodeGenOpenCL/blocks.cl
test/CodeGenOpenCL/cl20-device-side-enqueue.cl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38134.116186.patch
Type: text/x-patch
Size: 68989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170921/7bb1d4d0/attachment-0001.bin>
More information about the cfe-commits
mailing list