Skip to content

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

[Snippets][CPU][RV64] Enable Swish tokenization (#38638)

Arseniy Obolenskiy9f74cd463bbb
diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
index 621429ec839..d44ed23a99a 100644
--- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
+++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
@@ -28,6 +28,7 @@
#include "openvino/core/node_output.hpp"
#include "openvino/core/parallel.hpp"
#include "openvino/core/rt_info.hpp"
+#include "openvino/core/shape.hpp"
#include "openvino/core/type.hpp"
#include "openvino/core/type/element_type.hpp"
#include "openvino/itt.hpp"
@@ -1448,15 +1449,15 @@ void Transformations::MainSnippets() {
// CPU Plugin supports Swish in Subgraph via conversion to SwishCPU that requires scalar beta.
// CPU Plugin does not support Mish for x64
auto is_unsupported = [](const std::shared_ptr<const ov::Node>& n) {
- return (ov::is_type<const ov::op::v4::Swish>(n) && n->inputs().size() > 1 &&
- !ov::is_type<const ov::op::v0::Constant>(n->get_input_node_shared_ptr(1)))
+ if (ov::is_type<const ov::op::v4::Swish>(n) && n->get_input_size() > 1) {
+ return !ov::is_type<const ov::op::v0::Constant>(n->get_input_node_shared_ptr(1)) ||
+ ov::shape_size(n->get_input_shape(1)) != 1;
+ }
#if defined(OPENVINO_ARCH_X86_64)
- || ov::is_type<const ov::op::v4::Mish>(n)
-#elif defined(OPENVINO_ARCH_RISCV64)
- // These operations are not currently supported in the RISC-V snippets target machine.
- || ov::is_type<const ov::op::v4::Swish>(n)
+ return ov::is_type<const ov::op::v4::Mish>(n);
+#else
+ return false;
#endif
- ;
};
// todo: general tokenization flow is not currently supported for these operations.
// they can be tokenized only as a part of complex patterns
diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp
index ea57abf4860..2643ef94b08 100644
--- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp
+++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp
@@ -490,7 +490,6 @@ const std::vector<std::regex>& disabled_test_patterns() {
std::regex(R"(.*smoke_Snippets_MLP.*)"),
std::regex(R"(.*smoke_Snippets_GatedMLP.*)"),
std::regex(R"(.*smoke_Snippets_SoftmaxSum.*\?\..*)"),
- std::regex(R"(.*smoke_Snippets_FQDecomposition.*Swish.*)"),
std::regex(R"(.*smoke_Snippets_GroupNormalization.*)"),
std::regex(R"(.*smoke_Snippets_TransposeMatMulBias/ExplicitTransposeMatMulBias.*)"),
// Accuracy problem in dynamic MHA tests