[mlir] [VectorOps] Expose lowering pass options programmatically

The ConvertVectorToLLVM pass defines options that can be passed
on the command line (currently only reassociation of FP reductions
through -convert-vector-to-llvm='reassociate-fp-reductions). This
CL enables setting these options programmatically (forward looking
to more options than just reassociation, as well as setting the
values from code rather than command line).

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D83420
This commit is contained in:
aartbik
2020-07-08 14:58:04 -07:00
parent 339f1b4903
commit 1bfdf7c7e3
2 changed files with 20 additions and 3 deletions

View File

@@ -1180,6 +1180,9 @@ void mlir::populateVectorToLLVMMatrixConversionPatterns(
namespace {
struct LowerVectorToLLVMPass
: public ConvertVectorToLLVMBase<LowerVectorToLLVMPass> {
LowerVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
this->reassociateFPReductions = options.reassociateFPReductions;
}
void runOnOperation() override;
};
} // namespace
@@ -1210,6 +1213,7 @@ void LowerVectorToLLVMPass::runOnOperation() {
}
}
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);
}