[PATCH] D38134: [OpenCL] Emit enqueued block as kernel

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 08:53:03 PDT 2017

yaxunl added a comment.

In https://reviews.llvm.org/D38134#895848, @Anastasia wrote:

> I think it would be good to add a block test to CodeGenOpenCL where we would just call the block without any enqueue and check that the invoke function is generated but the kernel wrapper isn't.

we have test/CodeGenOpenCL/blocks.cl which only calls a block. I can add check to make sure no kernels generated.

Comment at: lib/CodeGen/CGBuiltin.cpp:2846
+          PtrToSizeArray};
+      std::vector<llvm::Type *> ArgTys = {QueueTy,
+                                          IntTy,
Anastasia wrote:
> Formatting seems inconsistent from above.
Will fix.

Comment at: lib/CodeGen/CodeGenFunction.h:2921
-  /// Helpers for blocks
-  llvm::Value *EmitBlockLiteral(const CGBlockInfo &Info);
+  /// Helpers for blocks. Returns invoke function by \p InvokeF if it is not
+  /// nullptr.
Anastasia wrote:
> It will be nullptr in case block is not enqueued? May be it's worth explaining it in the comment.
Will do.

Comment at: lib/CodeGen/TargetInfo.h:290
+  /// Create an OpenCL kernel for an enqueued block.
+  virtual llvm::Function *
Anastasia wrote:
> Can we also explain the wrapper kernel here?
Will do.


More information about the cfe-commits mailing list