[PATCH] D77663: Lower vector slices while lowering linalg to LLVM.
Pierre Oechsel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 10:50:51 PDT 2020
poechsel created this revision.
Herald added subscribers: llvm-commits, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: aartbik.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77663
Files:
mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
Index: mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
===================================================================
--- mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -1117,6 +1117,13 @@
patterns.insert<VectorMatmulOpConversion>(ctx, converter);
}
+void mlir::lowerVectorSlicesToLLVM(Operation *op, MLIRContext *context) {
+ OwningRewritePatternList patterns;
+ populateVectorSlicesLoweringPatterns(patterns, context);
+ populateVectorContractLoweringPatterns(patterns, context);
+ applyPatternsGreedily(op, patterns);
+}
+
namespace {
struct LowerVectorToLLVMPass : public ModulePass<LowerVectorToLLVMPass> {
/// Include the generated pass utilities.
@@ -1128,14 +1135,7 @@
} // namespace
void LowerVectorToLLVMPass::runOnModule() {
- // Perform progressive lowering of operations on slices and
- // all contraction operations. Also applies folding and DCE.
- {
- OwningRewritePatternList patterns;
- populateVectorSlicesLoweringPatterns(patterns, &getContext());
- populateVectorContractLoweringPatterns(patterns, &getContext());
- applyPatternsGreedily(getModule(), patterns);
- }
+ lowerVectorSlicesToLLVM(getModule(), &getContext());
// Convert to the LLVM IR dialect.
LLVMTypeConverter converter(&getContext());
Index: mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
===================================================================
--- mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
+++ mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
@@ -580,6 +580,7 @@
populateLoopToStdConversionPatterns(patterns, &getContext());
populateStdToLLVMConversionPatterns(converter, patterns);
populateVectorToLLVMMatrixConversionPatterns(converter, patterns);
+ lowerVectorSlicesToLLVM(getModule(), &getContext());
populateVectorToLLVMConversionPatterns(converter, patterns);
populateLinalgToStandardConversionPatterns(patterns, &getContext());
populateLinalgToLLVMConversionPatterns(converter, patterns, &getContext());
Index: mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
===================================================================
--- mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
+++ mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
@@ -28,6 +28,10 @@
/// Create a pass to convert vector operations to the LLVMIR dialect.
std::unique_ptr<OpPassBase<ModuleOp>> createConvertVectorToLLVMPass();
+// Perform progressive lowering of operations on "slices" and
+// all contraction operations. Also applies folding and DCE.
+void lowerVectorSlicesToLLVM(Operation *op, MLIRContext *context);
+
} // namespace mlir
#endif // MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVM_H_
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77663.255728.patch
Type: text/x-patch
Size: 2790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200407/2c2a9dc3/attachment.bin>
More information about the llvm-commits
mailing list