Skip to content

Commit 9b01da1

Browse files
committed
Extend cpu functional testing on LNL+ systems
1 parent b1a07c7 commit 9b01da1

File tree

6 files changed

+47
-8
lines changed

6 files changed

+47
-8
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ 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+
114121
/**
115122
* @brief Checks whether CPU supports AVX 512 capability
116123
* @ingroup ov_dev_api_system_conf

src/inference/src/system_conf.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ 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+
7883
bool with_cpu_x86_avx512f() {
7984
return get_cpu_info().has(Xbyak::util::Cpu::tAVX512F);
8085
}
@@ -133,6 +138,9 @@ bool with_cpu_x86_avx2() {
133138
bool with_cpu_x86_avx2_vnni() {
134139
return false;
135140
}
141+
bool with_cpu_x86_avx2_vnni_2() {
142+
return false;
143+
}
136144
bool with_cpu_x86_avx512f() {
137145
return false;
138146
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ const ScaledDotProductAttention::SDPAQuantParam& ScaledDotProductAttention::getV
20752075
ov::element::Type ScaledDotProductAttention::getRuntimePrecision() const {
20762076
auto rtPrecision = getOriginalInputPrecisionAtPort(0);
20772077
// bf16 should be enabled only when platform supports
2078-
if (rtPrecision == ov::element::bf16 && ov::with_cpu_x86_bfloat16()) {
2078+
if (rtPrecision == ov::element::bf16 && (ov::with_cpu_x86_bfloat16() || with_cpu_x86_avx2_vnni_2())) {
20792079
rtPrecision = ov::element::bf16;
20802080
} else if (rtPrecision == ov::element::f16 && ov::intel_cpu::hasHardwareSupport(ov::element::f16)) {
20812081
rtPrecision = ov::element::f16;

src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,13 @@ std::vector<std::string> disabledTestPatterns() {
492492
retVector.emplace_back(R"(.*smoke_RDFT_CPU_2D/RDFTTestCPU.CompareWithRefs/prec=f32_IS0=\[\]_TS0=\(\(16.38\)\)_constAxes=true_axes=\(\(0.1\)\)_isInverse=false.*)");
493493
#endif
494494
if (!ov::with_cpu_x86_avx512_core()) {
495+
// Issue: MFDNN-12818
496+
retVector.emplace_back(
497+
R"(.*smoke_LPT/RecurrentCellTransformation.CompareWithRefImpl/f32_\[1,1,3\]_CPU_f32FQ_X_level=256_.*_FQ_W_level=255.*)");
498+
retVector.emplace_back(
499+
R"(.*smoke_static/ConvertFqRnnToQuantizedRnn.CompareWithRefs/Type=GRUSequence.*2.5.10.*2.1.4.*2.1.4.*)");
500+
}
501+
if (!ov::intel_cpu::hasHardwareSupport(ov::element::bf16)) {
495502
// on platforms which do not support bfloat16, we are disabling bf16 tests since there are no bf16 primitives,
496503
// tests are useless on such platforms
497504
retVector.emplace_back(R"(.*(BF|bf)16.*)");
@@ -504,7 +511,7 @@ std::vector<std::string> disabledTestPatterns() {
504511
retVector.emplace_back(R"(.*Snippets.*MHA.*)");
505512
retVector.emplace_back(R"(.*Snippets.*(MatMul|Matmul).*)");
506513
}
507-
if (!ov::with_cpu_x86_avx512_core_fp16()) {
514+
if (!ov::intel_cpu::hasHardwareSupport(ov::element::f16)) {
508515
// Skip fp16 tests for paltforms that don't support fp16 precision
509516
retVector.emplace_back(R"(.*INFERENCE_PRECISION_HINT=(F|f)16.*)");
510517
retVector.emplace_back(R"(.*ConcatMultiQuerySDPTest.*f16.*)");
@@ -638,7 +645,7 @@ std::vector<std::string> disabledTestPatterns() {
638645
retVector.emplace_back(R"(.*smoke_Deconv_(2|3)D_NSPC_INT8_AMX/DeconvolutionLayerCPUTest.*)");
639646
}
640647

641-
if (ov::with_cpu_x86_avx512_core_fp16()) {
648+
if (ov::with_cpu_x86_avx512_core_fp16() || ov::with_cpu_x86_avx2_vnni_2()) {
642649
// Issue: 143852
643650
retVector.emplace_back(R"(smoke_ConvertRangeSubgraphCPUTest/ConvertRangeSubgraphCPUTest\.CompareWithRefs.*Prc=f16.*)");
644651
retVector.emplace_back(R"((smoke|nightly)_FC_3D_FP16/.*_Fused=Multiply\(PerChannel\).*)");
@@ -649,5 +656,13 @@ std::vector<std::string> disabledTestPatterns() {
649656
retVector.emplace_back(R"(smoke_Conv_Sum_Broadcast_FP16/ConvSumInPlaceTest.*Relu\.Multiply\(PerChannel\)\.Add\(PerChannel\).*)");
650657
}
651658

659+
if (ov::with_cpu_x86_avx2_vnni_2()) {
660+
// jit_gemm_BF16 kernels are not supported for conv,inner_product,matmul on avx2_vnni_2 platforms
661+
retVector.emplace_back(R"(smoke_Conv_.*D_GEMM_BF16.*)");
662+
retVector.emplace_back(
663+
R"(smoke_GroupConv_.*D_Gemm_BF16/GroupConvolutionLayerCPUTest.CompareWithRefs.*primitive=jit_gemm.*)");
664+
retVector.emplace_back(R"(smoke_.*MatMulLayerCPUTest.*INFERENCE_PRECISION_HINT=bf16.*_primitive=jit_gemm.*)");
665+
}
666+
652667
return retVector;
653668
}

src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,10 @@ CPUTestsBase::deduce_expected_precision(const ov::element::Type& opPrecision,
472472
if (it != configuration.end()) {
473473
auto inferencePrecisionConfig = it->second.as<ov::element::Type>();
474474
inferencePrecisionSetExplicitly = true;
475-
// TODO also need to check (dnnl::impl::cpu::x64::avx2_vnni_2)
476-
if ((inferencePrecisionConfig == ov::element::bf16 && ov::with_cpu_x86_avx512_core()) ||
477-
(inferencePrecisionConfig == ov::element::f16 && ov::with_cpu_x86_avx512_core_fp16()) ||
475+
if ((inferencePrecisionConfig == ov::element::bf16 &&
476+
(ov::with_cpu_x86_avx512_core() || ov::with_cpu_x86_avx2_vnni_2())) ||
477+
(inferencePrecisionConfig == ov::element::f16 &&
478+
(ov::with_cpu_x86_avx512_core_fp16() || ov::with_cpu_x86_avx2_vnni_2())) ||
478479
(inferencePrecisionConfig == ov::element::f32) || (inferencePrecisionConfig == ov::element::dynamic)) {
479480
inferencePrecision = inferencePrecisionConfig;
480481
}
@@ -495,7 +496,8 @@ CPUTestsBase::deduce_expected_precision(const ov::element::Type& opPrecision,
495496
ov::element::Type deducedType = opPrecision;
496497
// enforceInferPrecision stage
497498
if (inferencePrecision == ov::element::bf16) {
498-
deducedType = ov::with_cpu_x86_avx512_core() ? ov::element::bf16 : ov::element::f32;
499+
deducedType =
500+
(ov::with_cpu_x86_avx512_core() || ov::with_cpu_x86_avx2_vnni_2()) ? ov::element::bf16 : ov::element::f32;
499501
}
500502

501503
// ngraph transform pipeline stage
@@ -505,7 +507,8 @@ CPUTestsBase::deduce_expected_precision(const ov::element::Type& opPrecision,
505507
}
506508
}
507509
if (deducedType == ov::element::bf16) {
508-
deducedType = ov::with_cpu_x86_avx512_core() ? ov::element::bf16 : ov::element::f32;
510+
deducedType =
511+
(ov::with_cpu_x86_avx512_core() || ov::with_cpu_x86_avx2_vnni_2()) ? ov::element::bf16 : ov::element::f32;
509512
} else if (deducedType == ov::element::f16) {
510513
if (inferencePrecision != ov::element::f16 && inferencePrecision != ov::element::dynamic) {
511514
deducedType = ov::element::f32;

src/tests/functional/shared_test_classes/src/base/ov_subgraph.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ void SubgraphBaseTest::compile_model() {
307307
}
308308
try {
309309
inference_precision = core->get_property(targetDevice, ov::hint::inference_precision);
310+
// for avx2_vnni_2 platforms use the set inference_precision hint in case generate higher threshold during
311+
// following calculate_thresholds stage
312+
if (ov::with_cpu_x86_avx2_vnni_2() &&
313+
configuration.find(ov::hint::inference_precision.name()) != configuration.end()) {
314+
inference_precision = configuration.at(ov::hint::inference_precision.name()).as<ov::element::Type>();
315+
}
310316
} catch (std::exception& e) {
311317
std::cout << "[ WARNING ] Impossible to get Inference Precision with exception: " << e.what() << std::endl;
312318
}

0 commit comments

Comments
 (0)