[Mlir-commits] [mlir] [MLIR] extend `getCompressedMaskOp` support in `VectorEmulateNarrowType` (PR #116122)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Nov 14 14:47:37 PST 2024


================
@@ -104,10 +104,14 @@ static FailureOr<Operation *> getCompressedMaskOp(OpBuilder &rewriter,
   if (createMaskOp) {
     OperandRange maskOperands = createMaskOp.getOperands();
     size_t numMaskOperands = maskOperands.size();
+    // The `vector.create_mask` op creates a mask arrangement without any zeros
+    // at the front. Also, because `numFrontPadElems` is strictly smaller than
+    // `numSrcElemsPerDest`, the compressed mask generated by shifting the
+    // original mask by `numFrontPadElems` will not have any zeros at the front
+    // as well.
----------------
lialan wrote:

The shifting happens when you pad `numFrontPadElems` to the mask so each individual mask value points to its correct element.

The shifting (to the right) is done by adding `numFrontPadElems` to the `ceildiv` in the affine expression. namely:
`s0 = (s0 + numFrontPadElems).ceilDiv(numSrcElemsPerDest);`

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


More information about the Mlir-commits mailing list