[PATCH] D120566: [OpenCL][AMDGPU]: Do not allow a call to kernel

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 25 07:19:28 PST 2022


arsenm added inline comments.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:9238
 
+static llvm::Function *getKernelClone(llvm::Function &F) {
+  llvm::Module *M = F.getParent();
----------------
I don't think we can really start with the function IR. The TargetABIInfo could be different from the kernel and function form (and will due to using byval/byref etc.)


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:9240
+  llvm::Module *M = F.getParent();
+  SmallString<128> MangledName("__amdgpu_");
+  MangledName.append(F.getName());
----------------
I don't think adding a prefix and suffix is a good strategy for something which in principle should be ABI visible. A period + suffix I think would be a better convention


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:9478-9479
+
+      CI->setCalledFunction(Clone);
+      CI->setCallingConv(llvm::CallingConv::C);
+    }
----------------
This is basically just moving what the current hack does into clang. Can we emit calls to the function version up front?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120566



More information about the cfe-commits mailing list