[Mlir-commits] [mlir] [mlir][vector][spirv] Lower vector.transfer_read and vector.transfer_write to SPIR-V (PR #69708)

Lei Zhang llvmlistbot at llvm.org
Fri Oct 27 09:36:47 PDT 2023


================
@@ -509,6 +509,87 @@ struct VectorShuffleOpConvert final
   }
 };
 
+struct VectorTransferReadOpConverter final
+    : public OpConversionPattern<vector::TransferReadOp> {
+  using OpConversionPattern::OpConversionPattern;
+
+  LogicalResult
+  matchAndRewrite(vector::TransferReadOp transferReadOp, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    if (transferReadOp.getMask())
+      return rewriter.notifyMatchFailure(transferReadOp,
+                                         "unsupported transfer_read with mask");
+    auto sourceType = transferReadOp.getSource().getType();
+    if (!llvm::isa<MemRefType>(sourceType))
+      return rewriter.notifyMatchFailure(transferReadOp, "not a memref source");
+
----------------
antiagainst wrote:

We also need to consider the cases where `in_bounds` is false.

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


More information about the Mlir-commits mailing list