[Mlir-commits] [mlir] [mlir][vector] Update syntax and representation of insert/extract_strided_slice (PR #101850)
Benjamin Maxwell
llvmlistbot at llvm.org
Tue Aug 6 11:14:04 PDT 2024
================
@@ -82,4 +87,63 @@ def Vector_PrintPunctuation : EnumAttr<Vector_Dialect, PrintPunctuation, "punctu
let assemblyFormat = "`<` $value `>`";
}
+def Vector_StridedSliceAttr : Vector_Attr<"StridedSlice", "strided_slice">
+{
+ let summary = "strided vector slice";
+
+ let description = [{
+ An attribute that represents a strided slice of a vector.
+
+ *Syntax:*
+
+ ```
+ offset = integer-literal
+ stride = integer-literal
+ size = integer-literal
+ offset-list = offset (`,` offset)*
+
+ // Without sizes (used for insert_strided_slice)
+ strided-slice-without-sizes = offset-list? (`[` offset `:` stride `]`)+
+
+ // With sizes (used for extract_strided_slice)
+ strided-slice-with-sizes = (`[` offset `:` size `:` stride `]`)+
+ ```
+
+ *Examples:*
+
+ Without sizes:
+
+ `[0:1][4:2]`
+
+ - The first dimension starts at offset 0 and is strided by 1
+ - The second dimension starts at offset 4 and is strided by 2
+
+ `[0, 1, 2][3:1][4:8]`
----------------
MacDue wrote:
I realised I could preserve the old syntax pretty much exactly with a custom `assemblyFormat`. Updated the patch now.
https://github.com/llvm/llvm-project/pull/101850
More information about the Mlir-commits
mailing list