[Mlir-commits] [mlir] 1a6ffd7 - [mlir][vector] NFC - Add rewriter.notifyMatchFailure messages for better debugging
Nicolas Vasilache
llvmlistbot at llvm.org
Thu Sep 8 15:03:07 PDT 2022
Author: Nicolas Vasilache
Date: 2022-09-08T15:02:56-07:00
New Revision: 1a6ffd77816350b546d0eff680d678f9ca6108de
URL: https://github.com/llvm/llvm-project/commit/1a6ffd77816350b546d0eff680d678f9ca6108de
DIFF: https://github.com/llvm/llvm-project/commit/1a6ffd77816350b546d0eff680d678f9ca6108de.diff
LOG: [mlir][vector] NFC - Add rewriter.notifyMatchFailure messages for better debugging
Add rewriter.notifyMatchFailure messages for better debugging
Differential Revision: https://reviews.llvm.org/D133532
Added:
Modified:
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
index 8c6eae1dfb73d..8c3d3e9bc6b15 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
@@ -2184,36 +2184,50 @@ struct TransferWriteToVectorStoreLowering
LogicalResult matchAndRewrite(vector::TransferWriteOp write,
PatternRewriter &rewriter) const override {
if (maxTransferRank && write.getVectorType().getRank() > *maxTransferRank)
- return failure();
+ return rewriter.notifyMatchFailure(write.getLoc(), [=](Diagnostic &diag) {
+ diag << "rank exceeds maxTransferRank: " << write;
+ });
// Permutations are handled by VectorToSCF or
// populateVectorTransferPermutationMapLoweringPatterns.
if ( // pass-through for the 0-d corner case.
!write.getPermutationMap().isMinorIdentity())
- return failure();
+ return rewriter.notifyMatchFailure(write.getLoc(), [=](Diagnostic &diag) {
+ diag << "permutation map is not minor identity: " << write;
+ });
auto memRefType = write.getShapedType().dyn_cast<MemRefType>();
if (!memRefType)
- return failure();
+ return rewriter.notifyMatchFailure(write.getLoc(), [=](Diagnostic &diag) {
+ diag << "not a memref type: " << write;
+ });
// Non-unit strides are handled by VectorToSCF.
if (!vector::isLastMemrefDimUnitStride(memRefType))
- return failure();
+ return rewriter.notifyMatchFailure(write.getLoc(), [=](Diagnostic &diag) {
+ diag << "most minor stride is not 1: " << write;
+ });
// `vector.store` supports vector types as memref's elements only when the
// type of the vector value being written is the same as the element type.
auto memrefElTy = memRefType.getElementType();
if (memrefElTy.isa<VectorType>() && memrefElTy != write.getVectorType())
- return failure();
+ return rewriter.notifyMatchFailure(write.getLoc(), [=](Diagnostic &diag) {
+ diag << "elemental type mismatch: " << write;
+ });
// Otherwise, element types of the memref and the vector must match.
if (!memrefElTy.isa<VectorType>() &&
memrefElTy != write.getVectorType().getElementType())
- return failure();
+ return rewriter.notifyMatchFailure(write.getLoc(), [=](Diagnostic &diag) {
+ diag << "elemental type mismatch: " << write;
+ });
// Out-of-bounds dims are handled by MaterializeTransferMask.
if (write.hasOutOfBoundsDim())
- return failure();
+ return rewriter.notifyMatchFailure(write.getLoc(), [=](Diagnostic &diag) {
+ diag << "out of bounds dim: " << write;
+ });
if (write.getMask()) {
rewriter.replaceOpWithNewOp<vector::MaskedStoreOp>(
write, write.getSource(), write.getIndices(), write.getMask(),
More information about the Mlir-commits
mailing list