@@ -70,6 +70,7 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {
7070 }
7171 }
7272
73+ #if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
7374 auto is_3d_decompression_path = [](const std::shared_ptr<Node>& root) {
7475 std::shared_ptr<Node> multiply_node = ov::as_type_ptr<ov::op::v1::Multiply>(root);
7576 if (!multiply_node) {
@@ -102,6 +103,7 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {
102103 if (is_3d_decompression_path (fc_input_b.get_node_shared_ptr ())) {
103104 return false ;
104105 }
106+ #endif
105107
106108 auto shape_a = fc_input_a.get_partial_shape ();
107109 auto shape_b = fc_input_b.get_partial_shape ();
@@ -126,6 +128,7 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {
126128 // 3-d case:
127129 // [1,2,3] --> node::fc --> dnnl::inner-product
128130 // [2,3,4] --> node::fc --> dnnl::matmul
131+ #if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
129132 if (std::count_if (shape_b.begin (),
130133 shape_b.end (),
131134 [](const ov::Dimension& x) {
@@ -134,6 +137,13 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {
134137 shape_b.size () > 3 ) {
135138 return false ;
136139 }
140+ #else
141+ if (std::count_if (shape_b.begin (), shape_b.end (), [](const ov::Dimension& x) {
142+ return x != 1 ;
143+ }) > 2 ) {
144+ return false ;
145+ }
146+ #endif
137147 /*
138148 * get_aligned_shapes function align two input shapes to have the same size and
139149 * the same batch dimensions (last two dimensions are not comparable).
@@ -166,13 +176,23 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {
166176 // [2,1,1,4] --> node::matmul
167177 // [1,1,2,4] --> node::fc
168178 // [2,3,4] --> node::fc --> dnnl::matmul
179+ #if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
169180 if (max_size > 3 ) {
170181 for (size_t i = 0 ; i < max_size - 2 ; ++i) {
171182 if (shape_b_aligned[i] != 1 ) {
172183 return std::make_tuple (false , std::move (shape_a_aligned), std::move (shape_b_aligned));
173184 }
174185 }
175186 }
187+ #else
188+ for (size_t i = 0 ; i < max_size - 2 ; ++i) {
189+ if (shape_b_aligned[i] == 1 ) {
190+ shape_b_aligned[i] = shape_a_aligned[i];
191+ } else {
192+ return std::make_tuple (false , std::move (shape_a_aligned), std::move (shape_b_aligned));
193+ }
194+ }
195+ #endif
176196 return std::make_tuple (true , std::move (shape_a_aligned), std::move (shape_b_aligned));
177197 };
178198
0 commit comments