[Mlir-commits] [clang] [llvm] [mlir] [OpenMP] Reserve the main thread's warp for generic mode kernels (PR #218790)
Larry Meadows
llvmlistbot at llvm.org
Sat Aug 29 09:11:11 PDT 2026
================
@@ -8582,6 +8596,15 @@ 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 &&
+ hasGridValue(T)) {
+ // An out-of-range bound is dropped rather than clamped, so clamp it here.
+ const omp::GV &GridValue = getGridValue(T, Kernel);
+ MaxThreadsVal = std::min(MaxThreadsVal + int32_t(GridValue.GV_Warp_Size),
+ int32_t(GridValue.GV_Max_WG_Size));
----------------
lfmeadow wrote:
Fixed: the addition is done in `int64_t` and clamped before narrowing back. Nothing about the computed values changes, so the clang, MLIR and OMPIRBuilder expectations are untouched.
https://github.com/llvm/llvm-project/pull/218790
More information about the Mlir-commits
mailing list