[Mlir-commits] [mlir] Add lower-vector-multi-reduction pass (PR #87333)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Apr 8 00:49:09 PDT 2024
================
@@ -461,6 +471,31 @@ struct OneDimMultiReductionToTwoDim
return success();
}
};
+
+struct LowerVectorMultiReductionPass
+ : public vector::impl::LowerVectorMultiReductionBase<
+ LowerVectorMultiReductionPass> {
+ LowerVectorMultiReductionPass(vector::VectorMultiReductionLowering option) {
+ this->loweringStrategy = option;
+ }
+
+ void runOnOperation() override {
+ Operation *op = getOperation();
+ MLIRContext *context = op->getContext();
+
+ RewritePatternSet loweringPatterns(context);
+ populateVectorMultiReductionLoweringPatterns(loweringPatterns,
+ this->loweringStrategy);
----------------
xiaoleis-nv wrote:
Hi @joker-eph,
I understand this point, and I've learned something new from it. Regarding the specific pattern in question, it's actually not just a single pattern but rather a collection of patterns, which includes:
- InnerOuterDimReductionConversion
- ReduceMultiDimReductionRank
- OneDimMultiReductionToTwoDim
- TwoDimMultiReductionToReduction
- TwoDimMultiReductionToElementWise
As you have mentioned, these patterns might not make the time spent in the greedy rewriter stand out. Therefore, I think we can maintain the current implementation here.
https://github.com/llvm/llvm-project/pull/87333
More information about the Mlir-commits
mailing list