[Mlir-commits] [mlir] [mlir][vector][spirv] Lower vector.transfer_read and vector.transfer_write to SPIR-V (PR #69708)
Kai Wang
llvmlistbot at llvm.org
Tue Oct 31 07:35:52 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");
+
+ auto memrefType = cast<MemRefType>(sourceType);
+ const auto &typeConverter = *getTypeConverter<SPIRVTypeConverter>();
+ auto loc = transferReadOp.getLoc();
+ Value accessChain =
+ spirv::getElementPtr(typeConverter, memrefType, adaptor.getSource(),
----------------
Hsiangkai wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/69708
More information about the Mlir-commits
mailing list