[clang] [llvm] [OpenMP] Ensure the actual kernel is annotated with launch bounds (PR #99927)

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 13:20:09 PDT 2024


================
@@ -4569,7 +4569,17 @@ OpenMPIRBuilder::createTargetInit(const LocationDescription &Loc, bool IsSPMD,
   Constant *MayUseNestedParallelismVal = ConstantInt::getSigned(Int8, true);
   Constant *DebugIndentionLevelVal = ConstantInt::getSigned(Int16, 0);
 
-  Function *Kernel = Builder.GetInsertBlock()->getParent();
+  Function *DebugKernelWrapper = Builder.GetInsertBlock()->getParent();
+  Function *Kernel = DebugKernelWrapper;
+
+  // We need to strip the debug prefix to get the correct kernel name.
+  StringRef KernelName = Kernel->getName();
+  const std::string DebugPrefix = "_debug__";
+  if (KernelName.ends_with(DebugPrefix)) {
----------------
jdoerfert wrote:

It's tricky. Honestly, I don't think the wrapper is a great idea, but I want us to not miss out on the performance for debug builds in the next release.

https://github.com/llvm/llvm-project/pull/99927


More information about the llvm-commits mailing list