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

[OneDNN] Replace cpu.h header in default OneDNN to deploy #59259

Merged
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
8 changes: 5 additions & 3 deletions paddle/fluid/inference/api/analysis_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -949,9 +949,11 @@ void AnalysisConfig::Update() {
// Case3: pass_builder_ has been created and belongs to
// GpuPassStrategy(or IpuPassStrategy), neither enable mkldnn and
// disable mkldnn will be executed
if (!use_gpu() && !use_xpu() && !use_ipu() && !use_custom_device() &&
!use_mkldnn_) {
// User manually disable mkldnn
if ((!use_gpu() && !use_xpu() && !use_ipu() && !use_mkldnn_) ||
(use_mkldnn_ &&
!phi::backends::cpu::MayIUse(phi::backends::cpu::cpu_isa_t::avx2))) {
// User manually disable mkldnn or disable when not support AVX2
use_mkldnn_ = false;
pass_builder()->DisableMKLDNN();
}
#endif
Expand Down
6 changes: 1 addition & 5 deletions paddle/fluid/inference/api/paddle_analysis_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "paddle_api.h" // NOLINT
#include "paddle_pass_builder.h" // NOLINT
#ifdef PADDLE_WITH_DNNL
#include "paddle/phi/backends/cpu/cpu_info.h"
#include "paddle_mkldnn_quantizer_config.h" // NOLINT
#endif

Expand Down Expand Up @@ -1302,13 +1301,10 @@ struct PD_INFER_DECL AnalysisConfig {
std::unordered_set<std::string> trt_ops_run_float_;

#ifdef PADDLE_WITH_DNNL
bool use_mkldnn_{
phi::backends::cpu::MayIUse(phi::backends::cpu::cpu_isa_t::avx2) ? true
: false};
bool use_mkldnn_{true};
#else
bool use_mkldnn_{false};
#endif

std::unordered_set<std::string> mkldnn_enabled_op_types_;

bool model_from_memory_{false};
Expand Down