[Mlir-commits] [mlir] [mlir][vector] Fix cases with multiple yielded transfer_read ops (PR #71625)
Lei Zhang
llvmlistbot at llvm.org
Wed Nov 8 22:07:14 PST 2023
================
@@ -801,13 +801,31 @@ struct WarpOpTransferRead : public OpRewritePattern<WarpExecuteOnLane0Op> {
using OpRewritePattern<WarpExecuteOnLane0Op>::OpRewritePattern;
LogicalResult matchAndRewrite(WarpExecuteOnLane0Op warpOp,
PatternRewriter &rewriter) const override {
- OpOperand *operand = getWarpResult(
- warpOp, [](Operation *op) { return isa<vector::TransferReadOp>(op); });
- if (!operand)
- return failure();
- auto read = operand->get().getDefiningOp<vector::TransferReadOp>();
- // Don't duplicate transfer_read ops when distributing.
- if (!read.getResult().hasOneUse())
+ // Try to find a distributable yielded read. Note that this pattern can
+ // still fail at the end after distribution, in which case this might have
+ // missed another distributable read.
+ vector::TransferReadOp read;
+ auto yield = cast<vector::YieldOp>(
----------------
antiagainst wrote:
This is mostly duplicated logic with `getWarpResult`. Should we create `getWarpResults` that return a list of candidates? I'd assume that'd be useful for handling other op cases too? If you don't want to go handle other op cases, we can change `getWarpResult` to just call `getWarpResults` for the first candidate to maintain its existing behavior.
https://github.com/llvm/llvm-project/pull/71625
More information about the Mlir-commits
mailing list