File tree Expand file tree Collapse file tree 4 files changed +25
-5
lines changed
tests/functional/custom/single_layer_tests Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 1818#include " openvino/core/parallel.hpp"
1919#include " openvino/op/topk.hpp"
2020#include " utils/ngraph_utils.hpp"
21+ #include " utils/cpu_utils.hpp"
2122
2223using namespace dnnl ;
2324using namespace dnnl ::impl;
@@ -1984,11 +1985,14 @@ void TopK::initSupportedPrimitiveDescriptors() {
19841985 ov::element::u8 };
19851986
19861987 ov::element::Type dataPrecision = getOriginalOutputPrecisionAtPort (TOPK_DATA);
1987- if (dataPrecision == ov::element::bf16 && !mayiuse (avx512_core )) {
1988- THROW_CPU_NODE_ERR (" gets incorrect isa for BF16! AVX512 must be supported! " );
1988+ if (dataPrecision == ov::element::bf16 && !hasHardwareSupport (ov::element:: bf16 )) {
1989+ THROW_CPU_NODE_ERR (" gets incorrect isa for BF16!" );
19891990 }
19901991 bool precisionSupported = std::find (std::begin (supportedPrecision), std::end (supportedPrecision), dataPrecision) !=
19911992 std::end (supportedPrecision);
1993+ // BF16 is not supported for AVX2_VNNI_2 platforms
1994+ precisionSupported =
1995+ (dataPrecision == ov::element::bf16 && mayiuse (cpu::x64::avx2_vnni_2)) ? false : precisionSupported;
19921996 if (!precisionSupported) {
19931997 if (dataPrecision.is_real ()) {
19941998 dataPrecision = ov::element::f32 ;
Original file line number Diff line number Diff line change @@ -64,7 +64,13 @@ class NormalizeL2LayerCPUTest : public testing::WithParamInterface<NormalizeL2La
6464 if (selectedType.empty ()) {
6565 selectedType = getPrimitiveType ();
6666 }
67- selectedType = makeSelectedTypeStr (" unknown" , inType);
67+ // BF16 is not supported for NormalizeL2 on AVX2_VNNI_2 platforms
68+ if (ov::with_cpu_x86_avx2_vnni_2 () && inType == ElementType::bf16 ) {
69+ selectedType = makeSelectedTypeStr (" unknown" , ElementType::f32 );
70+ } else {
71+ selectedType = makeSelectedTypeStr (" unknown" , inType);
72+ }
73+
6874 targetDevice = ov::test::utils::DEVICE_CPU;
6975 init_input_shapes ({shapes});
7076
Original file line number Diff line number Diff line change @@ -194,7 +194,12 @@ class ROIPoolingCPULayerTest : public testing::WithParamInterface<ROIPoolingCPUT
194194 selectedType = getPrimitiveType ();
195195 }
196196 selectedType.push_back (' _' );
197- selectedType += netPrecision.to_string ();
197+ // BF16 is not supported for ROIPooling on AVX2_VNNI_2 platforms
198+ if (ov::with_cpu_x86_avx2_vnni_2 () && netPrecision == ElementType::bf16 ) {
199+ selectedType += ov::element::f32 .to_string ();
200+ } else {
201+ selectedType += netPrecision.to_string ();
202+ }
198203
199204 if (netPrecision == ov::element::bf16 ) {
200205 rel_threshold = 1e-2 ;
Original file line number Diff line number Diff line change @@ -102,7 +102,12 @@ class TopKLayerCPUTest : public testing::WithParamInterface<TopKLayerCPUTestPara
102102 inPrc = outPrc = netPrecision;
103103 configuration.insert (additionalConfig.begin (), additionalConfig.end ());
104104
105- selectedType = getPrimitiveType () + " _" + ov::element::Type (netPrecision).get_type_name ();
105+ // BF16 is not supported for TopK on AVX2_VNNI_2 platforms
106+ if (ov::with_cpu_x86_avx2_vnni_2 () && netPrecision == ElementType::bf16 ) {
107+ selectedType = makeSelectedTypeStr (getPrimitiveType (), ElementType::f32 );
108+ } else {
109+ selectedType = makeSelectedTypeStr (getPrimitiveType (), netPrecision);
110+ }
106111
107112 staticShape = inputShape.first .rank () == 0 ;
108113 if (staticShape) {
You can’t perform that action at this time.
0 commit comments