File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
paddle/fluid/inference/api Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1414
1515#include " paddle/fluid/inference/api/paddle_analysis_config.h"
1616#include " paddle/fluid/inference/api/paddle_pass_builder.h"
17+ #include " paddle/fluid/platform/cpu_info.h"
1718#include " paddle/fluid/platform/enforce.h"
1819#include " paddle/fluid/platform/gpu_info.h"
1920
@@ -222,7 +223,12 @@ void AnalysisConfig::EnableMkldnnQuantizer() {
222223
223224void AnalysisConfig::EnableMkldnnBfloat16 () {
224225#ifdef PADDLE_WITH_MKLDNN
225- use_mkldnn_bfloat16_ = true ;
226+ if (platform::MayIUse (platform::cpu_isa_t ::avx512_core)){
227+ use_mkldnn_bfloat16_ = true ;
228+ } else {
229+ LOG (INFO) << " CPU does not support BFLOAT16 calculations" ;
230+ use_mkldnn_bfloat16_ = false ;
231+ }
226232#else
227233 LOG (ERROR) << " Please compile with MKLDNN first to use MkldnnBfloat16" ;
228234 use_mkldnn_bfloat16_ = false ;
You can’t perform that action at this time.
0 commit comments