Skip to content

Commit

Permalink
[NNPA] Call HybridTransformPass one more time to update shape if poss…
Browse files Browse the repository at this point in the history
…ible (#2449)

Signed-off-by: Tung D. Le <[email protected]>
  • Loading branch information
tungld authored Aug 17, 2023
1 parent adf4c40 commit f12f48f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ void addONNXToZHighPasses(
if (isBE)
pm.addNestedPass<func::FuncOp>(
onnx_mlir::zhigh::createZHighConstPropagationPass());
// One more call to ONNX shape inference/canonicalization/... to update shape
// if possible.
if (enableONNXHybridPass) {
// For starters only illustrating the new hybrid pass by replacing 3 passes
// here. The plan is to replace most of the passes in addONNXToMLIRPasses.
pm.addNestedPass<func::FuncOp>(onnx_mlir::createONNXHybridTransformPass());
} else {
pm.addNestedPass<func::FuncOp>(onnx_mlir::createShapeInferencePass());
pm.addPass(mlir::createCanonicalizerPass());
pm.addNestedPass<func::FuncOp>(onnx_mlir::createShapeInferencePass());
}
// Remove common sub-expressions.
pm.addPass(mlir::createCSEPass());

Expand Down

0 comments on commit f12f48f

Please sign in to comment.