]> granicus.if.org Git - clang/commit
[OpenCL] Emit enqueued block as kernel
authorYaxun Liu <Yaxun.Liu@amd.com>
Sat, 14 Oct 2017 12:23:50 +0000 (12:23 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Sat, 14 Oct 2017 12:23:50 +0000 (12:23 +0000)
commit397c91b0034782f1f8dd7e7d6784a3be9fde0e68
tree3b4fa17e0e9e99924fe0d1765e3104e2f5536a89
parentad2da73ac3c4e576179e3aaf1be9f04ecea572c7
[OpenCL] Emit enqueued block as kernel

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 and
argument ABI.

This patch emits enqueued block as kernel. If a block is both called directly and passed
to enqueue_kernel, separate functions will be generated.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315804 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGBlocks.cpp
lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGOpenCLRuntime.cpp
lib/CodeGen/CGOpenCLRuntime.h
lib/CodeGen/CodeGenFunction.h
lib/CodeGen/CodeGenTypes.h
lib/CodeGen/TargetInfo.cpp
lib/CodeGen/TargetInfo.h
test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl [new file with mode: 0644]
test/CodeGenOpenCL/blocks.cl
test/CodeGenOpenCL/cl20-device-side-enqueue.cl