[flang] [llvm] [mlir] [OpenMP][MLIR] Add num_teams clause with dims modifier support (PR #169883)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 21:19:01 PST 2026


================
@@ -2634,6 +2635,35 @@ void TeamsOp::build(OpBuilder &builder, OperationState &state,
                  clauses.threadLimit);
 }
 
+// Verify num_teams clause
+static LogicalResult verifyNumTeamsClause(Operation *op,
+                                          OperandRange numTeamsVars,
+                                          Value numTeamsLower,
+                                          Value numTeamsUpper) {
+  bool hasLegacyOperands = numTeamsLower || numTeamsUpper;
+
+  // Cannot use both multi-dimensional and legacy format simultaneously
+  if (!numTeamsVars.empty() && hasLegacyOperands) {
+    return op->emitError()
+           << "num_teams multi-dimensional values cannot be used together with "
+              "legacy lower/upper bounds";
+  }
+
+  // If lower is specified, upper must also be specified
+  if (numTeamsLower) {
----------------
skc7 wrote:

Added the check for numTeamsUpperVars.size() != 1

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


More information about the llvm-commits mailing list