[Mlir-commits] [mlir] [mlir][vector] Deal with special patterns when emulating masked load/store (PR #75587)

Hsiangkai Wang llvmlistbot at llvm.org
Tue Dec 19 08:44:35 PST 2023


Hsiangkai wrote:

For `vector.gather`, we have handled "all set" and "no set" special case in the pattern.
Refer to `mlir/lib/Dialect/Vector/IR/VectorOps.cpp`,

```
class GatherFolder final : public OpRewritePattern<GatherOp> {
public:
  using OpRewritePattern::OpRewritePattern;
  LogicalResult matchAndRewrite(GatherOp gather,
                                PatternRewriter &rewriter) const override {
    switch (getMaskFormat(gather.getMask())) {
    case MaskFormat::AllTrue:
      return failure(); // no unmasked equivalent
    case MaskFormat::AllFalse:
      rewriter.replaceOp(gather, gather.getPassThru());
      return success();
    case MaskFormat::Unknown:
      return failure();
    }
    llvm_unreachable("Unexpected 1DMaskFormat on GatherFolder");
  }
};
```

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


More information about the Mlir-commits mailing list