Skip to content

Commit

Permalink
disable GLAGS_use_mkldnn
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanglirong1999 committed Nov 10, 2023
1 parent dde63f9 commit 1d50270
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 8 additions & 8 deletions paddle/phi/core/flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -680,15 +680,15 @@ PHI_DEFINE_EXPORTED_bool(
* Example:
* Note:
*/
#ifdef PADDLE_WITH_DNNL
PHI_DEFINE_EXPORTED_bool(
use_mkldnn,
phi::backends::cpu::MayIUse(phi::backends::cpu::cpu_isa_t::avx2) ? true
: false,
"Use MKLDNN to run");
#else
// #ifdef PADDLE_WITH_DNNL
// PHI_DEFINE_EXPORTED_bool(
// use_mkldnn,
// phi::backends::cpu::MayIUse(phi::backends::cpu::cpu_isa_t::avx2) ? true
// : false,
// "Use MKLDNN to run");
// #else
PHI_DEFINE_EXPORTED_bool(use_mkldnn, false, "Use MKLDNN to run");
#endif
// #endif

/**
* Debug related FLAG
Expand Down
5 changes: 5 additions & 0 deletions test/legacy_test/op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,8 @@ def check_output_with_place(
):
core._set_prim_all_enabled(False)
core.set_prim_eager_enabled(False)
if not self.is_mkldnn_op():
set_flags({"FLAGS_use_mkldnn": False})

if hasattr(self, "use_custom_device") and self.use_custom_device:
check_dygraph = False
Expand Down Expand Up @@ -2917,6 +2919,9 @@ def check_grad_with_place(
if hasattr(self, "use_custom_device") and self.use_custom_device:
check_dygraph = False

if not self.is_mkldnn_op():
set_flags({"FLAGS_use_mkldnn": False})

core._set_prim_all_enabled(False)
core.set_prim_eager_enabled(False)
if check_prim:
Expand Down

0 comments on commit 1d50270

Please sign in to comment.