[Mlir-commits] [mlir] [MLIR] support dynamic indexing in `VectorEmulateNarrowTypes` (PR #114169)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Nov 1 02:53:33 PDT 2024


================
@@ -129,9 +128,17 @@ static FailureOr<Operation *> getCompressedMaskOp(OpBuilder &rewriter,
   return newMask;
 }
 
+/// A wrapper function for emitting `vector.extract_strided_slice`. The vector
+/// has to be of 1-D shape.
 static Value extractSubvectorFrom(RewriterBase &rewriter, Location loc,
                                   VectorType extractType, Value vector,
                                   int64_t frontOffset, int64_t subvecSize) {
+  auto vectorType = dyn_cast<VectorType>(vector.getType());
+  assert(vectorType && "expected vector type");
+  assert(vectorType.getShape().size() == 1 && "expected 1-D vector type");
+  assert(extractType.getShape().size() == 1 &&
+         "extractType must be 1-D vector type");
----------------
banach-space wrote:

```suggestion
  assert((vectorType && vectorType.getRank() == 1 && extractType.getRank() == 1)  && "expected 1-D source and destination types");
```

I _think_ that this should work :) 

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


More information about the Mlir-commits mailing list