Fix plumbing options to ConvertToLLVM (#11088)
Previously multi-threaded compilation didn't propagate the flag to
reassociate FP reductions.
https://github.com/iree-org/iree/issues/10279#issuecomment-1302853763.
This PR fixes that.
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/ConvertToLLVM.cpp b/compiler/src/iree/compiler/Codegen/LLVMCPU/ConvertToLLVM.cpp
index 4aaf852..0f2feb6 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMCPU/ConvertToLLVM.cpp
+++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/ConvertToLLVM.cpp
@@ -1094,8 +1094,9 @@
class ConvertToLLVMPass : public ConvertToLLVMBase<ConvertToLLVMPass> {
public:
- ConvertToLLVMPass(bool reassociateFpReductions)
- : reassociateFpReductions(reassociateFpReductions){};
+ ConvertToLLVMPass(bool reassociateFpReductions) {
+ targetReassociateFpReductions.setValue(reassociateFpReductions);
+ }
ConvertToLLVMPass(const ConvertToLLVMPass &pass) {}
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<LLVM::LLVMDialect, arm_neon::ArmNeonDialect>();
@@ -1111,7 +1112,10 @@
*this, "target-data-layout",
llvm::cl::desc("Code generation target data layout."),
llvm::cl::init("")};
- bool reassociateFpReductions = false;
+ Option<bool> targetReassociateFpReductions{
+ *this, "target-reassociate-fp-reductions",
+ llvm::cl::desc("Code generation target reassociate FP reductions."),
+ llvm::cl::init("false")};
};
} // namespace
@@ -1212,8 +1216,8 @@
arith::populateArithToLLVMConversionPatterns(converter, patterns);
populateVectorToSCFConversionPatterns(patterns);
populateVectorToLLVMMatrixConversionPatterns(converter, patterns);
- populateVectorToLLVMConversionPatterns(converter, patterns,
- reassociateFpReductions);
+ populateVectorToLLVMConversionPatterns(
+ converter, patterns, targetReassociateFpReductions.getValue());
populateLinalgToLLVMConversionPatterns(converter, patterns);
populateReconcileUnrealizedCastsPatterns(patterns);