Skip to content

Commit 319c4b1

Browse files
committed
Apply suggestions from code review
1 parent e372bf5 commit 319c4b1

File tree

22 files changed

+60
-73
lines changed

22 files changed

+60
-73
lines changed

src/inference/dev_api/openvino/runtime/system_conf.hpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,6 @@ OPENVINO_RUNTIME_API bool with_cpu_x86_avx2();
111111
*/
112112
OPENVINO_RUNTIME_API bool with_cpu_x86_avx2_vnni();
113113

114-
/**
115-
* @brief Checks whether CPU supports AVX2_VNNI_2 capability
116-
* @ingroup ov_dev_api_system_conf
117-
* @return `True` is AVX2_VNNI_2 instructions are available, `false` otherwise
118-
*/
119-
OPENVINO_RUNTIME_API bool with_cpu_x86_avx2_vnni_2();
120-
121114
/**
122115
* @brief Checks whether CPU supports AVX 512 capability
123116
* @ingroup ov_dev_api_system_conf
@@ -142,17 +135,10 @@ OPENVINO_RUNTIME_API bool with_cpu_x86_avx512_core_vnni();
142135
/**
143136
* @brief Checks whether CPU supports BFloat16 capability
144137
* @ingroup ov_dev_api_system_conf
145-
* @return `True` is tAVX512_BF16 or AVX2_VNNI_2 instructions are available, `false` otherwise
138+
* @return `True` is tAVX512_BF16 instructions are available, `false` otherwise
146139
*/
147140
OPENVINO_RUNTIME_API bool with_cpu_x86_bfloat16();
148141

