================
@@ -1085,8 +1085,10 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const 
CGBlockInfo &blockInfo) {
       blockAddr.getPointer(), 
ConvertType(blockInfo.getBlockExpr()->getType()));
 
   if (IsOpenCL) {
-    CGM.getOpenCLRuntime().recordBlockInfo(blockInfo.BlockExpression, InvokeFn,
-                                           result, blockInfo.StructureType);
+    CGM.getOpenCLRuntime().recordBlockInfo(
+        blockInfo.BlockExpression, InvokeFn, result, blockInfo.StructureType,
+        CurGD && CurGD.isDeclOpenCLKernel() &&
+            (CurGD.getKernelReferenceKind() == KernelReferenceKind::Kernel));
----------------
lalaniket8 wrote:

> a kernel to kernel function call is replaced by a kernel to stub to kernel 
> call 

Calls to kernel (from device and kernel functions) is not supported during 
backend IselLowering : 
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp#L1127
So, we can't have a stub calling a kernel go into the backend.
In-lining the callee kernel body into the stub function might not be helpful in 
cases where callee kernel is just a function declaration.

> kernel is emitted first and then directly cloning the kernel body into the 
> stub

> emit kernels by emitting the stub and then directly cloning the function body 
> into the kernel

Some doubts on these points: Wouldn't this also result in having two copies of 
the kernel body ? Would this avoid the problems we see during double emission ?

https://github.com/llvm/llvm-project/pull/115821
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to