Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

ConvertFullyConnectedToFullyConnectedCompressed callback for 3d weights (#33246)

Chenhu Wang3968c4c81cf0
diff --git a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
index 8b495d66fb6..930a6f245cd 100644
--- a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
+++ b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
@@ -169,6 +169,11 @@ bool FullyConnected::isSupportedCompressedOperation([[maybe_unused]] const std::
if (IC % G != 0 || IC / G < 4 || OC == 1) {
return false;
}
+
+ // 3D weights decompression is not supported due to the oneDNN limitations.
+ if (op->get_input_partial_shape(WEIGHTS).rank().get_length() == 3) {
+ return false;
+ }
} catch (...) {
return false;
}
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp
index 2c2dc113192..d31e4d12151 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp
@@ -423,6 +423,26 @@ INSTANTIATE_TEST_SUITE_P(smoke_MatMulCompressedWeights_non_multiples_groups,
::testing::Values(true)),
MatmulWeightsDecompression::getTestCaseName);
+// 3D compressed weights should not be performed as FCCompressed,
+// but as decompression subgraph and f32 FC, due to onednn limitation.
+const std::vector<MatMulDecompressionShapeParams> input_shapes_with_3d_weight = {
+ {{{}, {{3, 10, 32}}}, {3, 32, 128}},
+ {{{}, {{2, 16}}}, {5, 16, 64}},
+};
+INSTANTIATE_TEST_SUITE_P(smoke_MatMulCompressedWeights_3D_Weights,
+ MatmulWeightsDecompression,
+ ::testing::Combine(::testing::ValuesIn(input_shapes_with_3d_weight),
+ ::testing::ValuesIn(weights_precisions),
+ ::testing::ValuesIn(decompression_precisions),
+ ::testing::Values(ov::element::dynamic),
+ ::testing::Values(false),
+ ::testing::Values(DecompressionType::full),
+ ::testing::Values(DecompressionType::empty),
+ ::testing::Values(false),
+ ::testing::ValuesIn(filter_additional_config_basic()),
+ ::testing::Values(emptyFusingSpec),
+ ::testing::Values(false)),
+ MatmulWeightsDecompression::getTestCaseName);
} // namespace
} // namespace test
} // namespace ov