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

[Inference] memory_optimize and mkdlnn problem #49054

Merged
merged 4 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 14 additions & 0 deletions paddle/fluid/inference/api/analysis_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,22 @@ void AnalysisConfig::Update() {
#endif
}

// TODO(inference): When we enable memory_optimize and mkldnn, PaddleSeg model
// fail.
if (enable_memory_optim_) {
#ifdef PADDLE_WITH_MKLDNN
if (use_mkldnn_) {
jiweibo marked this conversation as resolved.
Show resolved Hide resolved
enable_memory_optim_ = false;
LOG_FIRST_N(WARNING, 1)
<< "It is detected that mkldnn and memory_optimize_pass are enabled "
"at the same time, but they are not supported yet. Currently, "
"memory_optimize_pass is explicitly disabled";
} else {
pass_builder()->AppendAnalysisPass("memory_optimize_pass");
}
#else
pass_builder()->AppendAnalysisPass("memory_optimize_pass");
#endif
}

if (use_lite_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ TEST(PD_Config, interface) {
bool ir_optim = PD_ConfigIrOptim(config);
EXPECT_TRUE(ir_optim);

PD_ConfigEnableMemoryOptim(config, true);
bool memory_enabled = PD_ConfigMemoryOptimEnabled(config);
EXPECT_TRUE(memory_enabled);

#ifndef PADDLE_WITH_LITE
PD_ConfigEnableLiteEngine(
config, PD_PRECISION_FLOAT32, TRUE, 0, nullptr, 0, nullptr);
Expand Down Expand Up @@ -95,10 +99,6 @@ TEST(PD_Config, interface) {
EXPECT_FALSE(onnxruntime_disabled);
PD_ConfigEnableORTOptimization(config);

PD_ConfigEnableMemoryOptim(config, true);
bool memory_enabled = PD_ConfigMemoryOptimEnabled(config);
EXPECT_TRUE(memory_enabled);

PD_ConfigEnableProfile(config);
bool profile_enabled = PD_ConfigProfileEnabled(config);
EXPECT_TRUE(profile_enabled);
Expand Down