未验证 提交 a21b5710 编写于 作者: J joanna.wozna.intel 提交者: GitHub

Add AVX512 instruction check for C-API (#28087)

* Add AVX512 instruction check for C-API

* Fix formatting
上级 463c72c2
......@@ -14,6 +14,7 @@
#include "paddle/fluid/inference/api/paddle_analysis_config.h"
#include "paddle/fluid/inference/api/paddle_pass_builder.h"
#include "paddle/fluid/platform/cpu_info.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/gpu_info.h"
......@@ -222,7 +223,12 @@ void AnalysisConfig::EnableMkldnnQuantizer() {
void AnalysisConfig::EnableMkldnnBfloat16() {
#ifdef PADDLE_WITH_MKLDNN
use_mkldnn_bfloat16_ = true;
if (platform::MayIUse(platform::cpu_isa_t::avx512_core)) {
use_mkldnn_bfloat16_ = true;
} else {
LOG(INFO) << "CPU does not support BFLOAT16 calculations";
use_mkldnn_bfloat16_ = false;
}
#else
LOG(ERROR) << "Please compile with MKLDNN first to use MkldnnBfloat16";
use_mkldnn_bfloat16_ = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册