Skip to content

Commit 605ea3c

Browse files
Merge pull request #426 from SushmitaThakallapalli1980/sush.remove_qdq_binary
remove_qdq_binary
2 parents 2129d5d + b42f67f commit 605ea3c

File tree

10 files changed

+1605
-1
lines changed

10 files changed

+1605
-1
lines changed

src/Compiler/OnnxToMlirPasses.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ void addONNXToMLIRPasses(mlir::PassManager &pm, bool targetCPU,
8484
pm.addPass(onnx_mlir::createSimplifyShapeRelatedOpsPass(
8585
opts.enableQuarkQuantizedLegalization));
8686

87+
// Pass for removing binary ops if one of the inputs is fed by a Constant
88+
if (opts.enableRemoveBinary)
89+
pm.addPass(createFoldDQBinaryQPass());
90+
8791
// Pass for removing Dq and Q around data movement in Dq->op->Q Ops chain
8892
if (opts.enableRemoveDqQAroundOp)
8993
pm.addPass(createQDQAroundOpOptONNXToONNXPass());

src/Compiler/OnnxToMlirPasses.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct OnnxToMlirOptions {
1818
bool enableConvTranspose1dDecomposeToPhasedConv = false;
1919
bool enableRemoveDqQOp = true;
2020
bool enableRemoveDqQAroundOp = true;
21+
bool enableRemoveBinary = false;
2122

2223
bool disableRecomposeOption = false;
2324
bool enableONNXHybridPass = true;

src/Dialect/ONNX/Transforms/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ add_onnx_mlir_library(OMInstrumentONNX
4343
add_onnx_mlir_library(OMONNXRewrite
4444
ConstProp.cpp
4545
QDQAroundOpOpt.cpp
46-
QDQOpt.cpp
46+
QDQOpt.cpp
47+
DQBinaryQOpt.cpp
4748
ConvOpt.cpp
4849
Decompose.cpp
4950
DecomposeEinsum.cpp

0 commit comments

Comments
 (0)