[Mlir-commits] [mlir] [mlir][vector] Refactor WarpOpScfForOp to support unused or swapped forOp results. (PR #147620)
Petr Kurapov
llvmlistbot at llvm.org
Wed Jul 9 09:42:18 PDT 2025
================
@@ -1769,81 +1772,155 @@ struct WarpOpScfForOp : public WarpDistributionPattern {
AffineMap map = distributionMapFn(operand->get());
distType = getDistributedType(vecType, map, warpOp.getWarpSize());
}
- inputTypes.push_back(operand->get().getType());
- distTypes.push_back(distType);
+ escapingValueInputTypes.push_back(operand->get().getType());
+ escapingValuedistTypes.push_back(distType);
}
});
- if (llvm::is_contained(distTypes, Type{}))
+ if (llvm::is_contained(escapingValuedistTypes, Type{}))
return failure();
+ // Warp op can yield two types of values:
+ // 1. Values that are not results of the forOp:
+ // These values must also be yielded by the new warp op. Also, we need to
+ // record the index mapping for these values to replace them later.
+ // 2. Values that are results of the forOp:
+ // In this case, we record the index mapping between the warp op result
+ // index and matching forOp result index.
+ SmallVector<Value> nonForYieldedValues;
+ SmallVector<unsigned> nonForResultIndices;
+ DenseMap<unsigned, unsigned> forResultMapping;
----------------
kurapov-peter wrote:
You can probably do the mapping with some existing tools like a value to value map.
https://github.com/llvm/llvm-project/pull/147620
More information about the Mlir-commits
mailing list