@@ -549,22 +549,26 @@ struct Strategy<TransferWriteOp> {
549
549
};
550
550
551
551
template <typename OpTy>
552
- LogicalResult checkPrepareXferOp (OpTy xferOp,
553
- VectorTransferToSCFOptions options) {
552
+ static LogicalResult checkPrepareXferOp (OpTy xferOp, PatternRewriter &rewriter ,
553
+ VectorTransferToSCFOptions options) {
554
554
if (xferOp->hasAttr (kPassLabel ))
555
- return failure ();
555
+ return rewriter.notifyMatchFailure (
556
+ xferOp, " kPassLabel is present (vector-to-scf lowering in progress)" );
556
557
if (xferOp.getVectorType ().getRank () <= options.targetRank )
557
- return failure ();
558
- // Currently the unpacking of the leading dimension into the memref is not
559
- // supported for scalable dimensions.
558
+ return rewriter.notifyMatchFailure (
559
+ xferOp, " xferOp vector rank <= transformation target rank" );
560
560
if (xferOp.getVectorType ().getScalableDims ().front ())
561
- return failure ();
561
+ return rewriter.notifyMatchFailure (
562
+ xferOp, " Unpacking of the leading dimension into the memref is not yet "
563
+ " supported for scalable dims" );
562
564
if (isTensorOp (xferOp) && !options.lowerTensors )
563
- return failure ();
564
- // Transfer ops that modify the element type are not supported atm.
565
+ return rewriter. notifyMatchFailure (
566
+ xferOp, " Unpacking for tensors has been disabled. " );
565
567
if (xferOp.getVectorType ().getElementType () !=
566
568
xferOp.getShapedType ().getElementType ())
567
- return failure ();
569
+ return rewriter.notifyMatchFailure (
570
+ xferOp, " Mismatching source and destination element types." );
571
+
568
572
return success ();
569
573
}
570
574
@@ -597,8 +601,9 @@ struct PrepareTransferReadConversion
597
601
598
602
LogicalResult matchAndRewrite (TransferReadOp xferOp,
599
603
PatternRewriter &rewriter) const override {
600
- if (checkPrepareXferOp (xferOp, options).failed ())
601
- return failure ();
604
+ if (checkPrepareXferOp (xferOp, rewriter, options).failed ())
605
+ return rewriter.notifyMatchFailure (
606
+ xferOp, " checkPrepareXferOp conditions not met!" );
602
607
603
608
auto buffers = allocBuffers (rewriter, xferOp);
604
609
auto *newXfer = rewriter.clone (*xferOp.getOperation ());
@@ -646,8 +651,9 @@ struct PrepareTransferWriteConversion
646
651
647
652
LogicalResult matchAndRewrite (TransferWriteOp xferOp,
648
653
PatternRewriter &rewriter) const override {
649
- if (checkPrepareXferOp (xferOp, options).failed ())
650
- return failure ();
654
+ if (checkPrepareXferOp (xferOp, rewriter, options).failed ())
655
+ return rewriter.notifyMatchFailure (
656
+ xferOp, " checkPrepareXferOp conditions not met!" );
651
657
652
658
Location loc = xferOp.getLoc ();
653
659
auto buffers = allocBuffers (rewriter, xferOp);
@@ -903,15 +909,17 @@ struct TransferOpConversion : public VectorToSCFPattern<OpTy> {
903
909
LogicalResult matchAndRewrite (OpTy xferOp,
904
910
PatternRewriter &rewriter) const override {
905
911
if (!xferOp->hasAttr (kPassLabel ))
906
- return failure ();
912
+ return rewriter.notifyMatchFailure (
913
+ xferOp, " kPassLabel is present (progressing lowering in progress)" );
907
914
908
915
// Find and cast data buffer. How the buffer can be found depends on OpTy.
909
916
ImplicitLocOpBuilder locB (xferOp.getLoc (), rewriter);
910
917
Value dataBuffer = Strategy<OpTy>::getBuffer (xferOp);
911
918
auto dataBufferType = dyn_cast<MemRefType>(dataBuffer.getType ());
912
919
FailureOr<MemRefType> castedDataType = unpackOneDim (dataBufferType);
913
920
if (failed (castedDataType))
914
- return failure ();
921
+ return rewriter.notifyMatchFailure (xferOp,
922
+ " Failed to unpack one vector dim." );
915
923
916
924
auto castedDataBuffer =
917
925
locB.create <vector::TypeCastOp>(*castedDataType, dataBuffer);
@@ -1294,16 +1302,14 @@ struct UnrollTransferReadConversion
1294
1302
xferOp, " vector rank is less or equal to target rank" );
1295
1303
if (failed (checkLowerTensors (xferOp, rewriter)))
1296
1304
return failure ();
1297
- // Transfer ops that modify the element type are not supported atm.
1298
1305
if (xferOp.getVectorType ().getElementType () !=
1299
1306
xferOp.getShapedType ().getElementType ())
1300
1307
return rewriter.notifyMatchFailure (
1301
1308
xferOp, " not yet supported: element type mismatch" );
1302
1309
auto xferVecType = xferOp.getVectorType ();
1303
1310
if (xferVecType.getScalableDims ()[0 ]) {
1304
- // Cannot unroll a scalable dimension at compile time.
1305
1311
return rewriter.notifyMatchFailure (
1306
- xferOp, " scalable dimensions cannot be unrolled" );
1312
+ xferOp, " scalable dimensions cannot be unrolled at compile time " );
1307
1313
}
1308
1314
1309
1315
auto insertOp = getInsertOp (xferOp);
0 commit comments