================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits