Skip to content

Commit

Permalink
ZHigh to ONNX optimization is default on. Switch flag from enable to …
Browse files Browse the repository at this point in the history
…disable (#3074)

Signed-off-by: Alexandre Eichenberger <[email protected]>
  • Loading branch information
AlexandreEichenberger authored Feb 13, 2025
1 parent 409a12c commit 2bede1a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ llvm::cl::opt<NNPAEmissionTargetType> nnpaEmissionTarget(
clEnumVal(EmitZNONE, "Do not emit NNPA-related target (default)")),
llvm::cl::init(EmitZNONE), llvm::cl::cat(OnnxMlirOptions));

llvm::cl::opt<bool> nnpaEnableZHighToOnnx("enable-zhigh-to-onnx",
llvm::cl::opt<bool> 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<bool> nnpaEnableZHighDecomposeStickUnstick(
"enable-zhigh-decompose-stick-unstick",
Expand Down
2 changes: 1 addition & 1 deletion src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ typedef enum {
extern llvm::cl::OptionCategory OnnxMlirOptions;
extern llvm::cl::OptionCategory OnnxMlirCommonOptions;
extern llvm::cl::opt<onnx_mlir::NNPAEmissionTargetType> nnpaEmissionTarget;
extern llvm::cl::opt<bool> nnpaEnableZHighToOnnx;
extern llvm::cl::opt<bool> nnpaDisableZHighToOnnx;
extern llvm::cl::opt<bool> nnpaEnableZHighDecomposeStickUnstick;
extern llvm::cl::opt<bool> nnpaEnableCompilerStickUnstick;
extern llvm::cl::opt<bool> nnpaEnableScalarBcastBinary;
Expand Down
2 changes: 1 addition & 1 deletion src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<func::FuncOp>(onnx_mlir::createZHighToONNXPass());

// Constant propagation at ZHighIR: constant stickify.
Expand Down

0 comments on commit 2bede1a

Please sign in to comment.