@@ -549,22 +549,26 @@ struct Strategy<TransferWriteOp> {
549549};
550550
551551template <typename OpTy>
552- LogicalResult checkPrepareXferOp (OpTy xferOp,
553- VectorTransferToSCFOptions options) {
552+ static LogicalResult checkPrepareXferOp (OpTy xferOp, PatternRewriter &rewriter ,
553+ VectorTransferToSCFOptions options) {
554554 if (xferOp->hasAttr (kPassLabel ))
555- return failure ();
555+ return rewriter.notifyMatchFailure (
556+ xferOp, " kPassLabel is present (vector-to-scf lowering in progress)" );
556557 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" );
560560 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" );
562564 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. " );
565567 if (xferOp.getVectorType ().getElementType () !=
566568 xferOp.getShapedType ().getElementType ())
567- return failure ();
569+ return rewriter.notifyMatchFailure (
570+ xferOp, " Mismatching source and destination element types." );
571+
568572 return success ();
569573}
570574
@@ -597,8 +601,9 @@ struct PrepareTransferReadConversion
597601
598602 LogicalResult matchAndRewrite (TransferReadOp xferOp,
599603 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!" );
602607
603608 auto buffers = allocBuffers (rewriter, xferOp);
604609 auto *newXfer = rewriter.clone (*xferOp.getOperation ());
@@ -646,8 +651,9 @@ struct PrepareTransferWriteConversion
646651
647652 LogicalResult matchAndRewrite (TransferWriteOp xferOp,
648653 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!" );
651657
652658 Location loc = xferOp.getLoc ();
653659 auto buffers = allocBuffers (rewriter, xferOp);
@@ -903,15 +909,17 @@ struct TransferOpConversion : public VectorToSCFPattern<OpTy> {
903909 LogicalResult matchAndRewrite (OpTy xferOp,
904910 PatternRewriter &rewriter) const override {
905911 if (!xferOp->hasAttr (kPassLabel ))
906- return failure ();
912+ return rewriter.notifyMatchFailure (
913+ xferOp, " kPassLabel is present (progressing lowering in progress)" );
907914
908915 // Find and cast data buffer. How the buffer can be found depends on OpTy.
909916 ImplicitLocOpBuilder locB (xferOp.getLoc (), rewriter);
910917 Value dataBuffer = Strategy<OpTy>::getBuffer (xferOp);
911918 auto dataBufferType = dyn_cast<MemRefType>(dataBuffer.getType ());
912919 FailureOr<MemRefType> castedDataType = unpackOneDim (dataBufferType);
913920 if (failed (castedDataType))
914- return failure ();
921+ return rewriter.notifyMatchFailure (xferOp,
922+ " Failed to unpack one vector dim." );
915923
916924 auto castedDataBuffer =
917925 locB.create <vector::TypeCastOp>(*castedDataType, dataBuffer);
@@ -1294,16 +1302,14 @@ struct UnrollTransferReadConversion
12941302 xferOp, " vector rank is less or equal to target rank" );
12951303 if (failed (checkLowerTensors (xferOp, rewriter)))
12961304 return failure ();
1297- // Transfer ops that modify the element type are not supported atm.
12981305 if (xferOp.getVectorType ().getElementType () !=
12991306 xferOp.getShapedType ().getElementType ())
13001307 return rewriter.notifyMatchFailure (
13011308 xferOp, " not yet supported: element type mismatch" );
13021309 auto xferVecType = xferOp.getVectorType ();
13031310 if (xferVecType.getScalableDims ()[0 ]) {
1304- // Cannot unroll a scalable dimension at compile time.
13051311 return rewriter.notifyMatchFailure (
1306- xferOp, " scalable dimensions cannot be unrolled" );
1312+ xferOp, " scalable dimensions cannot be unrolled at compile time " );
13071313 }
13081314
13091315 auto insertOp = getInsertOp (xferOp);
0 commit comments