[Mlir-commits] [mlir] [mlir][vector][spirv] Lower vector.load and vector.store to SPIR-V (PR #71674)
Lei Zhang
llvmlistbot at llvm.org
Wed Nov 8 21:39:16 PST 2023
================
@@ -509,6 +509,72 @@ struct VectorShuffleOpConvert final
}
};
+struct VectorLoadOpConverter final
+ : public OpConversionPattern<vector::LoadOp> {
+ using OpConversionPattern::OpConversionPattern;
+
+ LogicalResult
+ matchAndRewrite(vector::LoadOp loadOp, OpAdaptor adaptor,
+ ConversionPatternRewriter &rewriter) const override {
+ auto memrefType = loadOp.getMemRefType();
+ auto attr =
+ dyn_cast_or_null<spirv::StorageClassAttr>(memrefType.getMemorySpace());
+ if (!attr)
+ return failure();
----------------
antiagainst wrote:
It would be nice to add useful messages why matching is failure, like `return rewriter.notifyMatchFailure(loadOp, "expected spirv.storage_class memory space")`. Right now that's missing in other patterns due to historical reasons--the mechanims for doing this was added later after developing the patterns.
https://github.com/llvm/llvm-project/pull/71674
More information about the Mlir-commits
mailing list