[Mlir-commits] [mlir] [MLIR][OpenMP]Add prescriptiveness-modifier support to grainsize and … (PR #128477)

Sergio Afonso llvmlistbot at llvm.org
Wed Feb 26 09:05:42 PST 2025


================
@@ -472,6 +472,99 @@ static void printOrderClause(OpAsmPrinter &p, Operation *op,
     p << stringifyClauseOrderKind(order.getValue());
 }
 
+template <typename ClauseTypeAttr, typename ClauseType>
+static ParseResult
+parseGranularityClause(OpAsmParser &parser, ClauseTypeAttr &prescriptiveness,
+                       std::optional<OpAsmParser::UnresolvedOperand> &operand,
+                       Type &operandType,
+                       std::optional<ClauseType> (*symbolizeClause)(StringRef),
+                       StringRef clauseName) {
+  StringRef enumStr;
+  if (succeeded(parser.parseOptionalKeyword(&enumStr))) {
+    if (std::optional<ClauseType> enumValue = symbolizeClause(enumStr)) {
+      prescriptiveness = ClauseTypeAttr::get(parser.getContext(), *enumValue);
+      if (parser.parseColon())
----------------
skatrak wrote:

Not a blocking request, but have you considering using a comma instead here? In my opinion, that would look cleaner:
```mlir
omp.taskloop grainsize(strict, %xyz : i64) { ... }
```
Otherwise, using the same character to separate the modifier from the value and the value from the type seems a bit odd to me.

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


More information about the Mlir-commits mailing list