149-
/**
150-
* @brief Checks whether CPU supports Float16 capability
151-
* @ingroup ov_dev_api_system_conf
152-
* @return `True` is tAVX512_FP16 or AVX2_VNNI_2 instructions are available, `false` otherwise
153-
*/
154-
OPENVINO_RUNTIME_API bool with_cpu_x86_float16();
155-
156142
/**
157143
* @brief Checks whether CPU supports fp16 capability
158144
* @ingroup ov_dev_api_system_conf

src/inference/src/system_conf.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ bool with_cpu_x86_avx2_vnni() {
7575
return get_cpu_info().has(Xbyak::util::Cpu::tAVX2 | Xbyak::util::Cpu::tAVX_VNNI);
7676
}
7777

78-
bool with_cpu_x86_avx2_vnni_2() {
79-
return with_cpu_x86_avx2_vnni() && get_cpu_info().has(Xbyak::util::Cpu::tAVX_VNNI_INT8) &&
80-
get_cpu_info().has(Xbyak::util::Cpu::tAVX_NE_CONVERT);
81-
}
82-
8378
bool with_cpu_x86_avx512f() {
8479
return get_cpu_info().has(Xbyak::util::Cpu::tAVX512F);
8580
}
@@ -93,17 +88,13 @@ bool with_cpu_x86_avx512_core_vnni() {
9388
}
9489

9590
bool with_cpu_x86_bfloat16() {
96-
return get_cpu_info().has(Xbyak::util::Cpu::tAVX512_BF16) || with_cpu_x86_avx2_vnni_2();
91+
return get_cpu_info().has(Xbyak::util::Cpu::tAVX512_BF16);
9792
}
9893

9994
bool with_cpu_x86_avx512_core_fp16() {
10095
return get_cpu_info().has(Xbyak::util::Cpu::tAVX512_FP16);
10196
}
10297

103-
bool with_cpu_x86_float16() {
104-
return with_cpu_x86_avx512_core_fp16() || with_cpu_x86_avx2_vnni_2();
105-
}
106-
10798
bool with_cpu_x86_avx512_core_amx_int8() {
10899
return get_cpu_info().has(Xbyak::util::Cpu::tAMX_INT8);
109100
}
@@ -142,9 +133,6 @@ bool with_cpu_x86_avx2() {
142133
bool with_cpu_x86_avx2_vnni() {
143134
return false;
144135
}
145-
bool with_cpu_x86_avx2_vnni_2() {
146-
return false;
147-
}
148136
bool with_cpu_x86_avx512f() {
149137
return false;
150138
}
@@ -160,9 +148,6 @@ bool with_cpu_x86_bfloat16() {
160148
bool with_cpu_x86_avx512_core_fp16() {
161149
return false;
162150
}
163-
bool with_cpu_x86_float16() {
164-
return false;
165-
}
166151
bool with_cpu_x86_avx512_core_amx_int8() {
167152
return false;
168153
}

src/plugins/intel_cpu/src/nodes/paged_attn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ bool PagedAttention::isSupportedOperation(const std::shared_ptr<const ov::Node>&
276276
ov::element::Type PagedAttention::getRuntimePrecision() const {
277277
auto rtPrecision = getOriginalInputPrecisionAtPort(0);
278278
// bf16 should be enabled only when platform supports
279-
if (rtPrecision == ov::element::bf16 && ov::with_cpu_x86_bfloat16() && !ov::with_cpu_x86_avx2_vnni_2()) {
279+
if (rtPrecision == ov::element::bf16 && ov::with_cpu_x86_bfloat16()) {
280280
rtPrecision = ov::element::bf16;
281281
} else if (rtPrecision == ov::element::f16 && ov::with_cpu_x86_avx512_core_fp16()) {
282282
rtPrecision = ov::element::f16;

src/plugins/intel_cpu/src/nodes/scaled_attn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ void ScaledDotProductAttention::createPrimitive() {
12381238
std::shared_ptr<Executor> executor = nullptr;
12391239
#ifdef OPENVINO_ARCH_X86_64
12401240
if (rtPrecision == ov::element::bf16) {
1241-
if (ov::with_cpu_x86_bfloat16() && !ov::with_cpu_x86_avx2_vnni_2()) {
1241+
if (ov::with_cpu_x86_bfloat16()) {
12421242
executor = std::make_shared<AttentionExecutor<KT_ONEDNN, ov::bfloat16>>(context,
12431243
m_key_quant_param.groupSize,
12441244
m_value_quant_param.groupSize,
@@ -2082,7 +2082,7 @@ const ScaledDotProductAttention::SDPAQuantParam& ScaledDotProductAttention::getV
20822082
ov::element::Type ScaledDotProductAttention::getRuntimePrecision() const {
20832083
auto rtPrecision = getOriginalInputPrecisionAtPort(0);
20842084
// bf16 should be enabled only when platform supports
2085-
if (rtPrecision == ov::element::bf16 && ov::with_cpu_x86_bfloat16()) {
2085+
if (rtPrecision == ov::element::bf16 && (ov::with_cpu_x86_bfloat16() || mayiuse(cpu_isa_t::avx2_vnni_2))) {
20862086
rtPrecision = ov::element::bf16;
20872087
} else if (rtPrecision == ov::element::f16 && ov::intel_cpu::hasHardwareSupport(ov::element::f16)) {
20882088
rtPrecision = ov::element::f16;

src/plugins/intel_cpu/src/nodes/topk.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,9 +1986,6 @@ void TopK::initSupportedPrimitiveDescriptors() {
19861986
ov::element::u8};
19871987

19881988
ov::element::Type dataPrecision = getOriginalOutputPrecisionAtPort(TOPK_DATA);
1989-
if (dataPrecision == ov::element::bf16 && !hasHardwareSupport(ov::element::bf16)) {
1990-
THROW_CPU_NODE_ERR("gets incorrect isa for BF16!");
1991-
}
19921989
bool precisionSupported = std::find(std::begin(supportedPrecision), std::end(supportedPrecision), dataPrecision) !=
19931990
std::end(supportedPrecision);
19941991
// BF16 is not supported for AVX2_VNNI_2 platforms

src/plugins/intel_cpu/tests/functional/custom/behavior/ov_plugin/properties.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ TEST_F(OVClassConfigTestCPU, smoke_PluginSetConfigStreamsNum) {
156156
#if defined(OPENVINO_ARCH_ARM) || defined(OPENVINO_ARCH_ARM64)
157157
const auto expected_precision_for_performance_mode = ov::intel_cpu::hasHardwareSupport(ov::element::f16) ? ov::element::f16 : ov::element::f32;
158158
#else
159-
const auto expected_precision_for_performance_mode =
160-
(ov::with_cpu_x86_bfloat16() && !ov::with_cpu_x86_avx2_vnni_2()) ? ov::element::bf16 : ov::element::f32;
159+
const auto expected_precision_for_performance_mode = ov::with_cpu_x86_bfloat16() ? ov::element::bf16 : ov::element::f32;
161160
#endif
162161

163162
TEST_F(OVClassConfigTestCPU, smoke_PluginSetConfigHintInferencePrecision) {

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/random_uniform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void RandomUniformLayerTestCPU::SetUp() {
7979
updateSelectedType(getPrimitiveType(), ElementType::f32, configuration);
8080
}
8181
} else if (output_prc == ElementType::bf16) {
82-
if (ov::with_cpu_x86_bfloat16() && !ov::with_cpu_x86_avx2_vnni_2()) {
82+
if (ov::with_cpu_x86_bfloat16()) {
8383
updateSelectedType(getPrimitiveType(), ElementType::bf16, configuration);
8484
} else {
8585
updateSelectedType("ref_any", ElementType::bf16, configuration);

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/scaled_attn.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ void ScaledAttnLayerCPUTest::SetUp() {
5959
}
6060

6161
if (inType == ElementType::bf16) {
62-
rel_threshold = 2e-2f;
62+
// Issue: 163144
63+
if (with_cpu_x86_avx2_vnni_2()) {
64+
rel_threshold = 0.2f;
65+
} else {
66+
rel_threshold = 2e-2f;
67+
}
6368
}
6469
selectedType = makeSelectedTypeStr(selectedType, inType);
6570
init_input_shapes(inputShapes);
@@ -133,7 +138,7 @@ TEST_P(ScaledAttnLayerCPUTest, CompareWithRefs) {
133138
bool has_scale;
134139
std::string targetDevice;
135140
std::tie(inType, inputShapes, is_causal, has_attn, has_scale, targetDevice, cpuParams) = this->GetParam();
136-
if (inType == ElementType::bf16 && !ov::with_cpu_x86_bfloat16())
141+
if (inType == ElementType::bf16 && !ov::with_cpu_x86_bfloat16() && !with_cpu_x86_avx2_vnni_2())
137142
GTEST_SKIP();
138143
run();
139144
CheckPluginRelatedResults(compiledModel, "ScaledAttn");

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/group_convolution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ std::vector<groupConvLayerCPUTestParamsSet> filterParamsSetForDevice(
275275
auto additionalConfig = std::get<configIndex>(param);
276276
if (additionalConfig.count(ov::hint::inference_precision.name()) &&
277277
ov::element::bf16 == additionalConfig[ov::hint::inference_precision.name()].as<ov::element::Type>() &&
278-
(!ov::with_cpu_x86_bfloat16() || ov::with_cpu_x86_avx2_vnni_2())) {
278+
!ov::with_cpu_x86_bfloat16()) {
279279
continue;
280280
}
281281
resParamsSet.push_back(param);

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/matmul.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ std::vector<ov::AnyMap> filterAdditionalConfig_Brgemm() {
157157
#else
158158
std::vector<ov::AnyMap> additionalConfig = {{}};
159159
#endif
160-
if (with_cpu_x86_bfloat16()) {
160+
if (with_cpu_x86_bfloat16() || with_cpu_x86_avx2_vnni_2()) {
161161
additionalConfig.push_back({ov::hint::inference_precision(ov::element::bf16)});
162162
}
163163

0 commit comments

Comments
 (0)