[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Add thread_limit with dims modifier support (PR #171825)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 15 08:43:52 PST 2026


================
@@ -1452,15 +1452,53 @@ class OpenMP_ThreadLimitClauseSkip<
   > : OpenMP_Clause<traits, arguments, assemblyFormat, description,
                     extraClassDeclaration> {
   let arguments = (ins
-    Optional<AnyInteger>:$thread_limit
+    ConfinedAttr<OptionalAttr<I64Attr>, [IntPositive]>:$thread_limit_num_dims,
+    Variadic<IntLikeType>:$thread_limit_dims_values
   );
 
   let optAssemblyFormat = [{
-    `thread_limit` `(` $thread_limit `:` type($thread_limit) `)`
+    `thread_limit` `(` custom<ThreadLimitClause>(
+      $thread_limit_num_dims, $thread_limit_dims_values, type($thread_limit_dims_values)
+    ) `)`
   }];
 
   let description = [{
-    The optional `thread_limit` specifies the limit on the number of threads.
+    The `thread_limit` clause specifies the limit on the number of threads.
+
+    With dims modifier:
+    - The number of dimensions is specified by the `thread_limit_num_dims`.
+    - The values for each dimension are specified by the `thread_limit_dims_values`.
+    - Format: `thread_limit(dims(N): values : type)`
+    - Example: `thread_limit(dims(2): %n, %m : i64)`
----------------
skc7 wrote:

I tried the mlir syntax for these clauses to be close to openMP dims modifier syntax. I'm evaluating the changes required to remove the dims(N) syntax and just have list of values. Will post the patch.


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


More information about the llvm-branch-commits mailing list