From 2bede1aa5c5593e3bda95243ab8cf8547c984b48 Mon Sep 17 00:00:00 2001 From: Alexandre Eichenberger Date: Thu, 13 Feb 2025 16:05:39 -0500 Subject: [PATCH] ZHigh to ONNX optimization is default on. Switch flag from enable to disable (#3074) Signed-off-by: Alexandre Eichenberger --- src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp | 8 ++++---- src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp | 2 +- src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp b/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp index 29b48073ac..2461e39ea1 100644 --- a/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp +++ b/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp @@ -30,13 +30,13 @@ llvm::cl::opt nnpaEmissionTarget( clEnumVal(EmitZNONE, "Do not emit NNPA-related target (default)")), llvm::cl::init(EmitZNONE), llvm::cl::cat(OnnxMlirOptions)); -llvm::cl::opt nnpaEnableZHighToOnnx("enable-zhigh-to-onnx", +llvm::cl::opt nnpaDisableZHighToOnnx("disable-zhigh-to-onnx", llvm::cl::desc( - "Enabling this will convert a pattern `stick -> element-wise op -> " + "By default we convert a pattern `stick -> element-wise op -> " "unstick` back to an ONNX element-wise op. This conversion is called " "after applying all optimizations to remove stick/unstick at ZHigh " - "level. Default is true."), - llvm::cl::init(true), llvm::cl::cat(OnnxMlirOptions)); + "level. Use this option to disable this optimization."), + llvm::cl::init(false), llvm::cl::cat(OnnxMlirOptions)); llvm::cl::opt nnpaEnableZHighDecomposeStickUnstick( "enable-zhigh-decompose-stick-unstick", diff --git a/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp b/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp index 1e07a92d7e..3958cc2bd5 100644 --- a/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp +++ b/src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp @@ -67,7 +67,7 @@ typedef enum { extern llvm::cl::OptionCategory OnnxMlirOptions; extern llvm::cl::OptionCategory OnnxMlirCommonOptions; extern llvm::cl::opt nnpaEmissionTarget; -extern llvm::cl::opt nnpaEnableZHighToOnnx; +extern llvm::cl::opt nnpaDisableZHighToOnnx; extern llvm::cl::opt nnpaEnableZHighDecomposeStickUnstick; extern llvm::cl::opt nnpaEnableCompilerStickUnstick; extern llvm::cl::opt nnpaEnableScalarBcastBinary; diff --git a/src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp b/src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp index 141e733937..1d52d60700 100644 --- a/src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp +++ b/src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp @@ -173,7 +173,7 @@ void addONNXToZHighPasses(mlir::PassManager &pm) { // sub, ...) that are of `stick -> light-weight op -> unstick`, it's better to // use CPU instead of NNPA to avoid stick/unstick. CPU is efficient to handle // these ops, e.g vectorize the computation. - if (nnpaEnableZHighToOnnx) + if (!nnpaDisableZHighToOnnx) pm.addNestedPass(onnx_mlir::createZHighToONNXPass()); // Constant propagation at ZHighIR: constant stickify.