Skip to content

Commit

Permalink
Remove the compile option -nnpa-clip-to-dlfloat-range (#3075)
Browse files Browse the repository at this point in the history
Signed-off-by: Tung D. Le <[email protected]>
  • Loading branch information
tungld authored Feb 13, 2025
1 parent d6da8b2 commit b2eb90b
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 302 deletions.
7 changes: 0 additions & 7 deletions src/Accelerators/NNPA/Compiler/NNPACompilerOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ 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> nnpaClipToDLFloatRange("nnpa-clip-to-dlfloat-range",
llvm::cl::desc("Clip CPU tensors to dlfloat range before stickification to "
"avoid out-of-range. Only clip Softmax inputs at this "
"moment. Default is true. This option will be removed and "
"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::desc(
"Enabling this will convert a pattern `stick -> element-wise op -> "
Expand Down
1 change: 0 additions & 1 deletion src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ 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> nnpaClipToDLFloatRange;
extern llvm::cl::opt<bool> nnpaEnableZHighToOnnx;
extern llvm::cl::opt<bool> nnpaEnableZHighDecomposeStickUnstick;
extern llvm::cl::opt<bool> nnpaEnableCompilerStickUnstick;
Expand Down
10 changes: 0 additions & 10 deletions src/Accelerators/NNPA/Compiler/NNPACompilerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,6 @@ void addONNXToZHighPasses(mlir::PassManager &pm) {
pm.addNestedPass<func::FuncOp>(onnx_mlir::createShapeInferencePass());
pm.addPass(mlir::createCanonicalizerPass());

// Clip zhigh.Stick inputs if required. This is to avoid out-of-range of
// dlfloat. Do constant propagation after clipping to remove ONNX ops used for
// clipping such as ONNXMax if applicable.
// This pass will be removed and replaced by nnpa-saturation in the future.
if (!nnpaEnableSaturation && nnpaClipToDLFloatRange) {
pm.addNestedPass<func::FuncOp>(
onnx_mlir::zhigh::createZHighClipToDLFloatPass());
pm.addNestedPass<func::FuncOp>(onnx_mlir::createConstPropONNXToONNXPass());
}

// One more call to ONNX shape inference/canonicalization/... to update shape
// if possible.
if (enableONNXHybridPass) {
Expand Down
4 changes: 0 additions & 4 deletions src/Accelerators/NNPA/NNPAAccelerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ void NNPAAccelerator::registerPasses(int optLevel) const {
return onnx_mlir::zhigh::createZHighLayoutPropagationPass();
});

mlir::registerPass([]() -> std::unique_ptr<mlir::Pass> {
return onnx_mlir::zhigh::createZHighClipToDLFloatPass();
});

mlir::registerPass([]() -> std::unique_ptr<mlir::Pass> {
return onnx_mlir::zhigh::createZHighDecomposeStickUnstickPass();
});
Expand Down
3 changes: 0 additions & 3 deletions src/Accelerators/NNPA/Pass/NNPAPasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ std::unique_ptr<mlir::Pass> createZHighConstPropagationPass();
std::unique_ptr<mlir::Pass> createZHighScrubDisposablePass(
bool closeAfter = true);

/// Pass for clipping values to dlfloat before stickification at ZHighIR.
std::unique_ptr<mlir::Pass> createZHighClipToDLFloatPass();

/// Pass for decomposing stick/unstick at ZHighIR.
std::unique_ptr<mlir::Pass> createZHighDecomposeStickUnstickPass();

Expand Down
11 changes: 0 additions & 11 deletions src/Accelerators/NNPA/Transform/ZHigh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ add_onnx_mlir_library(OMZHighLayoutPropagation
${NNPA_INCLUDE_PATH}
)

add_onnx_mlir_rewriter(ZHighClipToDLFloat)
add_onnx_mlir_library(OMZHighClipToDLFloat
ZHighClipToDLFloat.cpp

LINK_LIBS PUBLIC
MLIRRewrite
MLIRTransformUtils
OMZHighOps
OMONNXOps
)

add_onnx_mlir_rewriter(ZHighDecomposeStickUnstick)
add_onnx_mlir_library(OMZHighDecomposeStickUnstick
ZHighDecomposeStickUnstick.cpp
Expand Down
170 changes: 0 additions & 170 deletions src/Accelerators/NNPA/Transform/ZHigh/ZHighClipToDLFloat.cpp

This file was deleted.

This file was deleted.

0 comments on commit b2eb90b

Please sign in to comment.