[llvm-branch-commits] [mlir] [OpenMP][MLIR] Add thread_limit mlir->llvm lowering (PR #179608)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 8 06:02:32 PDT 2026


================
@@ -6232,33 +6243,45 @@ initTargetDefaultAttrs(omp::TargetOp targetOp, Operation *capturedOp,
       result = 0;
   };
 
-  // Extract 'thread_limit' clause from 'target' and 'teams' directives.
-  int32_t targetThreadLimitVal = -1, teamsThreadLimitVal = -1;
-  if (!targetOp.getThreadLimitVars().empty())
-    setMaxValueFromClause(targetOp.getThreadLimit(0), targetThreadLimitVal);
-  setMaxValueFromClause(threadLimit, teamsThreadLimitVal);
+  // Extract multi-dimensional 'thread_limit' clause from 'target' and 'teams'.
+  llvm::SmallVector<int32_t, 3> targetThreadLimitVals(3, -1);
----------------
skatrak wrote:

Nit: I'd suggest not hardcoding the maximum number of supported dims so early. It wouldn't take any more effort to accept `n` dims and it'd probably even simplify the code below. The TODO for `dims > 3` will trigger before reaching this, so we're not risking passing a larger array to the OMPIRBuilder that it might not be prepared to handle.

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


More information about the llvm-branch-commits mailing list