[Mlir-commits] [mlir] [mlir] Add optional layout attribute to VectorType (PR #71916)

Thomas Raoux llvmlistbot at llvm.org
Fri Nov 10 09:40:49 PST 2023


================
@@ -459,14 +459,38 @@ VectorType Parser::parseVectorType() {
   // Parse the element type.
   auto typeLoc = getToken().getLoc();
   auto elementType = parseType();
-  if (!elementType || parseToken(Token::greater, "expected '>' in vector type"))
+  if (!elementType)
     return nullptr;
 
   if (!VectorType::isValidElementType(elementType))
     return emitError(typeLoc, "vector elements must be int/index/float type"),
            nullptr;
 
-  return VectorType::get(dimensions, elementType, scalableDims);
+  VectorLayoutAttrInterface layout;
+  auto parseElt = [&]() -> ParseResult {
+    Attribute attr = parseAttribute();
+    if (!attr)
+      return failure();
+    if (isa<VectorLayoutAttrInterface>(attr)) {
+      layout = cast<VectorLayoutAttrInterface>(attr);
+    }
+    return success();
+  };
+
+  // Parse a list of mappings and address space if present.
+  if (!consumeIf(Token::greater)) {
+    // Parse comma separated list of affine maps, followed by memory space.
----------------
ThomasRaoux wrote:

those comments look out of date.

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


More information about the Mlir-commits mailing list