[PATCH] D61488: [OpenCL] Make global ctor init function a kernel

Kévin Petit via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 07:37:37 PDT 2019


kpet added inline comments.


================
Comment at: lib/CodeGen/CGDeclCXX.cpp:583
 
+  // In OpenCL global init function should be converted to the kernel to be
+  // able to initiate its execution from the host side.
----------------
functions
should be -> must be?
to the kernel -> to a kernel


================
Comment at: lib/CodeGen/CGDeclCXX.cpp:584
+  // In OpenCL global init function should be converted to the kernel to be
+  // able to initiate its execution from the host side.
+  // FIXME: Some more work might be needed to handle destructors correctly.
----------------
in order that they may be launched by the host?


================
Comment at: lib/CodeGen/CGDeclCXX.cpp:590
+  // dynamic resource allocation on the device and program scope variables are
+  // destroyed by the runtime when program is released.
+  if (getLangOpts().OpenCL) {
----------------
Agree that global destructors aren't that attractive a feature in most contexts. There are quite a few runtime issues with them too. We can think about this later.


================
Comment at: lib/CodeGen/CGDeclCXX.cpp:593
+    GenOpenCLArgMetadata(Fn);
+    Fn->setCallingConv(llvm::CallingConv::SPIR_FUNC);
+  }
----------------
Shouldn't the calling convention be SPIR_KERNEL if you want the function to be host-visible?


================
Comment at: lib/CodeGen/CodeGenModule.h:1322
+  /// used. This helper can be used to generate metadata for source code kernel
+  /// function as well as generated implicitly kernels. If kernel is generated
+  /// implicitly null value have to be passed to the last two parameter,
----------------
kernels generated implicitly
if a kernel | when a kernel


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61488/new/

https://reviews.llvm.org/D61488





More information about the cfe-commits mailing list