[llvm-branch-commits] [mlir] 762ffc9 - Update syntax for tensor and memref types to match parser.
Mehdi Amini via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 11 15:01:27 PST 2021
Author: Richard Uhler
Date: 2021-01-11T22:57:14Z
New Revision: 762ffc95550c32606e771b630fcab2e521873419
URL: https://github.com/llvm/llvm-project/commit/762ffc95550c32606e771b630fcab2e521873419
DIFF: https://github.com/llvm/llvm-project/commit/762ffc95550c32606e771b630fcab2e521873419.diff
LOG: Update syntax for tensor and memref types to match parser.
Based on the comments in lib/Parser/TypeParser.cpp on the
parseMemRefType and parseTensorType functions.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D94262
Added:
Modified:
mlir/docs/LangRef.md
mlir/lib/Parser/TypeParser.cpp
Removed:
################################################################################
diff --git a/mlir/docs/LangRef.md b/mlir/docs/LangRef.md
index 28962a8893ee..017ec02af7ae 100644
--- a/mlir/docs/LangRef.md
+++ b/mlir/docs/LangRef.md
@@ -929,15 +929,15 @@ Syntax:
```
memref-type ::= ranked-memref-type | unranked-memref-type
-ranked-memref-type ::= `memref` `<` dimension-list-ranked tensor-memref-element-type
+ranked-memref-type ::= `memref` `<` dimension-list-ranked type
(`,` layout-specification)? (`,` memory-space)? `>`
-unranked-memref-type ::= `memref` `<*x` tensor-memref-element-type
- (`,` memory-space)? `>`
+unranked-memref-type ::= `memref` `<*x` type (`,` memory-space)? `>`
stride-list ::= `[` (dimension (`,` dimension)*)? `]`
strided-layout ::= `offset:` dimension `,` `strides: ` stride-list
-layout-specification ::= semi-affine-map | strided-layout
+semi-affine-map-composition ::= (semi-affine-map `,` )* semi-affine-map
+layout-specification ::= semi-affine-map-composition | strided-layout
memory-space ::= integer-literal /* | TODO: address-space-id */
```
@@ -1201,10 +1201,8 @@ where its value does not have a defined dynamic representation.
Syntax:
```
-tensor-type ::= `tensor` `<` dimension-list tensor-memref-element-type `>`
-tensor-memref-element-type ::= vector-element-type | vector-type | complex-type
+tensor-type ::= `tensor` `<` dimension-list type `>`
-// memref requires a known rank, but tensor does not.
dimension-list ::= dimension-list-ranked | (`*` `x`)
dimension-list-ranked ::= (dimension `x`)*
dimension ::= `?` | decimal-literal
diff --git a/mlir/lib/Parser/TypeParser.cpp b/mlir/lib/Parser/TypeParser.cpp
index ab7f85a645e4..c258cc8b6d29 100644
--- a/mlir/lib/Parser/TypeParser.cpp
+++ b/mlir/lib/Parser/TypeParser.cpp
@@ -181,12 +181,14 @@ ParseResult Parser::parseStridedLayout(int64_t &offset,
/// memref-type ::= ranked-memref-type | unranked-memref-type
///
/// ranked-memref-type ::= `memref` `<` dimension-list-ranked type
-/// (`,` semi-affine-map-composition)? (`,`
-/// memory-space)? `>`
+/// (`,` layout-specification)? (`,` memory-space)? `>`
///
/// unranked-memref-type ::= `memref` `<*x` type (`,` memory-space)? `>`
///
+/// stride-list ::= `[` (dimension (`,` dimension)*)? `]`
+/// strided-layout ::= `offset:` dimension `,` `strides: ` stride-list
/// semi-affine-map-composition ::= (semi-affine-map `,` )* semi-affine-map
+/// layout-specification ::= semi-affine-map-composition | strided-layout
/// memory-space ::= integer-literal /* | TODO: address-space-id */
///
Type Parser::parseMemRefType() {
More information about the llvm-branch-commits
mailing list