From aaa634874c639d881e2ab7dc14df76a05fa6e64f Mon Sep 17 00:00:00 2001 From: M Date: Sun, 9 Jun 2024 23:34:15 -0600 Subject: [PATCH] [GSOC][CPU][ARM] Activate SDPA for ARM devices (#24898) ### Details: - This PR activates the Scaled Dot Product Attention (SDPA) operation on ARM devices --- src/plugins/intel_cpu/src/nodes_factory.cpp | 2 +- .../intel_cpu/src/transformations/transformation_pipeline.cpp | 2 +- .../instances/{x64 => common}/scaled_attn.cpp | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/{x64 => common}/scaled_attn.cpp (100%) diff --git a/src/plugins/intel_cpu/src/nodes_factory.cpp b/src/plugins/intel_cpu/src/nodes_factory.cpp index f82f0adece1..e45c9104e30 100644 --- a/src/plugins/intel_cpu/src/nodes_factory.cpp +++ b/src/plugins/intel_cpu/src/nodes_factory.cpp @@ -207,6 +207,7 @@ Node::NodesFactory::NodesFactory() : Factory("NodesFactory") { INTEL_CPU_NODE(RDFT, Type::RDFT); INTEL_CPU_NODE(ExtractImagePatches, Type::ExtractImagePatches); INTEL_CPU_NODE(Subgraph, Type::Subgraph); + INTEL_CPU_NODE(ScaledDotProductAttention, Type::ScaledDotProductAttention); #if defined(OPENVINO_ARCH_X86_64) INTEL_CPU_NODE(FakeQuantize, Type::FakeQuantize); INTEL_CPU_NODE(GridSample, Type::GridSample); @@ -214,7 +215,6 @@ Node::NodesFactory::NodesFactory() : Factory("NodesFactory") { INTEL_CPU_NODE(LLMMLP, Type::LLMMLP); INTEL_CPU_NODE(QKVProjection, Type::QKVProjection); INTEL_CPU_NODE(MHA, Type::MHA); - INTEL_CPU_NODE(ScaledDotProductAttention, Type::ScaledDotProductAttention); INTEL_CPU_NODE(PagedAttention, Type::PagedAttention); #endif } diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp index 7963a2bcb98..0da2f8fe0cb 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp @@ -564,7 +564,7 @@ void Transformations::PreLpt(const std::vector& defaultPrecis CPU_SET_CALLBACK_COMMON(manager, nmsCallback, ov::pass::ConvertNMS9ToNMSIEInternal); CPU_SET_CALLBACK_COMMON(manager, nmsCallback, ov::pass::ConvertMulticlassNmsToMulticlassNmsIE); CPU_SET_CALLBACK_COMMON(manager, nmsCallback, ov::pass::ConvertMatrixNmsToMatrixNmsIE); - CPU_SET_CALLBACK_X64(manager, + CPU_SET_CALLBACK_COMMON(manager, [this](const_node_ptr &node) -> bool { std::string errorMsg; // Current SDPA impl is optimized only for LLM models, so we decompose it for others to avoid perf regression. diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/scaled_attn.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/scaled_attn.cpp similarity index 100% rename from src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/scaled_attn.cpp rename to src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/scaled_attn.cpp