Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZHigh to ONNX optimization is default on. Switch flag from enable to disable #3074

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ llvm::cl::opt<bool> nnpaClipToDLFloatRange("nnpa-clip-to-dlfloat-range",
"replaced by --nnpa-saturation in the future."),
llvm::cl::init(true), 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 @@ -68,7 +68,7 @@ extern llvm::cl::OptionCategory OnnxMlirOptions;
extern llvm::cl::OptionCategory OnnxMlirCommonOptions;
extern llvm::cl::opt<onnx_mlir::NNPAEmissionTargetType> nnpaEmissionTarget;
extern llvm::cl::opt<bool> nnpaClipToDLFloatRange;
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 @@ -183,7 +183,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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the space caused clang-format check failed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tx

pm.addNestedPass<func::FuncOp>(onnx_mlir::createZHighToONNXPass());

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