template <typename T>
class OperationPass;
+/// Options to control Vector to LLVM lowering.
+///
+/// This should kept in sync with VectorToLLVM options defined for the
+/// ConvertVectorToLLVM pass in include/mlir/Conversion/Passes.td
+struct LowerVectorToLLVMOptions {
+ bool reassociateFPReductions = false;
+ LowerVectorToLLVMOptions &setReassociateFPReductions(bool r) {
+ reassociateFPReductions = r;
+ return *this;
+ }
+};
+
/// Collect a set of patterns to convert from Vector contractions to LLVM Matrix
/// Intrinsics. To lower to assembly, the LLVM flag -lower-matrix-intrinsics
/// will be needed when invoking LLVM.
bool reassociateFPReductions = false);
/// Create a pass to convert vector operations to the LLVMIR dialect.
-std::unique_ptr<OperationPass<ModuleOp>> createConvertVectorToLLVMPass();
+std::unique_ptr<OperationPass<ModuleOp>> createConvertVectorToLLVMPass(
+ const LowerVectorToLLVMOptions &options = LowerVectorToLLVMOptions());
} // namespace mlir
namespace {
struct LowerVectorToLLVMPass
: public ConvertVectorToLLVMBase<LowerVectorToLLVMPass> {
+ LowerVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
+ this->reassociateFPReductions = options.reassociateFPReductions;
+ }
void runOnOperation() override;
};
} // namespace
}
}
-std::unique_ptr<OperationPass<ModuleOp>> mlir::createConvertVectorToLLVMPass() {
- return std::make_unique<LowerVectorToLLVMPass>();
+std::unique_ptr<OperationPass<ModuleOp>>
+mlir::createConvertVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
+ return std::make_unique<LowerVectorToLLVMPass>(options);
}