[Mlir-commits] [mlir] [mlir][Interfaces][NFC] Update doc of ViewLikeOpInterface parser/printer handlers (PR #122555)

Andrzej WarzyƄski llvmlistbot at llvm.org
Sun Jan 12 08:30:42 PST 2025


================
@@ -86,24 +86,46 @@ class OpWithOffsetSizesAndStridesConstantArgumentFolder final
   }
 };
 
-/// Printer hook for custom directive in assemblyFormat.
+/// Printer hooks for custom directive in assemblyFormat.
 ///
 ///   custom<DynamicIndexList>($values, $integers)
 ///   custom<DynamicIndexList>($values, $integers, type($values))
 ///
-/// where `values` is of ODS type `Variadic<*>` and `integers` is of ODS
-/// type `I64ArrayAttr`. Prints a list with either (1) the static integer value
-/// in `integers` is `kDynamic` or (2) the next value otherwise. If `valueTypes`
-/// is non-empty, it is expected to contain as many elements as `values`
-/// indicating their types. This allows idiomatic printing of mixed value and
-/// integer attributes in a list. E.g.
-/// `[%arg0 : index, 7, 42, %arg42 : i32]`.
-///
-/// Indices can be scalable. For example, "4" in "[2, [4], 8]" is scalable.
-/// This notation is similar to how scalable dims are marked when defining
-/// Vectors. For each value in `integers`, the corresponding `bool` in
-/// `scalables` encodes whether it's a scalable index. If `scalableVals` is
-/// empty then assume that all indices are non-scalable.
+/// where `values` is of ODS type `Variadic<*>` and `integers` is of ODS type
+/// `I64ArrayAttr`. Print a list where each element is either:
+///    1. the static integer value in `integers`, if it's not `kDynamic` or,
+///    2. the next value in `values`, otherwise.
+///
+/// If `valueTypes` is provided, the corresponding type of each dynamic value is
+/// printed. Otherwise, the type is not printed. Each type must match the type
+/// of the corresponding value in `values`. The type for integer elements is
+/// `i64` by default and never printed.
+///
+/// Integer indices can also be scalable, denoted with square brackets (e.g.,
----------------
banach-space wrote:

Would it make sense to add a note that "scalable index" makes only sense in the context of "scalable vectors"? It's very clear to _me_, but might be confusing to folks who don't work with `VectorType`.

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


More information about the Mlir-commits mailing list