@@ -100,24 +100,11 @@ class MatMulDecompressConvertTest : public testing::WithParamInterface<MatMulDec
100
100
std::tie (inputShapes, transpose, weiElemType, additionalConfig, cpuParams) = obj.param ;
101
101
102
102
std::ostringstream result;
103
- for (const auto & shape : inputShapes) {
104
- result << ov::test::utils::partialShape2str ({shape.first }) << " _" ;
105
- }
106
- result << " TS=" ;
107
- for (const auto & shape : inputShapes) {
108
- result << " (" ;
109
- if (!shape.second .empty ()) {
110
- auto itr = shape.second .begin ();
111
- do {
112
- result << ov::test::utils::vec2str (*itr);
113
- } while (++itr != shape.second .end () && result << " _" );
114
- }
115
- result << " )_" ;
116
- }
103
+ for (size_t i = 0 ; i < inputShapes.size (); ++i)
104
+ result << " IS[" << i << " ]=" << inputShapes[i] << " _" ;
117
105
result << " transpose_a=" << transpose.first << " _" ;
118
106
result << " transpose_b=" << transpose.second << " _" ;
119
-
120
- result << " weiLemType=" << weiElemType << " _" ;
107
+ result << " weiElemType=" << weiElemType << " _" ;
121
108
122
109
result << " config=(" ;
123
110
for (const auto & configEntry : additionalConfig) {
@@ -137,25 +124,6 @@ class MatMulDecompressConvertTest : public testing::WithParamInterface<MatMulDec
137
124
std::swap (*(shape.end () - 1 ), *(shape.end () - 2 ));
138
125
}
139
126
140
- void check_fc_weights_precision (ElementType expectedWeiElemType) const {
141
- auto getExecValue = [](const ov::Node::RTMap& rtInfo, const std::string& paramName) -> std::string {
142
- auto it = rtInfo.find (paramName);
143
- OPENVINO_ASSERT (rtInfo.end () != it);
144
- return it->second .as <std::string>();
145
- };
146
-
147
- const auto execFunction = compiledModel.get_runtime_model ();
148
- ASSERT_NE (nullptr , execFunction);
149
- for (const auto & fcNode : execFunction->get_ops ()) {
150
- if (getExecValue (fcNode->get_rt_info (), ov::exec_model_info::LAYER_TYPE) == " FullyConnected" ) {
151
- const auto & constNode = fcNode->get_input_node_shared_ptr (1 );
152
- ov::element::Type expectedType (
153
- getExecValue (constNode->get_rt_info (), ov::exec_model_info::OUTPUT_PRECISIONS));
154
- ASSERT_EQ (expectedType, expectedWeiElemType);
155
- }
156
- }
157
- }
158
-
159
127
void SetUp () override {
160
128
targetDevice = ov::test::utils::DEVICE_CPU;
161
129
@@ -196,23 +164,23 @@ class MatMulDecompressConvertTest : public testing::WithParamInterface<MatMulDec
196
164
197
165
configuration.insert (additionalConfig.begin (), additionalConfig.end ());
198
166
199
- ElementType netType = ElementType::f32 ;
200
- ElementType convertOutType = ElementType::f32 ;
167
+ inType = outType = netType = ElementType::f32 ;
201
168
auto it = additionalConfig.find (ov::hint::inference_precision.name ());
202
169
if (it != additionalConfig.end () && it->second .as <ov::element::Type>() == ov::element::bf16 ) {
203
- convertOutType = inType = outType = netType = ElementType::bf16 ;
170
+ netType = ElementType::bf16 ;
204
171
weiConstElemType = (weiConstElemType != ElementType::f32 ) ? weiConstElemType : ElementType::bf16 ;
205
- } else {
206
- inType = outType = netType;
172
+ // Reorder between parameter and FullyConnected
173
+ // Note: reorder between FC and Result is not needed since FC primitive supports f32 output natively
174
+ reorderCount++;
207
175
}
208
176
209
177
std::string cpuNodeType = " FullyConnected" ;
210
- selectedType = makeSelectedTypeStr (selectedType, outType );
178
+ selectedType = makeSelectedTypeStr (selectedType, netType );
211
179
212
180
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(inType, inShapeA)};
213
181
std::shared_ptr<ov::Node> inputB = ov::test::utils::make_constant (weiConstElemType, inShapeB.get_shape ());
214
- if (weiConstElemType == ElementType:: f16 || weiConstElemType == ElementType:: bf16 ) {
215
- inputB = std::make_shared<ov::op::v0::Convert>(inputB, convertOutType );
182
+ if (weiConstElemType != inType ) {
183
+ inputB = std::make_shared<ov::op::v0::Convert>(inputB, inType );
216
184
mark_as_decompression (inputB);
217
185
}
218
186
expectedWeiConstElemType = weiConstElemType;
@@ -223,18 +191,22 @@ class MatMulDecompressConvertTest : public testing::WithParamInterface<MatMulDec
223
191
}
224
192
225
193
virtual void check_execution_graph () {
194
+ CheckNodePrecisionsWithType (compiledModel, " FullyConnected" , {netType, expectedWeiConstElemType, ov::element::undefined}, {outType});
226
195
CheckPluginRelatedResults (compiledModel, " FullyConnected" );
227
196
CheckNumberOfNodesWithType (compiledModel, " FullyConnected" , fullyConnectedCount);
228
197
CheckNumberOfNodesWithType (compiledModel, " Transpose" , transposeCount);
229
198
CheckNumberOfNodesWithType (compiledModel, " Convert" , convertCount);
230
- CheckNumberOfNodesWithType (compiledModel, " Reorder" , 0 );
231
- check_fc_weights_precision (expectedWeiConstElemType);
199
+ // Note: Convert node might be converted to Subgraph
200
+ CheckNumberOfNodesWithType (compiledModel, " Subgraph" , 0 );
201
+ CheckNumberOfNodesWithType (compiledModel, " Reorder" , reorderCount);
232
202
}
233
203
234
204
size_t fullyConnectedCount = 1 ;
235
205
size_t transposeCount = 0 ;
236
206
size_t convertCount = 0 ;
207
+ size_t reorderCount = 0 ;
237
208
ElementType expectedWeiConstElemType = ElementType::f32 ;
209
+ ElementType netType = ElementType::f32 ;
238
210
};
239
211
240
212
TEST_P (MatMulDecompressConvertTest, CompareWithRefs) {
@@ -266,11 +238,9 @@ const std::vector<std::vector<InputShape>> inputShapes3D = {
266
238
{{{-1 , -1 , -1 }, {{1 , 2 , 3 }, {1 , 5 , 3 }}}, {{1 , 3 , 4 }, {{1 , 3 , 4 }, {1 , 3 , 4 }}}},
267
239
};
268
240
269
- ov::AnyMap emptyConfig = {/* empty config */ };
270
-
271
241
std::vector<ov::AnyMap> filter_additional_config_bf16 () {
272
242
std::vector<ov::AnyMap> additionalConfig;
273
- if (ov::with_cpu_x86_avx512_core ()) {
243
+ if (ov::with_cpu_x86_bfloat16 ()) {
274
244
additionalConfig.push_back ({{ov::hint::inference_precision (ov::element::bf16 )}});
275
245
}
276
246
return additionalConfig;
@@ -307,7 +277,7 @@ std::vector<CPUSpecificParams> filter_specific_params_bf16() {
307
277
const auto testParams2D_FP32_smoke = ::testing::Combine(::testing::ValuesIn(inputShapes2D),
308
278
::testing::ValuesIn (transposeParams),
309
279
::testing::Values(ElementType::f32 ),
310
- ::testing::Values(emptyConfig ),
280
+ ::testing::Values(CPUTestUtils::empty_plugin_config ),
311
281
::testing::ValuesIn(filter_specific_params(true )));
312
282
313
283
INSTANTIATE_TEST_SUITE_P (smoke_FC_2D_FP32,
@@ -318,7 +288,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_FC_2D_FP32,
318
288
const auto testParams2D_smoke = ::testing::Combine(::testing::ValuesIn(inputShapes2D),
319
289
::testing::ValuesIn (transposeParams),
320
290
::testing::Values(ElementType::f16 , ElementType::bf16 ),
321
- ::testing::Values(emptyConfig ),
291
+ ::testing::Values(CPUTestUtils::empty_plugin_config ),
322
292
::testing::ValuesIn(filter_specific_params(false )));
323
293
324
294
INSTANTIATE_TEST_SUITE_P (smoke_FC_2D,
@@ -340,7 +310,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_FC_2D_BF16,
340
310
const auto testParams3D_FP32_smoke = ::testing::Combine(::testing::ValuesIn(inputShapes3D),
341
311
::testing::ValuesIn (transposeParams),
342
312
::testing::Values(ElementType::f32 ),
343
- ::testing::Values(emptyConfig ),
313
+ ::testing::Values(CPUTestUtils::empty_plugin_config ),
344
314
::testing::ValuesIn(filter_specific_params(true )));
345
315
346
316
INSTANTIATE_TEST_SUITE_P (smoke_FC_3D_FP32,
@@ -351,7 +321,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_FC_3D_FP32,
351
321
const auto testParams3D_smoke = ::testing::Combine(::testing::ValuesIn(inputShapes3D),
352
322
::testing::ValuesIn (transposeParams),
353
323
::testing::Values(ElementType::f16 , ElementType::bf16 ),
354
- ::testing::Values(emptyConfig ),
324
+ ::testing::Values(CPUTestUtils::empty_plugin_config ),
355
325
::testing::ValuesIn(filter_specific_params(false )));
356
326
357
327
INSTANTIATE_TEST_SUITE_P (smoke_FC_3D,
@@ -460,26 +430,26 @@ class MatMulDecompressConvertTest2 : public MatMulDecompressConvertTest {
460
430
461
431
configuration.insert (additionalConfig.begin (), additionalConfig.end ());
462
432
463
- ElementType netType = ElementType::f32 ;
464
- ElementType convertOutType = ElementType::f32 ;
433
+ inType = outType = netType = ElementType::f32 ;
465
434
auto it = additionalConfig.find (ov::hint::inference_precision.name ());
466
435
if (it != additionalConfig.end () && it->second .as <ov::element::Type>() == ov::element::bf16 ) {
467
- convertOutType = inType = outType = netType = ElementType::bf16 ;
436
+ netType = ElementType::bf16 ;
468
437
weiConstElemType = (weiConstElemType != ElementType::f32 ) ? weiConstElemType : ElementType::bf16 ;
469
- } else {
470
- inType = outType = netType;
438
+ // Reorder between parameter and FullyConnected
439
+ // Note: reorder between FC and Result is not needed since FC primitive supports f32 output natively
440
+ reorderCount++;
471
441
}
472
442
473
443
std::string cpuNodeType = " FullyConnected" ;
474
- selectedType = makeSelectedTypeStr (selectedType, outType );
444
+ selectedType = makeSelectedTypeStr (selectedType, netType );
475
445
476
446
ov::ParameterVector params;
477
447
for (auto && shape : {inShapeFC0, inShapeFC1}) {
478
448
params.push_back (std::make_shared<ov::op::v0::Parameter>(inType, shape));
479
449
}
480
450
std::shared_ptr<ov::Node> inputWeights = ov::test::utils::make_constant (weiConstElemType, inShapeWeights.get_shape ());
481
- if (weiConstElemType == ElementType:: f16 ) {
482
- inputWeights = std::make_shared<ov::op::v0::Convert>(inputWeights, convertOutType );
451
+ if (weiConstElemType != inType ) {
452
+ inputWeights = std::make_shared<ov::op::v0::Convert>(inputWeights, inType );
483
453
mark_as_decompression (inputWeights);
484
454
}
485
455
expectedWeiConstElemType = weiConstElemType;
@@ -505,7 +475,7 @@ const auto testParams2D_FP16_2_smoke =
505
475
::testing::Combine (::testing::Values(static_shapes_to_test_representation({{2 , 3 }, {2 , 3 }, {3 , 4 }})),
506
476
::testing::Values(std::pair<bool , bool >{false , true }),
507
477
::testing::Values(ElementType::f16 ),
508
- ::testing::Values(emptyConfig ),
478
+ ::testing::Values(CPUTestUtils::empty_plugin_config ),
509
479
::testing::ValuesIn(filter_specific_params(false )));
510
480
511
481
INSTANTIATE_TEST_SUITE_P (smoke_FC_2D_FP16_2,
@@ -644,7 +614,7 @@ const auto testParams2D_FP16_3_smoke =
644
614
::testing::Combine (::testing::Values(static_shapes_to_test_representation({{1 , 16 , 32 }, {32 , 64 }})),
645
615
::testing::Values(std::pair<bool , bool >{false , false }),
646
616
::testing::Values(ElementType::f16 ),
647
- ::testing::Values(emptyConfig ),
617
+ ::testing::Values(CPUTestUtils::empty_plugin_config ),
648
618
::testing::ValuesIn(filter_specific_params(false )));
649
619
650
620
INSTANTIATE_TEST_SUITE_P (smoke_FC_2D_FP16_3,
0 commit comments