Skip to content

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

[Snippets][CPU][RV64] Enable softmax tokenization (#35719)

Arseniy Obolenskiyddeaa6272cea
diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
index 91bdc628e90..c0d9230e7b5 100644
--- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
+++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
@@ -1417,14 +1417,19 @@ void Transformations::MainSnippets() {
// todo: general tokenization flow is not currently supported for these operations.
// they can be tokenized only as a part of complex patterns
auto is_unsupported_by_common_tokenization = [](const std::shared_ptr<const ov::Node>& n) {
- return (ov::is_type_any_of<const ov::op::v1::Softmax,
- const ov::op::v8::Softmax,
- const ov::op::v0::MatMul,
- const ov::op::v1::Transpose,
- const ov::op::v1::Broadcast,
- const ov::op::v3::Broadcast,
- const ov::op::v1::ReduceMax,
- const ov::op::v1::ReduceSum>(n));
+#if defined(OPENVINO_ARCH_RISCV64)
+ constexpr bool is_unsupported_softmax = false;
+#else
+ const auto is_unsupported_softmax =
+ ov::is_type_any_of<const ov::op::v1::Softmax, const ov::op::v8::Softmax>(n);
+#endif
+
+ return is_unsupported_softmax || (ov::is_type_any_of<const ov::op::v0::MatMul,
+ const ov::op::v1::Transpose,
+ const ov::op::v1::Broadcast,
+ const ov::op::v3::Broadcast,
+ const ov::op::v1::ReduceMax,
+ const ov::op::v1::ReduceSum>(n));
};
return !is_unsupported(n) && !is_unsupported_by_common_tokenization(n);
};