[clang] [llvm] [mlir] [OpenMP] Reserve the main thread's warp for generic mode kernels (PR #218790)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 14:04:23 PDT 2026


================
@@ -8587,6 +8601,18 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createTargetInit(
     }
   }
 
+  // Generic mode runs the main thread on a warp of its own, past thread_limit.
+  if (MaxThreadsVal > 0 && Attrs.ExecFlags == omp::OMP_TGT_EXEC_MODE_GENERIC &&
----------------
jhuber6 wrote:

I feel like we should just pessimistically append the maximum workgroup size, simplify this heavily so all we do is round up the attribute by `+64`. I feel like this could be a handful of lines here instead and I don't think it will make much of a difference. Maybe worth checking afterwards if the SPMD optimization in OpenMPOpt can undo that, but  I'd prefer to keep it simple.

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


More information about the llvm-commits mailing list