Skip to content

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

[CPU] Add SelectiveSSM JIT optimizations (#37634)

Nesterov Alexander4cf071f31a3b
diff --git a/src/plugins/intel_cpu/sources.cmake b/src/plugins/intel_cpu/sources.cmake
index cb190e9d826..e98593e5eae 100644
--- a/src/plugins/intel_cpu/sources.cmake
+++ b/src/plugins/intel_cpu/sources.cmake
@@ -798,6 +798,8 @@ set(CPU_PLUGIN_X64_SRCS
${CPU_SRC_DIR}/nodes/executors/x64/jit_transpose.hpp
${CPU_SRC_DIR}/nodes/executors/x64/matmul_small.cpp
${CPU_SRC_DIR}/nodes/executors/x64/matmul_small.hpp
+ ${CPU_SRC_DIR}/nodes/executors/x64/selective_ssm_jit_executor.cpp
+ ${CPU_SRC_DIR}/nodes/executors/x64/selective_ssm_jit_executor.hpp
${CPU_SRC_DIR}/nodes/executors/x64/subgraph.cpp
${CPU_SRC_DIR}/nodes/executors/x64/subgraph.hpp
${CPU_SRC_DIR}/nodes/kernels/x64/brgemm_kernel.cpp
@@ -833,6 +835,10 @@ set(CPU_PLUGIN_X64_SRCS
${CPU_SRC_DIR}/nodes/kernels/x64/rms_kernel.hpp
${CPU_SRC_DIR}/nodes/kernels/x64/rope_kernel.cpp
${CPU_SRC_DIR}/nodes/kernels/x64/rope_kernel.hpp
+ ${CPU_SRC_DIR}/nodes/kernels/x64/selective_ssm_jit_kernel.cpp
+ ${CPU_SRC_DIR}/nodes/kernels/x64/selective_ssm_jit_kernel.hpp
+ ${CPU_SRC_DIR}/nodes/kernels/x64/selective_ssm_jit_runtime.cpp
+ ${CPU_SRC_DIR}/nodes/kernels/x64/selective_ssm_jit_runtime.hpp
${CPU_SRC_DIR}/transformations/cpu_opset/x64/op/interaction.cpp
${CPU_SRC_DIR}/transformations/cpu_opset/x64/op/interaction.hpp
${CPU_SRC_DIR}/transformations/cpu_opset/x64/op/llm_mlp.cpp
diff --git a/src/plugins/intel_cpu/src/nodes/executors/paged_selective_ssm_implementations.cpp b/src/plugins/intel_cpu/src/nodes/executors/paged_selective_ssm_implementations.cpp
index e7a449a13b9..2f2e205af04 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/paged_selective_ssm_implementations.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/paged_selective_ssm_implementations.cpp
@@ -12,12 +12,30 @@
#include "nodes/executors/paged_selective_ssm_config.hpp"
#include "utils/arch_macros.h"
+#if defined(OPENVINO_ARCH_X86_64)
+# include "nodes/executors/memory_arguments.hpp"
+# include "nodes/executors/x64/selective_ssm_jit_executor.hpp"
+#endif
+
namespace ov::intel_cpu {
// clang-format off
template <>
const std::vector<ExecutorImplementation<PagedSelectiveSSMAttrs>>& getImplementations() {
static const std::vector<ExecutorImplementation<PagedSelectiveSSMAttrs>> implementations {
+ OV_CPU_INSTANCE_X64(
+ "paged_selective_ssm_jit_executor",
+ ExecutorType::Jit,
+ OperationType::PagedSelectiveSSM,
+ [](const PagedSelectiveSSMConfig& config) -> bool {
+ return PagedSelectiveSSMJitExecutor::supports(config);
+ },
+ HasNoOptimalConfig<PagedSelectiveSSMAttrs>{},
+ [](const PagedSelectiveSSMAttrs&, const MemoryArgs& memory) -> bool {
+ return PagedSelectiveSSMJitExecutor::accepts_shape(memory);
+ },
+ CreateDefault<PagedSelectiveSSMJitExecutor, PagedSelectiveSSMAttrs>{}
+ )
OV_CPU_INSTANCE_COMMON(
"paged_selective_ssm_common_executor",
ExecutorType::Common,
diff --git a/src/plugins/intel_cpu/src/nodes/executors/selective_ssm_implementations.cpp b/src/plugins/intel_cpu/src/nodes/executors/selective_ssm_implementations.cpp
index 5681be72d91..7bf4fc4f567 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/selective_ssm_implementations.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/selective_ssm_implementations.cpp
@@ -12,12 +12,30 @@
#include "nodes/executors/selective_ssm_config.hpp"
#include "utils/arch_macros.h"
+#if defined(OPENVINO_ARCH_X86_64)
+# include "nodes/executors/memory_arguments.hpp"
+# include "nodes/executors/x64/selective_ssm_jit_executor.hpp"
+#endif
+
namespace ov::intel_cpu {
// clang-format off
template <>
const std::vector<ExecutorImplementation<SelectiveSSMAttrs>>& getImplementations() {
static const std::vector<ExecutorImplementation<SelectiveSSMAttrs>> implementations {
+ OV_CPU_INSTANCE_X64(
+ "selective_ssm_jit_executor",
+ ExecutorType::Jit,
+ OperationType::SelectiveSSM,
+ [](const SelectiveSSMConfig& config) -> bool {
+ return SelectiveSSMJitExecutor::supports(config);
+ },
+ HasNoOptimalConfig<SelectiveSSMAttrs>{},
+ [](const SelectiveSSMAttrs&, const MemoryArgs& memory) -> bool {
+ return SelectiveSSMJitExecutor::accepts_shape(memory);
+ },
+ CreateDefault<SelectiveSSMJitExecutor, SelectiveSSMAttrs>{}
+ )
OV_CPU_INSTANCE_COMMON(
"selective_ssm_common_executor",
ExecutorType::Common,
diff --git a/src/plugins/intel_cpu/src/nodes/executors/x64/selective_ssm_jit_executor.cpp b/src/plugins/intel_cpu/src/nodes/executors/x64/selective_ssm_jit_executor.cpp
new file mode 100644
index 00000000000..dc83ca997a5
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/executors/x64/selective_ssm_jit_executor.cpp
@@ -0,0 +1,408 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "selective_ssm_jit_executor.hpp"
+
+#include <algorithm>
+#include <array>
+#include <common/utils.hpp>
+#include <cpu/x64/cpu_isa_traits.hpp>
+#include <cstddef>
+#include <memory>
+#include <utility>
+
+#include "memory_desc/cpu_blocked_memory_desc.h"
+#include "nodes/common/cpu_convert.h"
+#include "nodes/executors/executor.hpp"
+#include "nodes/executors/memory_arguments.hpp"
+#include "nodes/executors/paged_selective_ssm_config.hpp"
+#include "nodes/executors/selective_ssm_config.hpp"
+#include "nodes/kernels/selective_ssm.hpp"
+#include "nodes/kernels/x64/selective_ssm_jit_kernel.hpp"
+#include "nodes/kernels/x64/selective_ssm_jit_runtime.hpp"
+#include "onednn/iml_type_mapper.h"
+#include "openvino/core/except.hpp"
+#include "openvino/core/type/element_type.hpp"
+#include "utils/general_utils.h"
+
+using namespace dnnl::impl::cpu::x64;
+
+namespace ov::intel_cpu {
+namespace {
+
+constexpr size_t min_parallel_projection_elements = 4096;
+
+struct SelectiveSSMJitKey {
+ ov::element::Type data_precision;
+ ov::element::Type state_precision;
+ size_t state_size;
+ kernel::jit_selective_ssm_state_mode state_mode;
+
+ [[nodiscard]] size_t hash() const {
+ size_t seed = 0;
+ seed = dnnl::impl::hash_combine(seed, data_precision.hash());
+ seed = dnnl::impl::hash_combine(seed, state_precision.hash());
+ seed = dnnl::impl::hash_combine(seed, state_size);
+ return dnnl::impl::hash_combine(seed, static_cast<size_t>(state_mode));
+ }
+
+ bool operator==(const SelectiveSSMJitKey& rhs) const {
+ return data_precision == rhs.data_precision && state_precision == rhs.state_precision &&
+ state_size == rhs.state_size && state_mode == rhs.state_mode;
+ }
+};
+
+bool is_supported_index_precision(const ov::element::Type& precision) {
+ return any_of(precision, ov::element::i32, ov::element::i64);
+}
+
+bool is_supported_state_size(size_t state_size) {
+ return state_size > 0 && state_size <= kernel::max_selective_ssm_jit_state_size;
+}
+
+template <typename Config, typename Argument, size_t Size>
+bool all_arguments_have_precision(const Config& config,
+ const std::array<Argument, Size>& arguments,
+ const ov::element::Type& precision) {
+ return std::all_of(arguments.begin(), arguments.end(), [&](Argument argument) {
+ return config.descs.at(argument)->getPrecision() == precision;
+ });
+}
+
+std::shared_ptr<kernel::JitKernelBase> get_or_create_kernel(const ExecutorContext::CPtr& context,
+ const ov::element::Type& data_precision,
+ const ov::element::Type& state_precision,
+ size_t state_size,
+ kernel::jit_selective_ssm_state_mode state_mode) {
+ const SelectiveSSMJitKey key{data_precision, state_precision, state_size, state_mode};
+ auto builder = [](const SelectiveSSMJitKey& compile_key) {
+ return kernel::create_selective_ssm_jit_kernel(compile_key.data_precision,
+ compile_key.state_size,
+ compile_key.state_precision,
+ compile_key.state_mode);
+ };
+ return context->getRuntimeCache()->getOrCreate(key, builder).first;
+}
+
+} // namespace
+
+SelectiveSSMJitExecutorBase::SelectiveSSMJitExecutorBase(ExecutorContext::CPtr context)
+ : m_context(std::move(context)) {}
+
+size_t SelectiveSSMJitExecutorBase::ResourceRequirements::projection_scratch_elements() const {
+ return data_precision == ov::element::f32
+ ? size_t{0}
+ : node::kernel::checked_size_product({size_t{2}, projection_elements}, "JIT B/C projection scratch");
+}
+
+size_t SelectiveSSMJitExecutorBase::ResourceRequirements::total_scratch_elements() const {
+ return node::kernel::checked_size_sum({state_scratch_elements, projection_scratch_elements()},
+ "JIT combined scratch");
+}
+
+bool SelectiveSSMJitExecutorBase::configure_resources(const ResourceRequirements& requirements) {
+ if (!is_supported_state_size(requirements.state_size) || requirements.head_dim_tile == 0) {
+ return false;
+ }
+ if (m_kernels.ready(requirements.needs_no_state_store_kernel) && m_scratch != nullptr &&
+ m_requirements == requirements) {
+ return true;
+ }
+
+ KernelBundle kernels;
+ // Prefill iterates over tokens using an FP32 working state (final output or worker scratch), updated
+ // in_place to avoid low-precision rounding between timesteps. Single-token decode uses separate mode:
+ // read the initial/cache state and write the final state or a cache snapshot in data_precision directly.
+ // Paged decode with caching disabled uses no_store, so computing the output never modifies the read cache.
+ // Build the variants here; the runtime chooses between them from sequence length and cache schedule.
+ kernels.fp32_state = get_or_create_kernel(m_context,
+ requirements.data_precision,
+ ov::element::f32,
+ requirements.state_size,
+ kernel::jit_selective_ssm_state_mode::in_place);
+ if (kernels.fp32_state == nullptr) {
+ return false;
+ }
+ kernels.direct_state = get_or_create_kernel(m_context,
+ requirements.data_precision,
+ requirements.data_precision,
+ requirements.state_size,
+ kernel::jit_selective_ssm_state_mode::separate);
+ if (kernels.direct_state == nullptr) {
+ return false;
+ }
+ if (requirements.needs_no_state_store_kernel) {
+ kernels.no_state_store = get_or_create_kernel(m_context,
+ requirements.data_precision,
+ requirements.data_precision,
+ requirements.state_size,
+ kernel::jit_selective_ssm_state_mode::no_store);
+ if (kernels.no_state_store == nullptr) {
+ return false;
+ }
+ }
+ const auto descriptor = std::make_shared<CpuBlockedMemoryDesc>(
+ ov::element::f32,
+ ov::intel_cpu::Shape{std::max(size_t{1}, requirements.total_scratch_elements())});
+ auto scratch = m_context->getScratchPad()->createScratchPadMem(descriptor);
+ if (scratch == nullptr) {
+ return false;
+ }
+
+ m_kernels = std::move(kernels);
+ m_scratch = std::move(scratch);
+ m_requirements = requirements;
+ return true;
+}
+
+std::pair<const float*, const float*> SelectiveSSMJitExecutorBase::prepare_projections(const void* B,
+ const void* C) const {
+ if (m_requirements.data_precision == ov::element::f32) {
+ return {static_cast<const float*>(B), static_cast<const float*>(C)};
+ }
+
+ auto* converted_B = m_scratch->getDataAs<float>() + m_requirements.state_scratch_elements;
+ auto* converted_C = converted_B + m_requirements.projection_elements;
+ const auto convert = [&](const void* source, float* destination) {
+ if (m_requirements.projection_elements < min_parallel_projection_elements) {
+ cpu_convert(source,
+ destination,
+ m_requirements.data_precision,
+ ov::element::f32,
+ m_requirements.projection_elements);
+ } else {
+ cpu_parallel_convert(source,
+ destination,
+ m_requirements.data_precision,
+ ov::element::f32,
+ m_requirements.projection_elements);
+ }
+ };
+ convert(B, converted_B);
+ convert(C, converted_C);
+ return {converted_B, converted_C};
+}
+
+impl_desc_type SelectiveSSMJitExecutorBase::implType() const {
+ return mayiuse(dnnl::impl::cpu::x64::avx512_core) ? impl_desc_type::jit_avx512 : impl_desc_type::jit_avx2;
+}
+
+bool SelectiveSSMJitExecutor::supports(const SelectiveSSMConfig& config) {
+ const auto precision = config.descs.at(ARG_SSM_A)->getPrecision();
+ if (!kernel::is_selective_ssm_jit_precision_supported(precision)) {
+ return false;
+ }
+ constexpr std::array arguments{
+ ARG_SSM_DT,
+ ARG_SSM_B,
+ ARG_SSM_X,
+ ARG_SSM_C,
+ ARG_SSM_STATE,
+ ARG_SSM_OUT,
+ ARG_SSM_OUT_STATE,
+ };
+ return all_arguments_have_precision(config, arguments, precision);
+}
+
+bool SelectiveSSMJitExecutor::accepts_shape(const MemoryArgs& memory) {
+ const auto& x_shape = memory.at(ARG_SSM_X)->getDescPtr()->getShape();
+ const auto& B_shape = memory.at(ARG_SSM_B)->getDescPtr()->getShape();
+ const auto& state_shape = memory.at(ARG_SSM_STATE)->getDescPtr()->getShape();
+ if (x_shape.isDynamic() || B_shape.isDynamic() || state_shape.isDynamic()) {
+ return false;
+ }
+ const auto& x_dims = x_shape.getStaticDims();
+ const auto& B_dims = B_shape.getStaticDims();
+ const auto& state_dims = state_shape.getStaticDims();
+ return x_dims.size() == 4 && B_dims.size() == 4 && state_dims.size() == 4 &&
+ is_supported_state_size(state_dims.back());
+}
+
+SelectiveSSMJitExecutor::SelectiveSSMJitExecutor([[maybe_unused]] const SelectiveSSMAttrs& attrs,
+ const MemoryArgs& memory,
+ ExecutorContext::CPtr context)
+ : SelectiveSSMJitExecutorBase(std::move(context)) {
+ OPENVINO_ASSERT(update(memory), "Failed to initialize SelectiveSSM JIT executor");
+}
+
+bool SelectiveSSMJitExecutor::update(const MemoryArgs& memory) {
+ if (!accepts_shape(memory)) {
+ return false;
+ }
+ const auto& x_dims = memory.at(ARG_SSM_X)->getStaticDims();
+ const auto& B_dims = memory.at(ARG_SSM_B)->getStaticDims();
+ const auto& state_dims = memory.at(ARG_SSM_STATE)->getStaticDims();
+ const auto precision = memory.at(ARG_SSM_X)->getDescPtr()->getPrecision();
+ const auto thread_count = static_cast<size_t>(m_context->getCpuParallel()->get_num_worker_threads());
+ const auto outer_work = node::kernel::checked_size_product({x_dims[0], x_dims[2]}, "JIT outer work items");
+ const auto head_dim_tile = node::kernel::get_scratch_head_dim(x_dims[3], state_dims[3], outer_work, thread_count);
+ const bool direct_decode = x_dims[1] == 1;
+ const auto state_scratch_elements =
+ precision == ov::element::f32 || direct_decode
+ ? size_t{0}
+ : node::kernel::checked_size_product({thread_count, head_dim_tile, state_dims[3]}, "JIT state scratch");
+ const auto projection_elements =
+ node::kernel::checked_size_product({B_dims[0], B_dims[1], B_dims[2], B_dims[3]}, "JIT B/C projection");
+ return configure_resources({precision, state_dims[3], head_dim_tile, state_scratch_elements, projection_elements});
+}
+
+void SelectiveSSMJitExecutor::execute(const MemoryArgs& memory) {
+ OPENVINO_ASSERT(m_kernels.ready(false) && m_scratch != nullptr,
+ "SelectiveSSM JIT executor resources are not initialized");
+ const auto& x_dims = memory.at(ARG_SSM_X)->getStaticDims();
+ const auto& B_dims = memory.at(ARG_SSM_B)->getStaticDims();
+ const auto& state_dims = memory.at(ARG_SSM_STATE)->getStaticDims();
+ const auto precision = memory.at(ARG_SSM_X)->getDescPtr()->getPrecision();
+ const node::kernel::SelectiveSSMShape shape{x_dims[0], x_dims[1], x_dims[2], x_dims[3], B_dims[2], state_dims[3]};
+ const auto [input_projections, output_projections] =
+ prepare_projections(memory.at(ARG_SSM_B)->getData(), memory.at(ARG_SSM_C)->getData());
+ kernel::SelectiveSSMJitRuntimeArgs args;
+ args.state_decay_rates = memory.at(ARG_SSM_A)->getData();
+ args.time_steps = memory.at(ARG_SSM_DT)->getData();
+ args.input_projections = input_projections;
+ args.input = memory.at(ARG_SSM_X)->getData();
+ args.output_projections = output_projections;
+ args.initial_state = memory.at(ARG_SSM_STATE)->getData();
+ args.output = memory.at(ARG_SSM_OUT)->getData();
+ args.final_state = memory.at(ARG_SSM_OUT_STATE)->getData();
+ args.shape = shape;
+ args.data_precision = precision;
+ args.state_scratch = m_scratch->getDataAs<float>();
+ args.head_dim_tile = m_requirements.head_dim_tile;
+ args.cpu_parallel = m_context->getCpuParallel();
+ args.fp32_state_kernel = m_kernels.fp32_state.get();
+ args.direct_state_kernel = m_kernels.direct_state.get();
+ kernel::selective_ssm_jit(args);
+}
+
+bool PagedSelectiveSSMJitExecutor::supports(const PagedSelectiveSSMConfig& config) {
+ const auto data_precision = config.descs.at(ARG_PAGED_SSM_A)->getPrecision();
+ if (!kernel::is_selective_ssm_jit_precision_supported(data_precision)) {
+ return false;
+ }
+ constexpr std::array data_arguments{
+ ARG_PAGED_SSM_DT,
+ ARG_PAGED_SSM_B,
+ ARG_PAGED_SSM_X,
+ ARG_PAGED_SSM_C,
+ ARG_PAGED_SSM_STATE,
+ ARG_PAGED_SSM_OUT,
+ };
+ if (!all_arguments_have_precision(config, data_arguments, data_precision)) {
+ return false;
+ }
+
+ const auto index_precision = config.descs.at(ARG_PAGED_SSM_SUBSEQUENCE_BEGINS)->getPrecision();
+ if (!is_supported_index_precision(index_precision)) {
+ return false;
+ }
+ constexpr std::array index_arguments{
+ ARG_PAGED_SSM_BLOCK_INDICES,
+ ARG_PAGED_SSM_BLOCK_INDICES_BEGINS,
+ ARG_PAGED_SSM_NUM_PROCESSED_TOKENS,
+ ARG_PAGED_SSM_CACHE_INTERVAL,
+ };
+ return all_arguments_have_precision(config, index_arguments, index_precision);
+}
+
+bool PagedSelectiveSSMJitExecutor::accepts_shape(const MemoryArgs& memory) {
+ const auto& x_shape = memory.at(ARG_PAGED_SSM_X)->getDescPtr()->getShape();
+ const auto& B_shape = memory.at(ARG_PAGED_SSM_B)->getDescPtr()->getShape();
+ const auto& state_shape = memory.at(ARG_PAGED_SSM_STATE)->getDescPtr()->getShape();
+ const auto& subsequence_shape = memory.at(ARG_PAGED_SSM_SUBSEQUENCE_BEGINS)->getDescPtr()->getShape();
+ if (x_shape.isDynamic() || B_shape.isDynamic() || state_shape.isDynamic() || subsequence_shape.isDynamic()) {
+ return false;
+ }
+ const auto& x_dims = x_shape.getStaticDims();
+ const auto& B_dims = B_shape.getStaticDims();
+ const auto& state_dims = state_shape.getStaticDims();
+ const auto& subsequence_dims = subsequence_shape.getStaticDims();
+ return x_dims.size() == 3 && B_dims.size() == 3 && state_dims.size() == 4 && subsequence_dims.size() == 1 &&
+ subsequence_dims[0] >= 1 && is_supported_state_size(state_dims.back());
+}
+
+PagedSelectiveSSMJitExecutor::PagedSelectiveSSMJitExecutor([[maybe_unused]] const PagedSelectiveSSMAttrs& attrs,
+ const MemoryArgs& memory,
+ ExecutorContext::CPtr context)
+ : SelectiveSSMJitExecutorBase(std::move(context)) {
+ OPENVINO_ASSERT(update(memory), "Failed to initialize PagedSelectiveSSM JIT executor");
+}
+
+bool PagedSelectiveSSMJitExecutor::update(const MemoryArgs& memory) {
+ if (!accepts_shape(memory)) {
+ return false;
+ }
+ const auto& x_dims = memory.at(ARG_PAGED_SSM_X)->getStaticDims();
+ const auto& B_dims = memory.at(ARG_PAGED_SSM_B)->getStaticDims();
+ const auto& state_dims = memory.at(ARG_PAGED_SSM_STATE)->getStaticDims();
+ const auto& subsequence_dims = memory.at(ARG_PAGED_SSM_SUBSEQUENCE_BEGINS)->getStaticDims();
+ const auto precision = memory.at(ARG_PAGED_SSM_X)->getDescPtr()->getPrecision();
+ const auto sequence_count = subsequence_dims[0] - 1;
+ const auto thread_count = static_cast<size_t>(m_context->getCpuParallel()->get_num_worker_threads());
+ const auto outer_work =
+ node::kernel::checked_size_product({sequence_count, x_dims[1]}, "JIT paged outer work items");
+ const auto head_dim_tile = node::kernel::get_scratch_head_dim(x_dims[2], state_dims[3], outer_work, thread_count);
+ const auto state_scratch_elements =
+ node::kernel::checked_size_product({thread_count, head_dim_tile, state_dims[3]}, "JIT state scratch");
+ const auto projection_elements =
+ node::kernel::checked_size_product({B_dims[0], B_dims[1], B_dims[2]}, "JIT B/C projection");
+ return configure_resources(
+ {precision, state_dims[3], head_dim_tile, state_scratch_elements, projection_elements, true});
+}
+
+void PagedSelectiveSSMJitExecutor::execute(const MemoryArgs& memory) {
+ OPENVINO_ASSERT(m_kernels.ready(true) && m_scratch != nullptr,
+ "PagedSelectiveSSM JIT executor resources are not initialized");
+ const auto& x_dims = memory.at(ARG_PAGED_SSM_X)->getStaticDims();
+ const auto& B_dims = memory.at(ARG_PAGED_SSM_B)->getStaticDims();
+ const auto& state_dims = memory.at(ARG_PAGED_SSM_STATE)->getStaticDims();
+ const auto& subsequence_dims = memory.at(ARG_PAGED_SSM_SUBSEQUENCE_BEGINS)->getStaticDims();
+ const auto& block_indices_dims = memory.at(ARG_PAGED_SSM_BLOCK_INDICES)->getStaticDims();
+ const auto& block_begins_dims = memory.at(ARG_PAGED_SSM_BLOCK_INDICES_BEGINS)->getStaticDims();
+ const auto& processed_dims = memory.at(ARG_PAGED_SSM_NUM_PROCESSED_TOKENS)->getStaticDims();
+ const auto& interval_dims = memory.at(ARG_PAGED_SSM_CACHE_INTERVAL)->getStaticDims();
+ const auto sequence_count = subsequence_dims[0] - 1;
+ OPENVINO_ASSERT(block_indices_dims.size() == 1 && block_begins_dims.size() == 1 && processed_dims.size() == 1 &&
+ interval_dims.size() == 1 && block_begins_dims[0] == sequence_count + 1 &&
+ processed_dims[0] == sequence_count && interval_dims[0] == sequence_count,
+ "PagedSelectiveSSM JIT metadata tensor lengths are inconsistent.");
+ const node::kernel::PagedSelectiveSSMShape shape{x_dims[0],
+ x_dims[1],
+ x_dims[2],
+ B_dims[1],
+ state_dims[3],
+ state_dims[0],
+ block_indices_dims[0],
+ sequence_count};
+ const auto precision = memory.at(ARG_PAGED_SSM_X)->getDescPtr()->getPrecision();
+ const auto [input_projections, output_projections] =
+ prepare_projections(memory.at(ARG_PAGED_SSM_B)->getData(), memory.at(ARG_PAGED_SSM_C)->getData());
+ kernel::PagedSelectiveSSMJitRuntimeArgs args;
+ args.state_decay_rates = memory.at(ARG_PAGED_SSM_A)->getData();
+ args.time_steps = memory.at(ARG_PAGED_SSM_DT)->getData();
+ args.input_projections = input_projections;
+ args.input = memory.at(ARG_PAGED_SSM_X)->getData();
+ args.output_projections = output_projections;
+ args.state_cache = memory.at(ARG_PAGED_SSM_STATE)->getData();
+ args.subsequence_begins = memory.at(ARG_PAGED_SSM_SUBSEQUENCE_BEGINS)->getData();
+ args.block_indices = memory.at(ARG_PAGED_SSM_BLOCK_INDICES)->getData();
+ args.block_indices_begins = memory.at(ARG_PAGED_SSM_BLOCK_INDICES_BEGINS)->getData();
+ args.num_processed_tokens = memory.at(ARG_PAGED_SSM_NUM_PROCESSED_TOKENS)->getData();
+ args.cache_intervals = memory.at(ARG_PAGED_SSM_CACHE_INTERVAL)->getData();
+ args.output = memory.at(ARG_PAGED_SSM_OUT)->getData();
+ args.shape = shape;
+ args.data_precision = precision;
+ args.index_precision = memory.at(ARG_PAGED_SSM_SUBSEQUENCE_BEGINS)->getDescPtr()->getPrecision();
+ args.state_scratch = m_scratch->getDataAs<float>();
+ // AVX-512 benefits from private scratch; AVX2 avoids the extra state copies.
+ args.reuse_state_cache = !mayiuse(avx512_core);
+ args.head_dim_tile = m_requirements.head_dim_tile;
+ args.cpu_parallel = m_context->getCpuParallel();
+ args.fp32_state_kernel = m_kernels.fp32_state.get();
+ args.direct_state_kernel = m_kernels.direct_state.get();
+ args.no_state_store_kernel = m_kernels.no_state_store.get();
+ kernel::paged_selective_ssm_jit(args);
+}
+
+} // namespace ov::intel_cpu
diff --git a/src/plugins/intel_cpu/src/nodes/executors/x64/selective_ssm_jit_executor.hpp b/src/plugins/intel_cpu/src/nodes/executors/x64/selective_ssm_jit_executor.hpp
new file mode 100644
index 00000000000..90d72bb35f8
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/executors/x64/selective_ssm_jit_executor.hpp
@@ -0,0 +1,91 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <cstddef>
+#include <memory>
+#include <utility>
+
+#include "cpu_memory.h"
+#include "nodes/executors/executor.hpp"
+#include "nodes/executors/paged_selective_ssm_config.hpp"
+#include "nodes/executors/selective_ssm_config.hpp"
+#include "openvino/core/type/element_type.hpp"
+
+namespace ov::intel_cpu::kernel {
+class JitKernelBase;
+}
+
+namespace ov::intel_cpu {
+
+class SelectiveSSMJitExecutorBase : public Executor {
+protected:
+ struct ResourceRequirements {
+ ov::element::Type data_precision = ov::element::dynamic;
+ size_t state_size = 0;
+ size_t head_dim_tile = 0;
+ size_t state_scratch_elements = 0;
+ size_t projection_elements = 0;
+ bool needs_no_state_store_kernel = false;
+
+ [[nodiscard]] size_t projection_scratch_elements() const;
+ [[nodiscard]] size_t total_scratch_elements() const;
+
+ bool operator==(const ResourceRequirements& rhs) const {
+ return data_precision == rhs.data_precision && state_size == rhs.state_size &&
+ head_dim_tile == rhs.head_dim_tile && state_scratch_elements == rhs.state_scratch_elements &&
+ projection_elements == rhs.projection_elements &&
+ needs_no_state_store_kernel == rhs.needs_no_state_store_kernel;
+ }
+ };
+
+ struct KernelBundle {
+ std::shared_ptr<kernel::JitKernelBase> fp32_state;
+ std::shared_ptr<kernel::JitKernelBase> direct_state;
+ std::shared_ptr<kernel::JitKernelBase> no_state_store;
+
+ [[nodiscard]] bool ready(bool needs_no_state_store) const {
+ return fp32_state != nullptr && direct_state != nullptr &&
+ (!needs_no_state_store || no_state_store != nullptr);
+ }
+ };
+
+ explicit SelectiveSSMJitExecutorBase(ExecutorContext::CPtr context);
+
+ bool configure_resources(const ResourceRequirements& requirements);
+ std::pair<const float*, const float*> prepare_projections(const void* B, const void* C) const;
+ [[nodiscard]] impl_desc_type implType() const override;
+
+ ExecutorContext::CPtr m_context;
+ KernelBundle m_kernels;
+ MemoryPtr m_scratch;
+ ResourceRequirements m_requirements;
+};
+
+class SelectiveSSMJitExecutor : public SelectiveSSMJitExecutorBase {
+public:
+ static bool supports(const SelectiveSSMConfig& config);
+ static bool accepts_shape(const MemoryArgs& memory);
+
+ SelectiveSSMJitExecutor(const SelectiveSSMAttrs& attrs, const MemoryArgs& memory, ExecutorContext::CPtr context);
+
+ bool update(const MemoryArgs& memory) override;
+ void execute(const MemoryArgs& memory) override;
+};
+
+class PagedSelectiveSSMJitExecutor : public SelectiveSSMJitExecutorBase {
+public:
+ static bool supports(const PagedSelectiveSSMConfig& config);
+ static bool accepts_shape(const MemoryArgs& memory);
+
+ PagedSelectiveSSMJitExecutor(const PagedSelectiveSSMAttrs& attrs,
+ const MemoryArgs& memory,
+ ExecutorContext::CPtr context);
+
+ bool update(const MemoryArgs& memory) override;
+ void execute(const MemoryArgs& memory) override;
+};
+
+} // namespace ov::intel_cpu
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_kernel.cpp
new file mode 100644
index 00000000000..b50e78b4d29
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_kernel.cpp
@@ -0,0 +1,471 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "selective_ssm_jit_kernel.hpp"
+
+#include <xbyak/xbyak.h>
+
+#include <cpu/x64/cpu_isa_traits.hpp>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+
+#include "cpu/x64/jit_generator.hpp"
+#include "emitters/plugin/x64/jit_load_store_emitters.hpp"
+#include "nodes/kernels/x64/jit_kernel_base.hpp"
+#include "openvino/core/type/element_type.hpp"
+
+using namespace dnnl::impl::cpu::x64;
+
+namespace ov::intel_cpu::kernel {
+
+#define GET_OFF(field) offsetof(jit_selective_ssm_call_args, field)
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::load(const Vmm& destination,
+ const Xbyak::Reg64& source,
+ const ov::element::Type& source_precision,
+ int element_count,
+ size_t offset,
+ bool zero_fill) {
+ const bool fill_tail = zero_fill && static_cast<size_t>(element_count) < vector_size;
+ const auto seed = load_emitter_params(source_precision, ov::element::f32, element_count, fill_tail, "zero").hash();
+ auto& emitter = emitters[seed];
+ if (!emitter) {
+ constexpr cpu_isa_t emitter_isa = (isa & zmm_bit) != 0 ? avx512_core : isa;
+ emitter = std::make_unique<jit_load_emitter>(this,
+ emitter_isa,
+ source_precision,
+ ov::element::f32,
+ element_count,
+ ov::element::f32,
+ fill_tail,
+ "zero");
+ }
+ emitter->emit_code({static_cast<size_t>(source.getIdx()), offset},
+ {static_cast<size_t>(destination.getIdx())},
+ pool_aux_vmm_idxs,
+ pool_aux_gpr_idxs);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::store(const Xbyak::Reg64& destination,
+ const Vmm& source,
+ const ov::element::Type& destination_precision,
+ int element_count,
+ size_t offset) {
+ const auto seed = store_emitter_params(ov::element::f32, destination_precision, element_count).hash();
+ auto& emitter = emitters[seed];
+ if (!emitter) {
+ constexpr cpu_isa_t emitter_isa = (isa & zmm_bit) != 0 ? avx512_core : isa;
+ emitter = std::make_unique<jit_store_emitter>(this,
+ emitter_isa,
+ ov::element::f32,
+ destination_precision,
+ element_count);
+ }
+ emitter->emit_code({static_cast<size_t>(source.getIdx())},
+ {static_cast<size_t>(destination.getIdx()), offset},
+ pool_aux_vmm_idxs,
+ pool_aux_gpr_idxs);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::reduce_to_scalar(const Vmm& accumulator) {
+ const Xbyak::Xmm accumulator_xmm(accumulator.getIdx());
+ // AVX2 decode uses all 16 SIMD registers for a four-row tile. State vectors are dead once reduction starts, so
+ // their low registers can safely host the VEX-encoded 128-bit reduction instructions.
+ const auto tmp0_idx = vmm_reduce_tmp0.getIdx();
+ const auto tmp1_idx = vmm_reduce_tmp1.getIdx();
+ const Xbyak::Xmm tmp0_xmm(tmp0_idx);
+ const Xbyak::Xmm tmp1_xmm(tmp1_idx);
+
+ if constexpr (isa == avx2) {
+ vextractf128(tmp0_xmm, Xbyak::Ymm(accumulator.getIdx()), 1);
+ vaddps(accumulator_xmm, accumulator_xmm, tmp0_xmm);
+ } else {
+ vextractf32x8(Xbyak::Ymm(tmp0_idx), Xbyak::Zmm(accumulator.getIdx()), 1);
+ vaddps(Xbyak::Ymm(accumulator.getIdx()), Xbyak::Ymm(accumulator.getIdx()), Xbyak::Ymm(tmp0_idx));
+ vextractf128(tmp0_xmm, Xbyak::Ymm(accumulator.getIdx()), 1);
+ vaddps(accumulator_xmm, accumulator_xmm, tmp0_xmm);
+ }
+
+ vpermilps(tmp1_xmm, accumulator_xmm, 0xB1);
+ vaddps(accumulator_xmm, accumulator_xmm, tmp1_xmm);
+ vpermilps(tmp1_xmm, accumulator_xmm, 0x4E);
+ vaddps(accumulator_xmm, accumulator_xmm, tmp1_xmm);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::store_output(const Vmm& source, int element_count, size_t offset) {
+ store(reg_output, source, m_jcp.data_precision, element_count, offset);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::prepare_row_scales() {
+ const Xbyak::Xmm packed_scales(vmm_input_projection.getIdx());
+ const Xbyak::Xmm delta(delta_scratch_vmm_idx);
+ load(vmm_input_projection, reg_x, m_jcp.data_precision, max_row_tile, 0, false);
+ vbroadcastss(delta, ptr[reg_steps + offsetof(jit_selective_ssm_step, delta)]);
+ vmulps(packed_scales, packed_scales, delta);
+
+ for (size_t row = 0; row < max_row_tile; ++row) {
+ const Xbyak::Xmm scale(input_scale_vmm(row).getIdx());
+ // vpermilps has four 2-bit selectors; multiplying by 0x55 repeats the row's lane index in every field.
+ vpermilps(scale, packed_scales, static_cast<uint8_t>(row * 0x55U));
+ }
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::store_row_tile() {
+ const Xbyak::Xmm packed_output(packed_output_low_vmm_idx);
+ const Xbyak::Xmm packed_output_high(packed_output_high_vmm_idx);
+ vunpcklps(packed_output, Xbyak::Xmm(accumulator_vmm(0).getIdx()), Xbyak::Xmm(accumulator_vmm(1).getIdx()));
+ vunpcklps(packed_output_high, Xbyak::Xmm(accumulator_vmm(2).getIdx()), Xbyak::Xmm(accumulator_vmm(3).getIdx()));
+ vshufps(packed_output, packed_output, packed_output_high, 0x44);
+ store_output(Vmm(packed_output_low_vmm_idx), max_row_tile);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::emit_state_vector(size_t rows,
+ size_t active_lanes,
+ size_t vector_index,
+ size_t projection_offset,
+ size_t state_vector_offset) {
+ load_projections(active_lanes, projection_offset);
+ const auto state_row_bytes = m_jcp.state_size * m_jcp.state_precision.size();
+ for (size_t row = 0; row < rows; ++row) {
+ const auto state = state_vmm(row);
+ const auto offset = row * state_row_bytes + state_vector_offset;
+ load_state(state, active_lanes, offset);
+ compute_state(row, active_lanes);
+ store_state(state, active_lanes, offset);
+ accumulate_output(row, active_lanes, vector_index);
+ }
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::load_projections(size_t active_lanes, size_t projection_offset) {
+ load(vmm_input_projection,
+ reg_input_projection,
+ ov::element::f32,
+ static_cast<int>(active_lanes),
+ projection_offset);
+ load(vmm_output_projection,
+ reg_output_projection,
+ ov::element::f32,
+ static_cast<int>(active_lanes),
+ projection_offset);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::load_state(const Vmm& destination, size_t active_lanes, size_t offset) {
+ load(destination, reg_input_state, m_jcp.state_precision, static_cast<int>(active_lanes), offset);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::compute_state(size_t row, size_t active_lanes) {
+ const bool is_full_vector = active_lanes == vector_size;
+ const auto state = state_vmm(row);
+ // state[p, n] = decay * state[p, n] + (delta * x[p]) * B[n]
+ vmulps(state, state, vmm_decay);
+ vfmadd231ps(state, vmm_input_projection, input_scale_vmm(row));
+ // Loads zero-fill inactive state/B/C lanes, but decay and delta*x are broadcast to every lane.
+ // exp(A*delta) may overflow to Inf, or delta*x may be non-finite, so 0*Inf produces NaN in the tail
+ // even with initialized inputs. AVX2 has no masked FMA: replace these lanes with C's zeros here.
+ // AVX-512 excludes them from the masked FMA in accumulate_output instead. Keep active lanes unchanged.
+ if constexpr (isa == avx2) {
+ if (!is_full_vector) {
+ const auto inactive_mask = static_cast<uint8_t>(0xFFU << active_lanes);
+ vblendps(state, state, vmm_output_projection, inactive_mask);
+ }
+ }
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::accumulate_output(size_t row, size_t active_lanes, size_t vector) {
+ const auto state = state_vmm(row);
+ // output[p] = sum_n(state[p, n] * C[n])
+ if constexpr (isa == avx2) {
+ vfmadd231ps(accumulator_vmm(row, vector), state, vmm_output_projection);
+ } else {
+ if (active_lanes == vector_size) {
+ vfmadd231ps(accumulator_vmm(row, vector), state, vmm_output_projection);
+ } else {
+ // Do not evaluate inactive products, including NaN * 0 from non-finite decay/input.
+ vfmadd231ps(accumulator_vmm(row, vector) | k_tail, state, vmm_output_projection);
+ }
+ }
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::store_state(const Vmm& source, size_t active_lanes, size_t offset) {
+ if (m_jcp.state_mode == jit_selective_ssm_state_mode::no_store) {
+ return;
+ }
+ const auto& destination =
+ m_jcp.state_mode == jit_selective_ssm_state_mode::separate ? reg_output_state : reg_input_state;
+ store(destination, source, m_jcp.state_precision, static_cast<int>(active_lanes), offset);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::zero_accumulators(size_t row) {
+ const auto accumulator = accumulator_vmm(row);
+ uni_vpxor(accumulator, accumulator, accumulator);
+ if constexpr ((isa & zmm_bit) != 0) {
+ const auto second = accumulator_vmm(row, 1);
+ uni_vpxor(second, second, second);
+ }
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::fold_partial_accumulators(size_t row) {
+ if constexpr ((isa & zmm_bit) != 0) {
+ const auto accumulator = accumulator_vmm(row);
+ vaddps(accumulator, accumulator, accumulator_vmm(row, 1));
+ }
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::emit_row_tile(size_t rows) {
+ const auto data_size = m_jcp.data_precision.size();
+ const auto state_element_size = m_jcp.state_precision.size();
+ const auto full_vectors = m_jcp.state_size / vector_size;
+ const auto tail = m_jcp.state_size % vector_size;
+
+ const bool use_packed_rows = m_jcp.data_precision != ov::element::f32 && rows == max_row_tile;
+ if (use_packed_rows) {
+ prepare_row_scales();
+ }
+ for (size_t row = 0; row < rows; ++row) {
+ const auto scale = input_scale_vmm(row);
+ if (!use_packed_rows) {
+ load(scale, reg_x, m_jcp.data_precision, 1, row * data_size, false);
+ vmulss(Xbyak::Xmm(scale.getIdx()),
+ Xbyak::Xmm(scale.getIdx()),
+ ptr[reg_steps + offsetof(jit_selective_ssm_step, delta)]);
+ }
+ vbroadcastss(scale, Xbyak::Xmm(scale.getIdx()));
+ zero_accumulators(row);
+ }
+
+ const auto loop_chunks = full_vectors > max_unrolled_vectors ? full_vectors / max_unrolled_vectors : 0;
+ const auto loop_vectors = loop_chunks * max_unrolled_vectors;
+ if (loop_chunks > 0) {
+ Xbyak::Label vector_loop;
+ mov(reg_vector_chunks, loop_chunks);
+ align(16);
+ L(vector_loop);
+ for (size_t vector = 0; vector < max_unrolled_vectors; ++vector) {
+ emit_state_vector(rows,
+ vector_size,
+ vector,
+ vector * vector_size * sizeof(float),
+ vector * vector_size * state_element_size);
+ }
+ advance_state_pointers(max_unrolled_vectors * vector_size);
+ dec(reg_vector_chunks);
+ jnz(vector_loop, T_NEAR);
+ }
+
+ for (size_t vector = 0; vector < full_vectors - loop_vectors; ++vector) {
+ const auto projection_offset = vector * vector_size * sizeof(float);
+ const auto state_vector_offset = vector * vector_size * state_element_size;
+ emit_state_vector(rows, vector_size, vector, projection_offset, state_vector_offset);
+ }
+
+ if (tail > 0) {
+ const auto vector = full_vectors - loop_vectors;
+ const auto projection_offset = vector * vector_size * sizeof(float);
+ const auto state_vector_offset = vector * vector_size * state_element_size;
+ emit_state_vector(rows, tail, vector, projection_offset, state_vector_offset);
+ }
+
+ if (loop_vectors > 0) {
+ advance_state_pointers(-static_cast<int64_t>(loop_vectors * vector_size));
+ }
+
+ for (size_t row = 0; row < rows; ++row) {
+ const auto accumulator = accumulator_vmm(row);
+ fold_partial_accumulators(row);
+ reduce_to_scalar(accumulator);
+ if (!use_packed_rows) {
+ store_output(accumulator, 1, row * data_size);
+ }
+ }
+ if (use_packed_rows) {
+ store_row_tile();
+ }
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::advance_state_pointers(int64_t elements) {
+ // Xbyak takes the bits of a sign-extended imm32; the state-size limit keeps both offsets representable.
+ const auto state_bytes = static_cast<uint32_t>(elements * static_cast<int64_t>(m_jcp.state_precision.size()));
+ const auto projection_bytes = static_cast<uint32_t>(elements * static_cast<int64_t>(sizeof(float)));
+ add(reg_input_state, state_bytes);
+ if (m_jcp.state_mode == jit_selective_ssm_state_mode::separate) {
+ add(reg_output_state, state_bytes);
+ }
+ add(reg_input_projection, projection_bytes);
+ add(reg_output_projection, projection_bytes);
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::advance_row_pointers(size_t rows) {
+ add(reg_input_state, rows * m_jcp.state_size * m_jcp.state_precision.size());
+ if (m_jcp.state_mode == jit_selective_ssm_state_mode::separate) {
+ add(reg_output_state, rows * m_jcp.state_size * m_jcp.state_precision.size());
+ }
+ add(reg_x, rows * m_jcp.data_precision.size());
+ add(reg_output, rows * m_jcp.data_precision.size());
+}
+
+template <cpu_isa_t isa>
+void jit_selective_ssm_kernel<isa>::generate() {
+ this->preamble();
+
+ mov(reg_args, abi_param1);
+ mov(reg_input_state, ptr[reg_args + GET_OFF(input_state)]);
+ if (m_jcp.state_mode == jit_selective_ssm_state_mode::separate) {
+ mov(reg_output_state, ptr[reg_args + GET_OFF(output_state)]);
+ }
+ mov(reg_input_projection, ptr[reg_args + GET_OFF(input_projection)]);
+ mov(reg_output_projection, ptr[reg_args + GET_OFF(output_projection)]);
+ mov(reg_x, ptr[reg_args + GET_OFF(x)]);
+ mov(reg_output, ptr[reg_args + GET_OFF(output)]);
+ mov(reg_steps, ptr[reg_args + GET_OFF(steps)]);
+ if constexpr (isa != avx2) {
+ const auto tail = m_jcp.state_size % vector_size;
+ if (tail != 0) {
+ mov(eax, static_cast<uint32_t>((uint32_t{1} << tail) - 1U));
+ kmovw(k_tail, eax);
+ }
+ }
+ Xbyak::Label token_loop;
+ Xbyak::Label kernel_exit;
+ if (m_jcp.state_mode == jit_selective_ssm_state_mode::in_place) {
+ mov(reg_tokens, ptr[reg_args + GET_OFF(token_count)]);
+ test(reg_tokens, reg_tokens);
+ jz(kernel_exit, T_NEAR);
+ }
+ L(token_loop);
+ mov(reg_rows, ptr[reg_args + GET_OFF(row_count)]);
+ vbroadcastss(vmm_decay, ptr[reg_steps + offsetof(jit_selective_ssm_step, decay)]);
+
+ Xbyak::Label main_loop;
+ Xbyak::Label tail_loop;
+ Xbyak::Label end;
+
+ constexpr size_t active_row_tile = max_row_tile;
+ cmp(reg_rows, active_row_tile);
+ jb(tail_loop, T_NEAR);
+ align(16);
+ L(main_loop);
+ emit_row_tile(active_row_tile);
+ advance_row_pointers(active_row_tile);
+ sub(reg_rows, active_row_tile);
+ cmp(reg_rows, active_row_tile);
+ jae(main_loop, T_NEAR);
+
+ L(tail_loop);
+ test(reg_rows, reg_rows);
+ jz(end, T_NEAR);
+ emit_row_tile(1);
+ advance_row_pointers(1);
+ dec(reg_rows);
+ jnz(tail_loop, T_NEAR);
+
+ L(end);
+ if (m_jcp.state_mode == jit_selective_ssm_state_mode::in_place) {
+ dec(reg_tokens);
+ jz(kernel_exit, T_NEAR);
+ // main_loop visits max_row_tile rows per iteration and tail_loop one; together they visit exactly
+ // row_count rows. Each advance_row_pointers(rows) adds rows * data_precision.size() to x/output,
+ // so their accumulated displacement is row_count * data_precision.size(). Subtract that amount
+ // to restore the token bases before applying input_stride, which also skips the other heads/tiles.
+ mov(rax, ptr[reg_args + GET_OFF(row_count)]);
+ imul(rax, rax, static_cast<int>(m_jcp.data_precision.size()));
+ sub(reg_x, rax);
+ sub(reg_output, rax);
+ add(reg_x, ptr[reg_args + GET_OFF(input_stride)]);
+ add(reg_output, ptr[reg_args + GET_OFF(input_stride)]);
+ add(reg_input_projection, ptr[reg_args + GET_OFF(projection_stride)]);
+ add(reg_output_projection, ptr[reg_args + GET_OFF(projection_stride)]);
+ mov(reg_input_state, ptr[reg_args + GET_OFF(input_state)]);
+ add(reg_steps, sizeof(jit_selective_ssm_step));
+ jmp(token_loop, T_NEAR);
+ }
+ L(kernel_exit);
+ this->postamble();
+ for (const auto& emitter : emitters) {
+ if (emitter.second) {
+ emitter.second->emit_data();
+ }
+ }
+}
+
+bool is_selective_ssm_jit_precision_supported(const ov::element::Type& precision) {
+ if (precision == ov::element::f32) {
+ return mayiuse(avx2);
+ }
+ if (precision == ov::element::f16) {
+ return mayiuse(avx512_core_fp16) || mayiuse(avx2_vnni_2);
+ }
+ if (precision == ov::element::bf16) {
+ return mayiuse(avx512_core_bf16) || mayiuse(avx2_vnni_2);
+ }
+ return false;
+}
+
+std::shared_ptr<JitKernelBase> create_selective_ssm_jit_kernel(const ov::element::Type& data_precision,
+ size_t state_size,
+ const ov::element::Type& state_precision,
+ jit_selective_ssm_state_mode state_mode) {
+ // FP32 requires AVX2; BF16/FP16 additionally require their native conversion ISA (AVX-512 BF16/FP16 or
+ // AVX2 VNNI2). Recurrence arithmetic is always FP32. States contain 1..4096 elements and may be stored
+ // in FP32 or data_precision. Multi-token in_place mode keeps the working state in FP32; separate/no_store
+ // are single-token modes and may read/write the native data precision. Unsupported combinations return
+ // nullptr so executor selection can fall back to the portable implementation.
+ if (!is_selective_ssm_jit_precision_supported(data_precision)) {
+ return nullptr;
+ }
+ if (state_size == 0 || state_size > max_selective_ssm_jit_state_size) {
+ return nullptr;
+ }
+ if (state_precision != ov::element::f32 && state_precision != data_precision) {
+ return nullptr;
+ }
+ if (state_mode != jit_selective_ssm_state_mode::in_place && state_mode != jit_selective_ssm_state_mode::separate &&
+ state_mode != jit_selective_ssm_state_mode::no_store) {
+ return nullptr;
+ }
+ if (state_precision != ov::element::f32 && state_mode == jit_selective_ssm_state_mode::in_place) {
+ return nullptr;
+ }
+
+ const jit_selective_ssm_compile_params compile_params{
+ data_precision,
+ state_precision,
+ state_size,
+ state_mode,
+ };
+ // Vector width selects the recurrence kernel; the emitters select native FP16/BF16 conversions.
+ if (mayiuse(avx512_core)) {
+ auto result = std::make_shared<jit_selective_ssm_kernel<avx512_core>>(compile_params);
+ result->create_kernel();
+ return result;
+ }
+ if (mayiuse(avx2)) {
+ auto result = std::make_shared<jit_selective_ssm_kernel<avx2>>(compile_params);
+ result->create_kernel();
+ return result;
+ }
+ return nullptr;
+}
+
+template class jit_selective_ssm_kernel<avx2>;
+template class jit_selective_ssm_kernel<avx512_core>;
+
+} // namespace ov::intel_cpu::kernel
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_kernel.hpp
new file mode 100644
index 00000000000..c6a5a97af18
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_kernel.hpp
@@ -0,0 +1,178 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <xbyak/xbyak.h>
+
+#include <cpu/x64/cpu_isa_traits.hpp>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <type_traits>
+#include <unordered_map>
+#include <vector>
+
+#include "emitters/plugin/x64/jit_emitter.hpp"
+#include "jit_kernel_base.hpp"
+#include "openvino/core/type/element_type.hpp"
+
+namespace ov::intel_cpu::kernel {
+
+// Supported state-size limit. Large states use a runtime loop over bounded groups of vectors.
+constexpr size_t max_selective_ssm_jit_state_size = 4096;
+
+enum class jit_selective_ssm_state_mode : std::uint8_t { in_place, separate, no_store };
+
+struct jit_selective_ssm_compile_params {
+ ov::element::Type data_precision = ov::element::dynamic;
+ ov::element::Type state_precision = ov::element::dynamic;
+ size_t state_size = 0;
+ jit_selective_ssm_state_mode state_mode = jit_selective_ssm_state_mode::in_place;
+};
+
+struct jit_selective_ssm_step {
+ float decay = 0.F;
+ float delta = 0.F;
+};
+
+struct jit_selective_ssm_call_args {
+ const void* input_state = nullptr;
+ const float* input_projection = nullptr;
+ const float* output_projection = nullptr;
+ const void* x = nullptr;
+ void* output = nullptr;
+ const jit_selective_ssm_step* steps = nullptr;
+ size_t row_count = 0;
+ void* output_state = nullptr;
+ size_t token_count = 1;
+ size_t input_stride = 0; // Bytes between consecutive tokens in x/output.
+ size_t projection_stride = 0; // Bytes between consecutive FP32 B/C projections.
+};
+
+template <dnnl::impl::cpu::x64::cpu_isa_t isa>
+class jit_selective_ssm_kernel : public JitKernel<jit_selective_ssm_compile_params, jit_selective_ssm_call_args> {
+public:
+ DECLARE_CPU_JIT_AUX_FUNCTIONS(jit_selective_ssm_kernel)
+
+ explicit jit_selective_ssm_kernel(const jit_selective_ssm_compile_params& jcp) : JitKernel(jit_name(), jcp, isa) {}
+
+private:
+ using Vmm = std::conditional_t<(isa & dnnl::impl::cpu::x64::zmm_bit) != 0, Xbyak::Zmm, Xbyak::Ymm>;
+
+ static constexpr size_t vector_size = dnnl::impl::cpu::x64::cpu_isa_traits_t<isa>::vlen / sizeof(float);
+ static constexpr size_t max_row_tile = 4;
+ // Keep the common 128-element state fully unrolled on AVX2 and AVX-512.
+ static constexpr size_t max_unrolled_vectors = 16;
+ // An even chunk length preserves accumulator-bank parity when the runtime vector loop restarts at index 0.
+ static_assert(max_unrolled_vectors % 2 == 0);
+
+ // Preparation scratch aliases the first accumulator, before any accumulation bank is initialized.
+ static constexpr size_t delta_scratch_vmm_idx = max_row_tile;
+ // Output packing reuses state registers only after every state store and scalar reduction is complete.
+ static constexpr size_t packed_output_low_vmm_idx = 0;
+ static constexpr size_t packed_output_high_vmm_idx = 1;
+
+ // Conversion emitters own this contiguous range while load/store helpers are active.
+ static constexpr size_t aux_vmm_base = isa == dnnl::impl::cpu::x64::avx2 ? 3 * max_row_tile + 3 : 20;
+ static constexpr size_t aux_vmm_count = isa == dnnl::impl::cpu::x64::avx2 ? 1 : 6;
+ static constexpr size_t second_accumulator_vmm_base = aux_vmm_base + aux_vmm_count;
+ // AVX2 reduction reuses state registers after all state stores; recurrence uses all 16 YMM registers.
+ static constexpr size_t reduction_tmp0_vmm_idx = isa == dnnl::impl::cpu::x64::avx2 ? 0 : 3 * max_row_tile + 3;
+ static constexpr size_t reduction_tmp1_vmm_idx = isa == dnnl::impl::cpu::x64::avx2 ? 1 : 3 * max_row_tile + 4;
+
+ void generate() override;
+ void emit_row_tile(size_t rows);
+ void emit_state_vector(size_t rows,
+ size_t active_lanes,
+ size_t vector_index,
+ size_t projection_offset,
+ size_t state_vector_offset);
+ void load_projections(size_t active_lanes, size_t projection_offset);
+ void load_state(const Vmm& destination, size_t active_lanes, size_t offset);
+ void compute_state(size_t row, size_t active_lanes);
+ void accumulate_output(size_t row, size_t active_lanes, size_t vector);
+ void store_state(const Vmm& source, size_t active_lanes, size_t offset);
+ void advance_row_pointers(size_t rows);
+ void advance_state_pointers(int64_t elements);
+ // Initialize both banks for one row on AVX-512, or the single bank on AVX2.
+ void zero_accumulators(size_t row);
+ // Fold the odd bank into the even bank for one row; AVX2 needs no fold.
+ void fold_partial_accumulators(size_t row);
+ void reduce_to_scalar(const Vmm& accumulator);
+ void store_output(const Vmm& source, int element_count, size_t offset = 0);
+ void prepare_row_scales();
+ void store_row_tile();
+ void load(const Vmm& destination,
+ const Xbyak::Reg64& source,
+ const ov::element::Type& source_precision,
+ int element_count,
+ size_t offset = 0,
+ bool zero_fill = true);
+ void store(const Xbyak::Reg64& destination,
+ const Vmm& source,
+ const ov::element::Type& destination_precision,
+ int element_count,
+ size_t offset = 0);
+
+ static Vmm state_vmm(size_t row) {
+ return Vmm(row);
+ }
+ // Output dot products alternate banks for even/odd state vectors on AVX-512 to hide FMA latency.
+ // The first bank follows the state registers; the second follows the conversion-emitter auxiliaries.
+ // AVX2 has only 16 registers and keeps a single bank to leave room for state, scales and projections.
+ static Vmm accumulator_vmm(size_t row, size_t vector = 0) {
+ if constexpr ((isa & dnnl::impl::cpu::x64::zmm_bit) != 0) {
+ if (vector % 2 != 0) {
+ return Vmm(second_accumulator_vmm_base + row);
+ }
+ }
+ return Vmm(max_row_tile + row);
+ }
+ static Vmm input_scale_vmm(size_t row) {
+ return Vmm(2 * max_row_tile + row);
+ }
+
+ const Xbyak::Reg64 reg_args = rbx;
+ const Xbyak::Reg64 reg_input_state = r8;
+ const Xbyak::Reg64 reg_output_state = rbp;
+ const Xbyak::Reg64 reg_input_projection = r9;
+ const Xbyak::Reg64 reg_output_projection = r10;
+ const Xbyak::Reg64 reg_x = r11;
+ const Xbyak::Reg64 reg_output = r12;
+ const Xbyak::Reg64 reg_rows = r13;
+ const Xbyak::Reg64 reg_vector_chunks = rdx;
+ const Xbyak::Reg64 reg_steps = rsi;
+ const Xbyak::Reg64 reg_tokens = rdi;
+
+ const Vmm vmm_decay = Vmm(3 * max_row_tile);
+ const Vmm vmm_input_projection = Vmm(3 * max_row_tile + 1);
+ const Vmm vmm_output_projection = Vmm(3 * max_row_tile + 2);
+ const Vmm vmm_reduce_tmp0 = Vmm(reduction_tmp0_vmm_idx);
+ const Vmm vmm_reduce_tmp1 = Vmm(reduction_tmp1_vmm_idx);
+ // Shared load/store emitters use k1; keep the recurrence tail mask in a separate register.
+ const Xbyak::Opmask k_tail = k2;
+
+ std::unordered_map<size_t, std::unique_ptr<jit_emitter>> emitters;
+ const std::vector<size_t> pool_aux_gpr_idxs = {static_cast<size_t>(rax.getIdx()),
+ static_cast<size_t>(r14.getIdx()),
+ static_cast<size_t>(r15.getIdx())};
+ const std::vector<size_t> pool_aux_vmm_idxs = [] {
+ std::vector<size_t> indices(aux_vmm_count);
+ for (size_t index = 0; index < aux_vmm_count; ++index) {
+ indices[index] = aux_vmm_base + index;
+ }
+ return indices;
+ }();
+};
+
+bool is_selective_ssm_jit_precision_supported(const ov::element::Type& precision);
+
+std::shared_ptr<JitKernelBase> create_selective_ssm_jit_kernel(
+ const ov::element::Type& data_precision,
+ size_t state_size,
+ const ov::element::Type& state_precision = ov::element::f32,
+ jit_selective_ssm_state_mode state_mode = jit_selective_ssm_state_mode::in_place);
+
+} // namespace ov::intel_cpu::kernel
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_runtime.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_runtime.cpp
new file mode 100644
index 00000000000..5c6aa666afc
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_runtime.cpp
@@ -0,0 +1,418 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "selective_ssm_jit_runtime.hpp"
+
+#include <algorithm>
+#include <array>
+#include <cmath>
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
+#include <type_traits>
+
+#include "cpu_parallel.hpp"
+#include "nodes/kernels/scaled_attn/common.hpp"
+#include "nodes/kernels/selective_ssm.hpp"
+#include "nodes/kernels/x64/jit_kernel_base.hpp"
+#include "nodes/kernels/x64/selective_ssm_jit_kernel.hpp"
+#include "openvino/core/except.hpp"
+#include "openvino/core/parallel.hpp"
+#include "openvino/core/type/bfloat16.hpp"
+#include "openvino/core/type/element_type.hpp"
+#include "openvino/core/type/float16.hpp"
+#include "openvino/util/math_util.hpp"
+
+namespace ov::intel_cpu::kernel {
+namespace {
+
+// The recurrence timestep loop runs inside JIT. Only preparation of exp(A * delta) remains here, in bounded
+// batches to keep stack storage independent of sequence length. Paged batches also end at snapshot boundaries,
+// where C++ must publish the working state before the next token overwrites it.
+constexpr size_t max_token_batch = 64;
+
+template <typename Destination, typename Source>
+void copy_convert(Destination* destination, const Source* source, size_t count) {
+ if constexpr (std::is_same_v<Destination, Source>) {
+ if (destination != source) {
+ std::memcpy(destination, source, count * sizeof(Destination));
+ }
+ } else {
+ ov::Extensions::Cpu::XARCH::cvt_copy(destination, const_cast<Source*>(source), 1, count, count, count);
+ }
+}
+
+void run_recurrence_kernel(const JitKernelBase& kernel,
+ const void* input_state,
+ void* output_state,
+ const float* input_projection,
+ const float* output_projection,
+ const void* input,
+ void* output,
+ float decay,
+ float time_step,
+ size_t row_count,
+ const jit_selective_ssm_step* steps = nullptr,
+ size_t token_count = 1,
+ size_t input_stride = 0,
+ size_t projection_stride = 0) {
+ const jit_selective_ssm_step single_step{decay, time_step};
+ const jit_selective_ssm_call_args args{
+ input_state,
+ input_projection,
+ output_projection,
+ input,
+ output,
+ steps != nullptr ? steps : &single_step,
+ row_count,
+ output_state,
+ token_count,
+ input_stride,
+ projection_stride,
+ };
+ kernel(&args);
+}
+
+struct StateWorkLayout {
+ size_t container_stride;
+ size_t head_stride;
+ size_t scratch_stride;
+ size_t heads_per_group;
+ size_t head_dim_tile_count;
+};
+
+StateWorkLayout make_state_work_layout(size_t num_heads,
+ size_t num_groups,
+ size_t head_dim,
+ size_t state_size,
+ size_t head_dim_tile,
+ const char* container_name) {
+ return {
+ node::kernel::checked_size_product({num_heads, head_dim, state_size}, container_name),
+ node::kernel::checked_size_product({head_dim, state_size}, "JIT recurrent state head"),
+ node::kernel::checked_size_product({head_dim_tile, state_size}, "JIT state scratch"),
+ num_heads / num_groups,
+ ov::util::ceil_div(head_dim, head_dim_tile),
+ };
+}
+
+struct TensorCursor {
+ size_t token_head;
+ size_t projection;
+ size_t input;
+
+ void advance(size_t num_heads, size_t projection_stride, size_t input_stride) {
+ token_head += num_heads;
+ projection += projection_stride;
+ input += input_stride;
+ }
+};
+
+template <typename Data>
+void run_selective_ssm(const Data* state_decay_rates,
+ const Data* time_steps,
+ const float* input_projections,
+ const Data* input,
+ const float* output_projections,
+ const Data* initial_state,
+ Data* output,
+ Data* final_state,
+ const node::kernel::SelectiveSSMShape& shape,
+ float* state_scratch,
+ size_t head_dim_tile,
+ const CpuParallelPtr& cpu_parallel,
+ const JitKernelBase& fp32_state_kernel,
+ const JitKernelBase* direct_state_kernel) {
+ const auto layout = make_state_work_layout(shape.num_heads,
+ shape.num_groups,
+ shape.head_dim,
+ shape.state_size,
+ head_dim_tile,
+ "JIT recurrent state batch");
+ const auto projection_stride = shape.num_groups * shape.state_size;
+ const auto input_stride = shape.num_heads * shape.head_dim;
+
+ cpu_parallel->parallel_for3d(
+ shape.batch_size,
+ shape.num_heads,
+ layout.head_dim_tile_count,
+ [&](size_t batch, size_t head, size_t tile) {
+ const auto head_dim_begin = tile * head_dim_tile;
+ const auto head_dim_count = std::min(head_dim_tile, shape.head_dim - head_dim_begin);
+ const auto projection_group = head / layout.heads_per_group;
+ const auto state_offset =
+ batch * layout.container_stride + head * layout.head_stride + head_dim_begin * shape.state_size;
+ const auto state_elements = head_dim_count * shape.state_size;
+ const auto state_decay_rate = static_cast<float>(state_decay_rates[head]);
+ auto token_head_offset = (batch * shape.sequence_length) * shape.num_heads + head;
+ auto projection_offset =
+ ((batch * shape.sequence_length) * shape.num_groups + projection_group) * shape.state_size;
+ auto input_offset = token_head_offset * shape.head_dim + head_dim_begin;
+
+ if (shape.sequence_length == 1 && direct_state_kernel != nullptr) {
+ const auto time_step = static_cast<float>(time_steps[token_head_offset]);
+ run_recurrence_kernel(*direct_state_kernel,
+ initial_state + state_offset,
+ final_state + state_offset,
+ input_projections + projection_offset,
+ output_projections + projection_offset,
+ input + input_offset,
+ output + input_offset,
+ std::exp(state_decay_rate * time_step),
+ time_step,
+ head_dim_count);
+ return;
+ }
+
+ float* local_state = nullptr;
+ if constexpr (std::is_same_v<Data, float>) {
+ local_state = final_state + state_offset;
+ } else {
+ // A serial call outside a TBB arena has no worker slot.
+ const auto worker = static_cast<size_t>(std::max(0, parallel_get_thread_num()));
+ local_state = state_scratch + worker * layout.scratch_stride;
+ }
+ copy_convert(local_state, initial_state + state_offset, state_elements);
+
+ std::array<jit_selective_ssm_step, max_token_batch> steps{};
+ for (size_t token = 0; token < shape.sequence_length;) {
+ const auto count = std::min(max_token_batch, shape.sequence_length - token);
+ for (size_t i = 0; i < count; ++i) {
+ const auto delta = static_cast<float>(time_steps[token_head_offset + i * shape.num_heads]);
+ steps[i] = {std::exp(state_decay_rate * delta), delta};
+ }
+ run_recurrence_kernel(fp32_state_kernel,
+ local_state,
+ local_state,
+ input_projections + projection_offset,
+ output_projections + projection_offset,
+ input + input_offset,
+ output + input_offset,
+ steps[0].decay,
+ steps[0].delta,
+ head_dim_count,
+ steps.data(),
+ count,
+ input_stride * sizeof(Data),
+ projection_stride * sizeof(float));
+ token += count;
+ token_head_offset += count * shape.num_heads;
+ projection_offset += count * projection_stride;
+ input_offset += count * input_stride;
+ }
+
+ if constexpr (!std::is_same_v<Data, float>) {
+ copy_convert(final_state + state_offset, local_state, state_elements);
+ }
+ });
+}
+
+template <typename Data>
+void dispatch_selective_ssm(const SelectiveSSMJitRuntimeArgs& args) {
+ run_selective_ssm(static_cast<const Data*>(args.state_decay_rates),
+ static_cast<const Data*>(args.time_steps),
+ args.input_projections,
+ static_cast<const Data*>(args.input),
+ args.output_projections,
+ static_cast<const Data*>(args.initial_state),
+ static_cast<Data*>(args.output),
+ static_cast<Data*>(args.final_state),
+ args.shape,
+ args.state_scratch,
+ args.head_dim_tile,
+ args.cpu_parallel,
+ *args.fp32_state_kernel,
+ args.direct_state_kernel);
+}
+
+template <typename Data, typename Index>
+void run_paged_selective_ssm(const PagedSelectiveSSMJitRuntimeArgs& args) {
+ const auto* state_decay_rates = static_cast<const Data*>(args.state_decay_rates);
+ const auto* time_steps = static_cast<const Data*>(args.time_steps);
+ const auto* input = static_cast<const Data*>(args.input);
+ auto* state_cache = static_cast<Data*>(args.state_cache);
+ const auto* subsequence_begins = static_cast<const Index*>(args.subsequence_begins);
+ const auto* block_indices = static_cast<const Index*>(args.block_indices);
+ const auto* block_indices_begins = static_cast<const Index*>(args.block_indices_begins);
+ const auto* num_processed_tokens = static_cast<const Index*>(args.num_processed_tokens);
+ const auto* cache_intervals = static_cast<const Index*>(args.cache_intervals);
+ const auto* input_projections = args.input_projections;
+ const auto* output_projections = args.output_projections;
+ const auto* fp32_state_kernel = args.fp32_state_kernel;
+ const auto* direct_state_kernel = args.direct_state_kernel;
+ const auto* no_state_store_kernel = args.no_state_store_kernel;
+ auto* state_scratch = args.state_scratch;
+ auto* output = static_cast<Data*>(args.output);
+ const auto& shape = args.shape;
+ const auto head_dim_tile = args.head_dim_tile;
+
+ const auto layout = make_state_work_layout(shape.num_heads,
+ shape.num_groups,
+ shape.head_dim,
+ shape.state_size,
+ head_dim_tile,
+ "JIT state block");
+ const auto projection_stride = shape.num_groups * shape.state_size;
+ const auto input_stride = shape.num_heads * shape.head_dim;
+
+ args.cpu_parallel->parallel_for3d(
+ shape.sequence_count,
+ shape.num_heads,
+ layout.head_dim_tile_count,
+ [&](size_t sequence, size_t head, size_t tile) {
+ const auto token_begin = static_cast<size_t>(subsequence_begins[sequence]);
+ const auto token_end = static_cast<size_t>(subsequence_begins[sequence + 1]);
+ if (token_begin == token_end) {
+ return;
+ }
+
+ const auto head_dim_begin = tile * head_dim_tile;
+ const auto head_dim_count = std::min(head_dim_tile, shape.head_dim - head_dim_begin);
+ const auto projection_group = head / layout.heads_per_group;
+ const auto logical_block_begin = static_cast<size_t>(block_indices_begins[sequence]);
+ const auto read_block = static_cast<size_t>(block_indices[logical_block_begin]);
+ const auto state_offset = head * layout.head_stride + head_dim_begin * shape.state_size;
+ const auto* initial_state = state_cache + read_block * layout.container_stride + state_offset;
+ const auto state_decay_rate = static_cast<float>(state_decay_rates[head]);
+ const auto interval = static_cast<int64_t>(cache_intervals[sequence]);
+ const auto cache =
+ PagedCacheSchedule::make(interval, static_cast<uint64_t>(num_processed_tokens[sequence]));
+ TensorCursor cursor{
+ token_begin * shape.num_heads + head,
+ (token_begin * shape.num_groups + projection_group) * shape.state_size,
+ (token_begin * shape.num_heads + head) * shape.head_dim + head_dim_begin,
+ };
+ const auto state_elements = head_dim_count * shape.state_size;
+
+ if (token_end == token_begin + 1) {
+ const auto time_step = static_cast<float>(time_steps[cursor.token_head]);
+ if (cache.enabled && direct_state_kernel != nullptr) {
+ const auto token_count = cache.absolute_token_count(1);
+ const auto write_block =
+ static_cast<size_t>(block_indices[logical_block_begin + cache.snapshot_slot(token_count)]);
+ auto* snapshot = state_cache + write_block * layout.container_stride + state_offset;
+ run_recurrence_kernel(*direct_state_kernel,
+ initial_state,
+ snapshot,
+ input_projections + cursor.projection,
+ output_projections + cursor.projection,
+ input + cursor.input,
+ output + cursor.input,
+ std::exp(state_decay_rate * time_step),
+ time_step,
+ head_dim_count);
+ return;
+ }
+ if (!cache.enabled && no_state_store_kernel != nullptr) {
+ run_recurrence_kernel(*no_state_store_kernel,
+ initial_state,
+ nullptr,
+ input_projections + cursor.projection,
+ output_projections + cursor.projection,
+ input + cursor.input,
+ output + cursor.input,
+ std::exp(state_decay_rate * time_step),
+ time_step,
+ head_dim_count);
+ return;
+ }
+ }
+
+ const auto worker = static_cast<size_t>(std::max(0, parallel_get_thread_num()));
+ auto* local_state = state_scratch + worker * layout.scratch_stride;
+ if constexpr (std::is_same_v<Data, float>) {
+ const auto snapshot_count = cache.snapshot_count(token_end - token_begin);
+ // A single f32 snapshot can hold the working state, avoiding the scratch buffer and final copy.
+ if (snapshot_count == 1 && args.reuse_state_cache) {
+ const auto write_block = static_cast<size_t>(block_indices[logical_block_begin + snapshot_count]);
+ local_state = state_cache + write_block * layout.container_stride + state_offset;
+ }
+ }
+ copy_convert(local_state, initial_state, state_elements);
+
+ std::array<jit_selective_ssm_step, max_token_batch> steps{};
+ for (size_t token = token_begin; token < token_end;) {
+ auto count = std::min(max_token_batch, token_end - token);
+ if (cache.enabled) {
+ const auto processed = cache.absolute_token_count(token - token_begin);
+ const auto until_snapshot = cache.interval - processed % cache.interval;
+ count = std::min(count, static_cast<size_t>(until_snapshot));
+ }
+ for (size_t i = 0; i < count; ++i) {
+ const auto delta = static_cast<float>(time_steps[cursor.token_head + i * shape.num_heads]);
+ steps[i] = {std::exp(state_decay_rate * delta), delta};
+ }
+ run_recurrence_kernel(*fp32_state_kernel,
+ local_state,
+ local_state,
+ input_projections + cursor.projection,
+ output_projections + cursor.projection,
+ input + cursor.input,
+ output + cursor.input,
+ steps[0].decay,
+ steps[0].delta,
+ head_dim_count,
+ steps.data(),
+ count,
+ input_stride * sizeof(Data),
+ projection_stride * sizeof(float));
+ token += count;
+ const auto token_count = cache.absolute_token_count(token - token_begin);
+ if (cache.should_store(token_count, token == token_end)) {
+ const auto write_block =
+ static_cast<size_t>(block_indices[logical_block_begin + cache.snapshot_slot(token_count)]);
+ auto* snapshot = state_cache + write_block * layout.container_stride + state_offset;
+ copy_convert(snapshot, local_state, state_elements);
+ }
+ cursor.advance(count * shape.num_heads, count * projection_stride, count * input_stride);
+ }
+ });
+}
+
+template <typename Data>
+void dispatch_paged_indices(const PagedSelectiveSSMJitRuntimeArgs& args) {
+ if (args.index_precision == ov::element::i32) {
+ run_paged_selective_ssm<Data, int32_t>(args);
+ } else if (args.index_precision == ov::element::i64) {
+ run_paged_selective_ssm<Data, int64_t>(args);
+ } else {
+ OPENVINO_THROW("PagedSelectiveSSM JIT supports only i32/i64 metadata, got ", args.index_precision, ".");
+ }
+}
+
+} // namespace
+
+void selective_ssm_jit(const SelectiveSSMJitRuntimeArgs& args) {
+ OPENVINO_ASSERT(args.head_dim_tile > 0 && args.state_scratch != nullptr);
+ OPENVINO_ASSERT(args.cpu_parallel != nullptr, "SelectiveSSM JIT requires a CPU parallel executor.");
+ OPENVINO_ASSERT(args.fp32_state_kernel != nullptr, "SelectiveSSM JIT kernel is not initialized.");
+
+ if (args.data_precision == ov::element::f32) {
+ dispatch_selective_ssm<float>(args);
+ } else if (args.data_precision == ov::element::f16) {
+ dispatch_selective_ssm<ov::float16>(args);
+ } else if (args.data_precision == ov::element::bf16) {
+ dispatch_selective_ssm<ov::bfloat16>(args);
+ } else {
+ OPENVINO_THROW("SelectiveSSM JIT supports only f32/f16/bf16, got ", args.data_precision, ".");
+ }
+}
+
+void paged_selective_ssm_jit(const PagedSelectiveSSMJitRuntimeArgs& args) {
+ OPENVINO_ASSERT(args.head_dim_tile > 0 && args.state_scratch != nullptr);
+ OPENVINO_ASSERT(args.cpu_parallel != nullptr, "PagedSelectiveSSM JIT requires a CPU parallel executor.");
+ OPENVINO_ASSERT(args.fp32_state_kernel != nullptr, "PagedSelectiveSSM JIT kernel is not initialized.");
+
+ if (args.data_precision == ov::element::f32) {
+ dispatch_paged_indices<float>(args);
+ } else if (args.data_precision == ov::element::f16) {
+ dispatch_paged_indices<ov::float16>(args);
+ } else if (args.data_precision == ov::element::bf16) {
+ dispatch_paged_indices<ov::bfloat16>(args);
+ } else {
+ OPENVINO_THROW("PagedSelectiveSSM JIT supports only f32/f16/bf16, got ", args.data_precision, ".");
+ }
+}
+
+} // namespace ov::intel_cpu::kernel
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_runtime.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_runtime.hpp
new file mode 100644
index 00000000000..320d99c4043
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/selective_ssm_jit_runtime.hpp
@@ -0,0 +1,95 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <cstddef>
+#include <cstdint>
+
+#include "cpu_parallel.hpp"
+#include "nodes/kernels/selective_ssm.hpp"
+#include "openvino/core/type/element_type.hpp"
+
+namespace ov::intel_cpu::kernel {
+
+class JitKernelBase;
+
+struct PagedCacheSchedule {
+ bool enabled = false;
+ uint64_t interval = 1;
+ uint64_t offset = 0;
+
+ static PagedCacheSchedule make(int64_t cache_interval, uint64_t processed_tokens) {
+ if (cache_interval <= 0) {
+ return {};
+ }
+ const auto interval = static_cast<uint64_t>(cache_interval);
+ return {true, interval, processed_tokens % interval};
+ }
+
+ [[nodiscard]] uint64_t absolute_token_count(size_t current_tokens) const {
+ return offset + current_tokens;
+ }
+
+ [[nodiscard]] bool should_store(uint64_t absolute_token_count, bool is_last) const {
+ return enabled && (absolute_token_count % interval == 0 || is_last);
+ }
+
+ [[nodiscard]] size_t snapshot_slot(uint64_t absolute_token_count) const {
+ return 1 + (absolute_token_count - 1) / interval;
+ }
+
+ [[nodiscard]] size_t snapshot_count(size_t current_tokens) const {
+ return enabled && current_tokens > 0 ? snapshot_slot(absolute_token_count(current_tokens)) : 0;
+ }
+};
+
+struct SelectiveSSMJitRuntimeArgs {
+ const void* state_decay_rates = nullptr;
+ const void* time_steps = nullptr;
+ const float* input_projections = nullptr;
+ const void* input = nullptr;
+ const float* output_projections = nullptr;
+ const void* initial_state = nullptr;
+ void* output = nullptr;
+ void* final_state = nullptr;
+ node::kernel::SelectiveSSMShape shape{};
+ ov::element::Type data_precision = ov::element::dynamic;
+ float* state_scratch = nullptr;
+ size_t head_dim_tile = 0;
+ CpuParallelPtr cpu_parallel;
+ const JitKernelBase* fp32_state_kernel = nullptr;
+ const JitKernelBase* direct_state_kernel = nullptr;
+};
+
+struct PagedSelectiveSSMJitRuntimeArgs {
+ const void* state_decay_rates = nullptr;
+ const void* time_steps = nullptr;
+ const float* input_projections = nullptr;
+ const void* input = nullptr;
+ const float* output_projections = nullptr;
+ void* state_cache = nullptr;
+ const void* subsequence_begins = nullptr;
+ const void* block_indices = nullptr;
+ const void* block_indices_begins = nullptr;
+ const void* num_processed_tokens = nullptr;
+ const void* cache_intervals = nullptr;
+ void* output = nullptr;
+ node::kernel::PagedSelectiveSSMShape shape{};
+ ov::element::Type data_precision = ov::element::dynamic;
+ ov::element::Type index_precision = ov::element::dynamic;
+ float* state_scratch = nullptr;
+ bool reuse_state_cache = false;
+ size_t head_dim_tile = 0;
+ CpuParallelPtr cpu_parallel;
+ const JitKernelBase* fp32_state_kernel = nullptr;
+ const JitKernelBase* direct_state_kernel = nullptr;
+ const JitKernelBase* no_state_store_kernel = nullptr;
+};
+
+void selective_ssm_jit(const SelectiveSSMJitRuntimeArgs& args);
+
+void paged_selective_ssm_jit(const PagedSelectiveSSMJitRuntimeArgs& args);
+
+} // namespace ov::intel_cpu::kernel
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/paged_selective_ssm.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/paged_selective_ssm.cpp
index b4fc78a0549..508f9109a8f 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/paged_selective_ssm.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/paged_selective_ssm.cpp
@@ -7,6 +7,7 @@
#include <algorithm>
#include <cmath>
#include <cstdint>
+#include <limits>
#include <numeric>
#include <sstream>
#include <vector>
@@ -26,6 +27,7 @@
#include "openvino/runtime/tensor.hpp"
#include "transformations/rt_info/keep_const_precision.hpp"
#include "utils/precision_support.h"
+#include "utils/ssm_reference.hpp"
namespace {
enum class InputPort : size_t {
@@ -123,7 +125,8 @@ void run_reference(const std::vector<DataT>& A,
reduction += static_cast<double>(state[state_base + state_index]) *
static_cast<float>(C[projection_base + state_index]);
}
- output[(token * num_heads + head) * head_dim + position] = static_cast<DataT>(reduction);
+ output[(token * num_heads + head) * head_dim + position] =
+ ov::test::utils::ssm_reference_cast<DataT>(static_cast<float>(reduction));
}
if (interval > 0) {
@@ -141,7 +144,8 @@ void run_reference(const std::vector<DataT>& A,
for (size_t position = 0; position < head_dim; ++position) {
for (size_t state_index = 0; state_index < state_size; ++state_index) {
recurrent_state_table[state_off(write_block, head, position, state_index)] =
- static_cast<StateT>(state[position * state_size + state_index]);
+ ov::test::utils::ssm_reference_cast<StateT>(
+ state[position * state_size + state_index]);
}
}
}
@@ -181,13 +185,15 @@ ov::Tensor make_f32_tensor(const ov::Shape& shape, const std::vector<float>& val
std::shared_ptr<ov::Model> make_paged_validation_model(size_t token_count = 1,
size_t physical_block_count = 2,
- const ov::element::Type& index_type = ov::element::i32) {
+ const ov::element::Type& index_type = ov::element::i32,
+ size_t state_size = 1) {
auto A = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1});
auto dt = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{token_count, 1});
- auto B = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{token_count, 1, 1});
+ auto B = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{token_count, 1, state_size});
auto x = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{token_count, 1, 1});
- auto C = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{token_count, 1, 1});
- auto state = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{physical_block_count, 1, 1, 1});
+ auto C = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{token_count, 1, state_size});
+ auto state =
+ std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{physical_block_count, 1, 1, state_size});
auto subsequences = std::make_shared<ov::op::v0::Parameter>(index_type, ov::Shape{2});
auto blocks = std::make_shared<ov::op::v0::Parameter>(index_type, ov::Shape{physical_block_count});
auto block_begins = std::make_shared<ov::op::v0::Parameter>(index_type, ov::Shape{2});
@@ -753,8 +759,15 @@ void PagedSelectiveSSMLayerTest::compare(const std::vector<ov::Tensor>& expected
abs_threshold = 2e-4f;
rel_threshold = 1e-5f;
}
- ov::test::utils::compare(expected[0], actual[0], abs_threshold, rel_threshold);
- ov::test::utils::compare(expected[1], actual[1], abs_threshold, rel_threshold);
+ for (size_t i = 0; i < expected.size(); ++i) {
+ // FP32 update/reduction orders can straddle an FP16 rounding midpoint. Allow one representable step
+ // for FP16 tensors while keeping FP32 output and state checks at their original tolerance.
+ const double tensor_rel_threshold =
+ expected[i].get_element_type() == ov::element::f16
+ ? std::max(rel_threshold, static_cast<double>(std::numeric_limits<ov::float16>::epsilon()))
+ : rel_threshold;
+ ov::test::utils::compare(expected[i], actual[i], abs_threshold, tensor_rel_threshold);
+ }
}
TEST_P(PagedSelectiveSSMLayerTest, Inference) {
@@ -792,7 +805,7 @@ TEST(PagedSelectiveSSMFunctionalTest, AlignsComputationPrecisionAfterCpuLowering
}
}
-TEST(PagedSelectiveSSMFunctionalTest, RejectsMalformedMetadataBeforeExecution) {
+TEST(PagedSelectiveSSMFunctionalTest, PortableExecutorRejectsMalformedMetadataBeforeExecution) {
struct MetadataCase {
const char* name;
std::vector<int32_t> subsequences;
@@ -812,8 +825,21 @@ TEST(PagedSelectiveSSMFunctionalTest, RejectsMalformedMetadataBeforeExecution) {
};
ov::Core core;
- auto compiled_model =
- core.compile_model(make_paged_validation_model(), "CPU", ov::hint::inference_precision(ov::element::f32));
+ // The portable executor validates metadata; the JIT trusts the runtime mapping.
+ // A large state selects the portable executor on both x86 and non-x86 hosts.
+ constexpr size_t state_size = 8192;
+ auto compiled_model = core.compile_model(make_paged_validation_model(1, 2, ov::element::i32, state_size),
+ "CPU",
+ ov::hint::inference_precision(ov::element::f32));
+ size_t matching_nodes = 0;
+ for (const auto& node : compiled_model.get_runtime_model()->get_ops()) {
+ const auto& info = node->get_rt_info();
+ if (info.at(ov::exec_model_info::LAYER_TYPE).as<std::string>() == "PagedSelectiveSSM") {
+ ASSERT_EQ(info.at(ov::exec_model_info::IMPL_TYPE).as<std::string>(), "ref_any_f32");
+ ++matching_nodes;
+ }
+ }
+ ASSERT_EQ(matching_nodes, 1U);
for (const auto& test_case : cases) {
SCOPED_TRACE(test_case.name);
auto request = compiled_model.create_infer_request();
@@ -822,10 +848,12 @@ TEST(PagedSelectiveSSMFunctionalTest, RejectsMalformedMetadataBeforeExecution) {
};
set_input(InputPort::A, make_f32_tensor({1}, {-0.2F}));
set_input(InputPort::TimeStep, make_f32_tensor({1, 1}, {0.1F}));
- set_input(InputPort::InputProjection, make_f32_tensor({1, 1, 1}, {0.2F}));
+ set_input(InputPort::InputProjection,
+ make_f32_tensor({1, 1, state_size}, std::vector<float>(state_size, 0.2F)));
set_input(InputPort::Input, make_f32_tensor({1, 1, 1}, {0.3F}));
- set_input(InputPort::OutputProjection, make_f32_tensor({1, 1, 1}, {0.4F}));
- set_input(InputPort::State, make_f32_tensor({2, 1, 1, 1}, {0.F, 0.F}));
+ set_input(InputPort::OutputProjection,
+ make_f32_tensor({1, 1, state_size}, std::vector<float>(state_size, 0.4F)));
+ set_input(InputPort::State, make_f32_tensor({2, 1, 1, state_size}, std::vector<float>(2 * state_size, 0.F)));
set_input(InputPort::SubsequenceBegins, make_index_tensor(test_case.subsequences, ov::element::i32));
set_input(InputPort::BlockIndices, make_index_tensor(test_case.blocks, ov::element::i32));
set_input(InputPort::BlockIndicesBegins, make_index_tensor(test_case.block_begins, ov::element::i32));
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/paged_selective_ssm.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/paged_selective_ssm.cpp
index 2a0f58783e4..b2b9ec5dd4c 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/paged_selective_ssm.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/paged_selective_ssm.cpp
@@ -4,8 +4,63 @@
#include "custom/single_layer_tests/classes/paged_selective_ssm.hpp"
+#include <vector>
+
namespace ov::test {
+namespace {
+std::vector<PagedSelectiveSSMLayerParams> jit_numerical_cases() {
+ std::vector<PagedSelectiveSSMLayerParams> cases{
+ {2, 1, 3, 5, {0, 0}, {0, 11}, {0, -7}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {1, 1, 1, 1, {1}, {0}, {1}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 3, 5, {1}, {7}, {0}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {4, 2, 3, 5, {1}, {4}, {2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {4, 4, 5, 3, {1}, {3}, {2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {6, 3, 7, 9, {2, 0, 5}, {0, 11, 4}, {3, 0, 2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {4, 1, 2, 7, {4, 3}, {1, 0}, {3, 2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 2, 5, 4, {3, 2}, {5, 9}, {0, -3}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 5, 16, {2}, {0}, {1}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 5, 17, {2}, {1}, {3}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 5, 128, {2}, {0}, {2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 5, 129, {2}, {3}, {4}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 17, 127, {7, 8, 9}, {0, 3, 7}, {3, 4, 0}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {4, 2, 33, 129, {8, 1, 17}, {1, 0, 4}, {1, 3, 5}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 32, 128, {17, 8}, {3, 9}, {0, -3}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 33, 1, {8, 9}, {0, 1}, {2, 3}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 65, 3, {8, 9, 17}, {1, 0, 3}, {4, 1, 5}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {4,
+ 2,
+ 5,
+ 129,
+ {63, 64, 65, 0},
+ {1, 0, 64, 0},
+ {3, 64, 65, 0},
+ ov::element::f32,
+ ov::element::f32,
+ ov::element::i32,
+ "CPU"},
+ {4, 2, 9, 17, {65, 64}, {7, 3}, {0, -1}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ };
+ const auto shapes = cases;
+ cases.clear();
+ for (const auto& precision : {ov::element::f32, ov::element::f16, ov::element::bf16}) {
+ for (auto params : shapes) {
+ std::get<7>(params) = precision;
+ std::get<8>(params) = precision;
+ cases.push_back(params);
+ }
+ }
+ // With snapshots disabled, prefill exercises the no-store state mode and checks the complete unchanged cache.
+ for (const int32_t state : {1, 2, 3, 4, 5, 7, 8, 127, 128, 129, 135, 255, 256, 257, 263, 4095, 4096}) {
+ for (const int32_t rows : {1, 4, 5, 8, 9, 16, 17, 32, 33, 64, 65}) {
+ cases.push_back(
+ {2, 1, rows, state, {3}, {7}, {0}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"});
+ }
+ }
+ return cases;
+}
+} // namespace
+
std::vector<PagedSelectiveSSMLayerParams> paged_selective_ssm_test_cases = {
{4, 2, 5, 3, {3}, {0}, {2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
{4, 2, 5, 3, {3}, {4}, {2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
@@ -16,6 +71,26 @@ std::vector<PagedSelectiveSSMLayerParams> paged_selective_ssm_test_cases = {
{4, 2, 5, 3, {0, 0}, {0, 7}, {2, -3}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
{4, 1, 3, 4, {3, 2}, {5, 9}, {0, -3}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
{3, 3, 1, 1, {4}, {0}, {1}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ // Snapshot boundaries split JIT token batches; include boundaries on either side of the 64-token limit.
+ {4,
+ 2,
+ 5,
+ 129,
+ {63, 64, 65, 0},
+ {1, 0, 64, 0},
+ {3, 64, 65, 0},
+ ov::element::f32,
+ ov::element::f32,
+ ov::element::i32,
+ "CPU"},
+ {4, 2, 9, 17, {129, 65}, {7, 3}, {64, 0}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ // Numerical coverage through the executor: row/vector tails, large states and single-snapshot aliasing.
+ {2, 1, 17, 127, {7, 8, 9}, {0, 3, 7}, {3, 4, 0}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {4, 2, 33, 129, {8, 1, 17}, {1, 0, 4}, {1, 3, 5}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 9, 4095, {8}, {3}, {4}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 9, 4096, {8}, {3}, {4}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 5, 129, {5}, {0}, {16}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
+ {2, 1, 5, 129, {5}, {3}, {16}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
{4, 2, 5, 3, {1}, {0}, {2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
{64, 1, 64, 128, {1}, {0}, {1}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
{96, 8, 80, 80, {5}, {0}, {2}, ov::element::f32, ov::element::f32, ov::element::i32, "CPU"},
@@ -36,4 +111,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_PagedSelectiveSSM,
::testing::ValuesIn(paged_selective_ssm_test_cases),
PagedSelectiveSSMLayerTest::getTestCaseName);
+INSTANTIATE_TEST_SUITE_P(smoke_PagedSelectiveSSMJitNumerical,
+ PagedSelectiveSSMLayerTest,
+ ::testing::ValuesIn(jit_numerical_cases()),
+ PagedSelectiveSSMLayerTest::getTestCaseName);
+
} // namespace ov::test
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/selective_ssm.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/selective_ssm.cpp
index 9dedf6ccb62..2ff3a92d524 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/selective_ssm.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/selective_ssm.cpp
@@ -15,12 +15,15 @@
#include "openvino/core/type/float16.hpp"
#include "openvino/op/selective_ssm.hpp"
#include "openvino/runtime/properties.hpp"
+#include "openvino/runtime/system_conf.hpp"
+#include "utils/ssm_reference.hpp"
namespace {
template <typename T>
std::vector<ov::Tensor> calculate_selective_ssm_refs(const std::map<std::shared_ptr<ov::Node>, ov::Tensor>& inputs,
- const std::shared_ptr<ov::Model>& function) {
+ const std::shared_ptr<ov::Model>& function,
+ bool native_bf16 = true) {
const auto& params = function->get_parameters();
const auto& A_tensor = inputs.at(params[0]);
const auto& dt_tensor = inputs.at(params[1]);
@@ -60,8 +63,7 @@ std::vector<ov::Tensor> calculate_selective_ssm_refs(const std::map<std::shared_
for (size_t head = 0; head < num_heads; ++head) {
const auto token_head = (batch * sequence_length + token) * num_heads + head;
const auto group = head / heads_per_group;
- const auto grouped_projection =
- ((batch * sequence_length + token) * num_groups + group) * state_size;
+ const auto grouped_projection = ((batch * sequence_length + token) * num_groups + group) * state_size;
const float delta = static_cast<float>(dt[token_head]);
decay[token_head] = std::exp(static_cast<float>(A[head]) * delta);
for (size_t state_index = 0; state_index < state_size; ++state_index) {
@@ -80,12 +82,10 @@ std::vector<ov::Tensor> calculate_selective_ssm_refs(const std::map<std::shared_
for (size_t head = 0; head < num_heads; ++head) {
const auto group = head / heads_per_group;
for (size_t position = 0; position < head_dim; ++position) {
- const auto state_base =
- batch * state_batch_stride + head * state_head_stride + position * state_size;
+ const auto state_base = batch * state_batch_stride + head * state_head_stride + position * state_size;
for (size_t token = 0; token < sequence_length; ++token) {
const auto token_head = (batch * sequence_length + token) * num_heads + head;
- const auto projection_base =
- ((batch * sequence_length + token) * num_groups + group) * state_size;
+ const auto projection_base = ((batch * sequence_length + token) * num_groups + group) * state_size;
const auto x_index = token_head * head_dim + position;
const float input = static_cast<float>(x[x_index]);
for (size_t state_index = 0; state_index < state_size; ++state_index) {
@@ -99,7 +99,8 @@ std::vector<ov::Tensor> calculate_selective_ssm_refs(const std::map<std::shared_
reduction += static_cast<double>(state[state_base + state_index]) *
static_cast<float>(C[projection_base + state_index]);
}
- output[x_index] = static_cast<T>(reduction);
+ output[x_index] =
+ ov::test::utils::ssm_reference_cast<T>(static_cast<float>(reduction), native_bf16);
}
}
}
@@ -107,7 +108,7 @@ std::vector<ov::Tensor> calculate_selective_ssm_refs(const std::map<std::shared_
ov::Tensor state_tensor(initial_state_tensor.get_element_type(), state_shape);
std::transform(state.begin(), state.end(), state_tensor.data<T>(), [](float value) {
- return static_cast<T>(value);
+ return ov::test::utils::ssm_reference_cast<T>(value);
});
return {output_tensor, state_tensor};
}
@@ -136,10 +137,13 @@ void SelectiveSSM::generate_inputs(const std::vector<ov::Shape>& targetInputStat
const auto& param = params[i];
const auto& shape = targetInputStaticShapes[i];
if (i == 0) {
+ // Keep long recurrences contractive, so this indexing/batching test does not amplify FP32 rounding
+ // exponentially. Short cases also exercise positive A values.
+ const auto upper_bound = std::get<1>(GetParam()) >= 63 ? 0.0f : 0.2f;
inputs[param] = ov::test::utils::create_and_fill_tensor_real_distribution(param->get_element_type(),
shape,
-0.5f,
- 0.2f,
+ upper_bound,
1);
} else if (i == 1) {
inputs[param] = ov::test::utils::create_and_fill_tensor_real_distribution(param->get_element_type(),
@@ -162,14 +166,22 @@ std::vector<ov::Tensor> SelectiveSSM::calculate_refs() {
return calculate_selective_ssm_refs<ov::float16>(inputs, function);
}
if (precision == ov::element::bf16) {
- return calculate_selective_ssm_refs<ov::bfloat16>(inputs, function);
+ // The portable executor stores BF16 outputs through the scalar constructor; the JIT uses native RNE.
+ const auto native_bf16 =
+ (ov::with_cpu_x86_bfloat16() || ov::with_cpu_x86_avx2_vnni_2()) && std::get<5>(GetParam()) <= 4096;
+ return calculate_selective_ssm_refs<ov::bfloat16>(inputs, function, native_bf16);
}
return calculate_selective_ssm_refs<float>(inputs, function);
}
void SelectiveSSM::compare(const std::vector<ov::Tensor>& expected, const std::vector<ov::Tensor>& actual) {
ASSERT_EQ(expected.size(), actual.size());
- ov::test::utils::compare(expected[0], actual[0], abs_threshold, rel_threshold);
+ // Large dot products allow reduction-order differences; final-state checks keep the original tolerance.
+ const auto large_state = std::get<5>(GetParam()) >= 512;
+ ov::test::utils::compare(expected[0],
+ actual[0],
+ large_state ? std::max(abs_threshold, 1e-5) : abs_threshold,
+ large_state ? std::max(rel_threshold, 1e-4) : rel_threshold);
ov::test::utils::compare(expected[1], actual[1], abs_threshold, rel_threshold);
}
@@ -180,7 +192,15 @@ void SelectiveSSM::SetUp() {
inType = prec;
configuration[ov::hint::inference_precision.name()] = prec;
- abs_threshold = prec == ov::element::f32 ? 1e-6f : 1e-3f;
+ if (prec == ov::element::f32) {
+ // The oracle materializes delta * B before multiplying by x; both the reference executor and JIT
+ // use (delta * x) * B. Long recurrences amplify the different FP32 rounding, especially near zero.
+ abs_threshold = seq_len >= 63 ? 1e-5f : 1e-6f;
+ } else if (prec == ov::element::bf16) {
+ abs_threshold = 1e-2f;
+ } else {
+ abs_threshold = 1e-3f;
+ }
rel_threshold = 1e-5f;
const ov::Shape A_shape{static_cast<size_t>(num_heads)};
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/selective_ssm.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/selective_ssm.cpp
index 4cea2f07c5c..7d44e7cee4c 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/selective_ssm.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/selective_ssm.cpp
@@ -4,8 +4,44 @@
#include "custom/subgraph_tests/include/selective_ssm.hpp"
+#include <algorithm>
+#include <array>
+#include <vector>
+
namespace ov::test {
+namespace {
+std::vector<selective_ssm_params> jit_numerical_cases() {
+ std::vector<selective_ssm_params> cases;
+ const auto append = [&](const selective_ssm_params& params) {
+ if (std::find(cases.begin(), cases.end(), params) == cases.end()) {
+ cases.push_back(params);
+ }
+ };
+ // Exercise grouping, empty inputs and prefill/decode through CPU inference instead of direct kernel calls.
+ const std::vector<std::array<int32_t, 6>> shapes{
+ {0, 3, 2, 1, 3, 5}, {2, 0, 4, 2, 5, 3}, {1, 1, 1, 1, 1, 1}, {1, 1, 2, 1, 5, 17},
+ {2, 2, 4, 4, 3, 5}, {1, 5, 6, 3, 7, 9}, {2, 3, 8, 4, 5, 7}, {1, 4, 3, 1, 9, 2},
+ {1, 2, 2, 1, 5, 16}, {1, 2, 2, 1, 5, 17}, {1, 2, 2, 1, 5, 128}, {1, 2, 2, 1, 5, 129},
+ {1, 7, 2, 1, 17, 127}, {1, 8, 2, 1, 17, 128}, {2, 9, 4, 2, 33, 129}, {1, 17, 2, 1, 32, 128},
+ {1, 8, 2, 1, 33, 1}, {1, 9, 2, 1, 65, 3}, {2, 63, 4, 2, 5, 17}, {1, 64, 4, 2, 9, 128},
+ {2, 65, 4, 2, 5, 129},
+ };
+ for (const auto& precision : {ov::element::f32, ov::element::f16, ov::element::bf16}) {
+ for (const auto& shape : shapes) {
+ append({shape[0], shape[1], shape[2], shape[3], shape[4], shape[5], precision, "CPU"});
+ }
+ }
+ // Dynamic-shape iterations also run three-token prefill for each single-token decode case.
+ for (const int32_t state : {1, 2, 3, 4, 5, 7, 8, 127, 128, 129, 135, 255, 256, 257, 263, 4095, 4096}) {
+ for (const int32_t rows : {1, 4, 5, 8, 9, 16, 17, 32, 33, 64, 65}) {
+ append({1, 1, 2, 1, rows, state, ov::element::f32, "CPU"});
+ }
+ }
+ return cases;
+}
+} // namespace
+
std::vector<selective_ssm_params> selective_ssm_test_cases = {
{1, 1, 1, 1, 1, 1, ov::element::f32, "CPU"},
{1, 0, 2, 1, 3, 4, ov::element::f32, "CPU"},
@@ -13,6 +49,19 @@ std::vector<selective_ssm_params> selective_ssm_test_cases = {
{2, 5, 6, 3, 7, 5, ov::element::f32, "CPU"},
{1, 4, 4, 2, 8, 16, ov::element::f32, "CPU"},
{2, 3, 4, 1, 8, 8, ov::element::f32, "CPU"},
+ // Exercise JIT token-batch boundaries with row/vector tails and grouped projections through CPU inference.
+ {2, 63, 4, 2, 5, 17, ov::element::f32, "CPU"},
+ {1, 64, 4, 2, 9, 128, ov::element::f32, "CPU"},
+ {2, 65, 4, 2, 5, 129, ov::element::f32, "CPU"},
+ {1, 129, 4, 2, 5, 17, ov::element::f32, "CPU"},
+ {1, 7, 2, 1, 17, 127, ov::element::f32, "CPU"},
+ {1, 8, 2, 1, 17, 128, ov::element::f32, "CPU"},
+ {2, 9, 4, 2, 33, 129, ov::element::f32, "CPU"},
+ {1, 17, 2, 1, 32, 128, ov::element::f32, "CPU"},
+ {1, 8, 2, 1, 33, 1, ov::element::f32, "CPU"},
+ {1, 9, 2, 1, 65, 3, ov::element::f32, "CPU"},
+ {1, 8, 2, 1, 9, 4095, ov::element::f32, "CPU"},
+ {1, 8, 2, 1, 9, 4096, ov::element::f32, "CPU"},
{1, 4, 4, 2, 8, 16, ov::element::f16, "CPU"},
{1, 1, 4, 2, 8, 16, ov::element::f16, "CPU"},
{1, 4, 4, 2, 8, 16, ov::element::bf16, "CPU"},
@@ -26,4 +75,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_SelectiveSSM,
::testing::ValuesIn(selective_ssm_test_cases),
SelectiveSSM::getTestCaseName);
+INSTANTIATE_TEST_SUITE_P(smoke_SelectiveSSMJitNumerical,
+ SelectiveSSM,
+ ::testing::ValuesIn(jit_numerical_cases()),
+ SelectiveSSM::getTestCaseName);
+
} // namespace ov::test
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/selective_ssm_jit.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/selective_ssm_jit.cpp
new file mode 100644
index 00000000000..9b528c031be
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/selective_ssm_jit.cpp
@@ -0,0 +1,423 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <gtest/gtest.h>
+
+#include <algorithm>
+#include <array>
+#include <cmath>
+#include <cstddef>
+#include <cstdint>
+#include <limits>
+#include <memory>
+#include <string>
+#include <thread>
+#include <tuple>
+
+#include "openvino/core/any.hpp"
+#include "openvino/core/model.hpp"
+#include "openvino/core/shape.hpp"
+#include "openvino/core/type/bfloat16.hpp"
+#include "openvino/core/type/element_type.hpp"
+#include "openvino/core/type/float16.hpp"
+#include "openvino/op/paged_selective_ssm.hpp"
+#include "openvino/op/parameter.hpp"
+#include "openvino/op/selective_ssm.hpp"
+#include "openvino/runtime/core.hpp"
+#include "openvino/runtime/exec_model_info.hpp"
+#include "openvino/runtime/infer_request.hpp"
+#include "openvino/runtime/properties.hpp"
+#include "openvino/runtime/system_conf.hpp"
+#include "openvino/runtime/tensor.hpp"
+#include "utils/precision_support.h"
+
+namespace ov::test {
+namespace {
+
+using SelectiveSSMJitParams = std::tuple<bool, ov::element::Type>;
+
+std::shared_ptr<ov::Model> make_selective_ssm_model(const ov::element::Type& precision,
+ bool paged,
+ size_t state_size = 16,
+ size_t tokens = 1) {
+ const auto A = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{4});
+ const auto state =
+ std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{paged ? size_t{2} : size_t{1}, 4, 5, state_size});
+
+ ov::ParameterVector parameters;
+ std::shared_ptr<ov::Node> operation;
+ if (paged) {
+ const auto dt = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{tokens, 4});
+ const auto B = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{tokens, 2, state_size});
+ const auto x = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{tokens, 4, 5});
+ const auto C = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{tokens, 2, state_size});
+ const auto subsequences = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{2});
+ const auto blocks = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{2});
+ const auto block_begins = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{2});
+ const auto processed = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{1});
+ const auto intervals = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{1});
+ parameters = {A, dt, B, x, C, state, subsequences, blocks, block_begins, processed, intervals};
+ operation = std::make_shared<ov::op::internal::PagedSelectiveSSM>(parameters[0],
+ parameters[1],
+ parameters[2],
+ parameters[3],
+ parameters[4],
+ parameters[5],
+ parameters[6],
+ parameters[7],
+ parameters[8],
+ parameters[9],
+ parameters[10]);
+ } else {
+ const auto dt = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{1, tokens, 4});
+ const auto B = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{1, tokens, 2, state_size});
+ const auto x = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{1, tokens, 4, 5});
+ const auto C = std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{1, tokens, 2, state_size});
+ parameters = {A, dt, B, x, C, state};
+ operation = std::make_shared<ov::op::internal::SelectiveSSM>(parameters[0],
+ parameters[1],
+ parameters[2],
+ parameters[3],
+ parameters[4],
+ parameters[5]);
+ }
+
+ operation->set_friendly_name("ssm");
+ return std::make_shared<ov::Model>(operation->outputs(), parameters);
+}
+
+class SelectiveSSMJitIntegrationTest : public testing::TestWithParam<SelectiveSSMJitParams> {};
+
+template <typename T>
+void fill_tensor(ov::Tensor& tensor, float value) {
+ std::fill_n(tensor.data<T>(), tensor.get_size(), static_cast<T>(value));
+}
+
+void fill_data_tensor(ov::Tensor& tensor, float value) {
+ if (tensor.get_element_type() == ov::element::f32) {
+ fill_tensor<float>(tensor, value);
+ } else if (tensor.get_element_type() == ov::element::f16) {
+ fill_tensor<ov::float16>(tensor, value);
+ } else {
+ fill_tensor<ov::bfloat16>(tensor, value);
+ }
+}
+
+float tensor_value(const ov::Tensor& tensor, size_t index) {
+ if (tensor.get_element_type() == ov::element::f32) {
+ return tensor.data<const float>()[index];
+ }
+ if (tensor.get_element_type() == ov::element::f16) {
+ return static_cast<float>(tensor.data<const ov::float16>()[index]);
+ }
+ return static_cast<float>(tensor.data<const ov::bfloat16>()[index]);
+}
+
+void fill_inputs(ov::InferRequest& request, bool paged, const std::array<float, 6>& values) {
+ for (size_t i = 0; i < values.size(); ++i) {
+ auto tensor = request.get_input_tensor(i);
+ fill_data_tensor(tensor, values[i]);
+ }
+ if (paged) {
+ const auto tokens = static_cast<int32_t>(request.get_input_tensor(3).get_shape()[0]);
+ const int32_t metadata[][2] = {{0, tokens}, {0, 1}, {0, 2}, {0, 0}, {tokens, 0}};
+ for (size_t i = 0; i < 5; ++i) {
+ auto tensor = request.get_input_tensor(6 + i);
+ std::copy_n(metadata[i], tensor.get_size(), tensor.data<int32_t>());
+ }
+ }
+}
+
+void expect_selected_executor(const ov::CompiledModel& compiled_model,
+ bool paged,
+ const ov::element::Type& precision,
+ bool jit_state_size = true) {
+ const auto runtime_model = compiled_model.get_runtime_model();
+
+ const auto expected_layer = paged ? std::string{"PagedSelectiveSSM"} : std::string{"SelectiveSSM"};
+ const bool native_precision = precision == ov::element::f32 ? ov::with_cpu_x86_avx2()
+ : precision == ov::element::f16
+ ? ov::with_cpu_x86_avx512_core_fp16() || ov::with_cpu_x86_avx2_vnni_2()
+ : ov::with_cpu_x86_bfloat16() || ov::with_cpu_x86_avx2_vnni_2();
+ const bool native = native_precision && jit_state_size;
+ const auto expected_implementation =
+ std::string{ov::with_cpu_x86_avx512_core() ? "jit_avx512_" : "jit_avx2_"} + precision.get_type_name();
+ size_t matching_nodes = 0;
+ for (const auto& node : runtime_model->get_ops()) {
+ const auto& rt_info = node->get_rt_info();
+ const auto layer = rt_info.find(ov::exec_model_info::LAYER_TYPE);
+ if (layer == rt_info.end() || layer->second.as<std::string>() != expected_layer) {
+ continue;
+ }
+
+ ++matching_nodes;
+ const auto implementation = rt_info.find(ov::exec_model_info::IMPL_TYPE);
+ ASSERT_NE(implementation, rt_info.end());
+ const auto actual_implementation = implementation->second.as<std::string>();
+ if (native) {
+ EXPECT_EQ(actual_implementation, expected_implementation);
+ } else {
+ EXPECT_EQ(actual_implementation.find("ref"), 0U) << actual_implementation;
+ }
+ EXPECT_EQ(node->get_output_element_type(0), precision);
+ }
+ EXPECT_EQ(matching_nodes, 1U);
+}
+
+TEST_P(SelectiveSSMJitIntegrationTest, InfersWithSelectedExecutorAndPreservedDataPrecision) {
+ const auto& [paged, precision] = GetParam();
+ if (!ov::intel_cpu::hasHardwareSupport(precision)) {
+ GTEST_SKIP() << "CPU precision policy does not preserve " << precision << " on this system";
+ }
+
+ ov::Core core;
+ const ov::AnyMap properties{{ov::hint::inference_precision.name(), precision}};
+ auto compiled_model = core.compile_model(make_selective_ssm_model(precision, paged), "CPU", properties);
+ expect_selected_executor(compiled_model, paged, precision);
+
+ auto request = compiled_model.create_infer_request();
+ // Exactly representable values give an independent oracle for both executors and all data precisions:
+ // decay=exp(0)=1; state=0.5 + (0.5 * 2) * 0.25=0.75; output=16 * 0.75 * 0.125=1.5.
+ fill_inputs(request, paged, {0.F, 0.5F, 0.25F, 2.F, 0.125F, 0.5F});
+ request.infer();
+ const auto output = request.get_output_tensor(0);
+ EXPECT_EQ(output.get_element_type(), precision);
+ for (size_t i = 0; i < output.get_size(); ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(output, i), 1.5F) << "output index " << i;
+ }
+ if (paged) {
+ const auto cache = request.get_input_tensor(5);
+ const auto block_size = cache.get_size() / 2;
+ for (size_t i = 0; i < block_size; ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(cache, i), 0.5F) << "read block index " << i;
+ EXPECT_FLOAT_EQ(tensor_value(cache, block_size + i), 0.75F) << "snapshot index " << i;
+ }
+ } else {
+ const auto state = request.get_output_tensor(1);
+ EXPECT_EQ(state.get_element_type(), precision);
+ for (size_t i = 0; i < state.get_size(); ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(state, i), 0.75F) << "state index " << i;
+ }
+ }
+}
+
+TEST_P(SelectiveSSMJitIntegrationTest, StateSizeLimitSelectsJitOrReferenceWithCorrectRecurrence) {
+ const auto& [paged, precision] = GetParam();
+ if (!ov::intel_cpu::hasHardwareSupport(precision)) {
+ GTEST_SKIP() << "CPU precision policy does not preserve " << precision << " on this system";
+ }
+
+ ov::Core core;
+ const auto round_output = [&](float value) {
+ if (precision == ov::element::f16) {
+ return static_cast<float>(ov::float16(value));
+ }
+ if (precision == ov::element::bf16) {
+ return static_cast<float>(ov::bfloat16(value));
+ }
+ return value;
+ };
+ // Check the advertised maximum and the reference fallback beyond it through both decode and prefill.
+ for (const size_t state_size : {4096U, 4097U}) {
+ for (const size_t tokens : {1U, 3U}) {
+ SCOPED_TRACE(testing::Message() << "state_size=" << state_size << " tokens=" << tokens);
+ auto compiled = core.compile_model(make_selective_ssm_model(precision, paged, state_size, tokens),
+ "CPU",
+ ov::hint::inference_precision(precision));
+ expect_selected_executor(compiled, paged, precision, state_size == 4096);
+ auto request = compiled.create_infer_request();
+ fill_inputs(request, paged, {0.F, 0.5F, 0.25F, 2.F, 0.125F, 0.5F});
+ request.infer();
+ const auto output = request.get_output_tensor(0);
+ ASSERT_EQ(output.get_size(), tokens * 20);
+ for (size_t i = 0; i < output.get_size(); ++i) {
+ const auto state_value = 0.75F + 0.25F * static_cast<float>(i / 20);
+ EXPECT_FLOAT_EQ(tensor_value(output, i), round_output(state_value * 0.125F * state_size))
+ << "output index " << i;
+ }
+ const auto state = paged ? request.get_input_tensor(5) : request.get_output_tensor(1);
+ const auto block_size = paged ? state.get_size() / 2 : state.get_size();
+ const auto final_value = 0.5F + 0.25F * static_cast<float>(tokens);
+ for (size_t i = 0; i < block_size; ++i) {
+ if (paged) {
+ EXPECT_FLOAT_EQ(tensor_value(state, i), 0.5F) << "read block index " << i;
+ }
+ EXPECT_FLOAT_EQ(tensor_value(state, paged ? block_size + i : i), final_value)
+ << "final state index " << i;
+ }
+ }
+ }
+}
+
+TEST_P(SelectiveSSMJitIntegrationTest, SerialRecurrenceWorksOnFreshThread) {
+ const auto& [paged, precision] = GetParam();
+ if (!ov::intel_cpu::hasHardwareSupport(precision)) {
+ GTEST_SKIP() << "CPU precision policy does not preserve " << precision << " on this system";
+ }
+
+ ov::Core core;
+ // With no streams or parallel workers, inference runs on the calling thread outside a TBB arena.
+ auto compiled = core.compile_model(make_selective_ssm_model(precision, paged, 16, 3),
+ "CPU",
+ ov::hint::inference_precision(precision),
+ ov::num_streams(0),
+ ov::inference_num_threads(1));
+ std::thread worker([&] {
+ EXPECT_NO_THROW({
+ for (const bool alias_state : {false, true}) {
+ if (paged && alias_state) {
+ continue;
+ }
+ SCOPED_TRACE(testing::Message() << "alias_state=" << alias_state);
+ auto request = compiled.create_infer_request();
+ fill_inputs(request, paged, {0.F, 0.5F, 0.25F, 2.F, 0.125F, 0.5F});
+ if (alias_state) {
+ request.set_output_tensor(1, request.get_input_tensor(5));
+ }
+ request.infer();
+ const auto output = request.get_output_tensor(0);
+ // Each token adds 0.25 to state; all 20 head/row positions have the same exact output.
+ for (size_t i = 0; i < output.get_size(); ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(output, i), 1.5F + 0.5F * static_cast<float>(i / 20));
+ }
+ const auto state = paged ? request.get_input_tensor(5) : request.get_output_tensor(1);
+ const auto state_size = paged ? state.get_size() / 2 : state.get_size();
+ for (size_t i = 0; i < state_size; ++i) {
+ if (paged) {
+ EXPECT_FLOAT_EQ(tensor_value(state, i), 0.5F) << "read block index " << i;
+ }
+ EXPECT_FLOAT_EQ(tensor_value(state, paged ? state_size + i : i), 1.25F)
+ << "final state index " << i;
+ }
+ }
+ });
+ });
+ worker.join();
+}
+
+TEST(PagedSelectiveSSMJitIntegrationTest, HandlesInt32CacheIntervalExtremes) {
+ ov::Core core;
+ for (const bool store_snapshot : {false, true}) {
+ SCOPED_TRACE(testing::Message() << "store_snapshot=" << store_snapshot);
+ const size_t tokens = store_snapshot ? 1 : 2;
+ auto compiled = core.compile_model(make_selective_ssm_model(ov::element::f32, true, 5, tokens),
+ "CPU",
+ ov::hint::inference_precision(ov::element::f32));
+ auto request = compiled.create_infer_request();
+ fill_inputs(request, true, {0.F, 0.5F, 0.25F, 2.F, 0.125F, 0.5F});
+ request.get_input_tensor(9).data<int32_t>()[0] = std::numeric_limits<int32_t>::max();
+ request.get_input_tensor(10).data<int32_t>()[0] =
+ store_snapshot ? std::numeric_limits<int32_t>::max() : std::numeric_limits<int32_t>::min();
+ request.infer();
+ const auto output = request.get_output_tensor(0);
+ for (size_t i = 0; i < output.get_size(); ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(output, i), 5.F * 0.125F * (0.75F + 0.25F * static_cast<float>(i / 20)));
+ }
+ const auto cache = request.get_input_tensor(5);
+ const auto block_size = cache.get_size() / 2;
+ for (size_t i = 0; i < block_size; ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(cache, i), 0.5F) << "read block index " << i;
+ EXPECT_FLOAT_EQ(tensor_value(cache, block_size + i), store_snapshot ? 0.75F : 0.5F)
+ << "snapshot index " << i;
+ }
+ }
+}
+
+TEST(PagedSelectiveSSMJitIntegrationTest, DisabledCacheAllowsSharedReadBlocks) {
+ auto model = make_selective_ssm_model(ov::element::f32, true, 5, 3);
+ const auto& params = model->get_parameters();
+ params[6]->set_partial_shape(ov::Shape{3});
+ params[8]->set_partial_shape(ov::Shape{3});
+ params[9]->set_partial_shape(ov::Shape{2});
+ params[10]->set_partial_shape(ov::Shape{2});
+ model->validate_nodes_and_infer_types();
+ ov::Core core;
+ auto compiled = core.compile_model(model, "CPU", ov::hint::inference_precision(ov::element::f32));
+ auto request = compiled.create_infer_request();
+ for (size_t i = 0; i < 6; ++i) {
+ auto tensor = request.get_input_tensor(i);
+ const std::array<float, 6> values{0.F, 0.5F, 0.25F, 2.F, 0.125F, 0.5F};
+ fill_data_tensor(tensor, values[i]);
+ }
+ const int32_t metadata[][3] = {{0, 1, 3}, {0, 0}, {0, 1, 2}, {7, 9}, {0, -3}};
+ for (size_t i = 0; i < 5; ++i) {
+ auto tensor = request.get_input_tensor(6 + i);
+ std::copy_n(metadata[i], tensor.get_size(), tensor.data<int32_t>());
+ }
+ request.infer();
+ const auto output = request.get_output_tensor(0);
+ for (size_t i = 0; i < output.get_size(); ++i) {
+ const auto state_value = i / 20 == 2 ? 1.F : 0.75F;
+ EXPECT_FLOAT_EQ(tensor_value(output, i), 5.F * 0.125F * state_value) << "output index " << i;
+ }
+ const auto cache = request.get_input_tensor(5);
+ for (size_t i = 0; i < cache.get_size(); ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(cache, i), 0.5F) << "unchanged cache index " << i;
+ }
+}
+
+TEST(PagedSelectiveSSMJitIntegrationTest, EmptySubsequenceListPreservesCache) {
+ auto model = make_selective_ssm_model(ov::element::f32, true, 5, 0);
+ const auto& params = model->get_parameters();
+ params[6]->set_partial_shape(ov::Shape{1});
+ params[7]->set_partial_shape(ov::Shape{0});
+ params[8]->set_partial_shape(ov::Shape{1});
+ params[9]->set_partial_shape(ov::Shape{0});
+ params[10]->set_partial_shape(ov::Shape{0});
+ model->validate_nodes_and_infer_types();
+ ov::Core core;
+ auto compiled = core.compile_model(model, "CPU", ov::hint::inference_precision(ov::element::f32));
+ auto request = compiled.create_infer_request();
+ fill_inputs(request, true, {0.F, 0.5F, 0.25F, 2.F, 0.125F, 0.5F});
+ request.infer();
+ EXPECT_EQ(request.get_output_tensor(0).get_size(), 0U);
+ const auto cache = request.get_input_tensor(5);
+ for (size_t i = 0; i < cache.get_size(); ++i) {
+ EXPECT_FLOAT_EQ(tensor_value(cache, i), 0.5F) << "unchanged cache index " << i;
+ }
+}
+
+TEST(SelectiveSSMJitTailTest, InactiveLanesDoNotTurnInfiniteOutputIntoNaN) {
+ if (!ov::with_cpu_x86_avx2()) {
+ GTEST_SKIP() << "Requires the SelectiveSSM JIT executor";
+ }
+ ov::Core core;
+ const std::array<std::array<float, 6>, 2> cases{{
+ {100.F, 1.F, 0.F, 0.F, 1.F, 1.F}, // exp(A * delta) overflows; inactive state lanes contain 0 * Inf.
+ {0.F, 1.F, 1.F, std::numeric_limits<float>::infinity(), 1.F, 1.F}, // Inactive B lanes contain 0 * Inf.
+ }};
+ for (const bool paged : {false, true}) {
+ for (const size_t state_size : {1U, 3U, 9U, 17U}) {
+ auto compiled = core.compile_model(make_selective_ssm_model(ov::element::f32, paged, state_size),
+ "CPU",
+ ov::hint::inference_precision(ov::element::f32));
+ for (const auto& values : cases) {
+ SCOPED_TRACE(testing::Message()
+ << "paged=" << paged << " state_size=" << state_size << " A=" << values[0]);
+ auto request = compiled.create_infer_request();
+ fill_inputs(request, paged, values);
+ request.infer();
+ const auto output = request.get_output_tensor(0);
+ for (size_t i = 0; i < output.get_size(); ++i) {
+ const auto value = tensor_value(output, i);
+ EXPECT_TRUE(std::isinf(value) && value > 0.F) << "output index " << i << ": " << value;
+ }
+ }
+ }
+ }
+}
+
+std::string selective_ssm_jit_test_name(const testing::TestParamInfo<SelectiveSSMJitParams>& info) {
+ const auto& [paged, precision] = info.param;
+ return std::string{paged ? "Paged" : "Selective"} + "_" + precision.get_type_name();
+}
+
+INSTANTIATE_TEST_SUITE_P(smoke_SelectiveSSMJit,
+ SelectiveSSMJitIntegrationTest,
+ testing::Combine(testing::Bool(),
+ testing::Values(ov::element::f32, ov::element::f16, ov::element::bf16)),
+ selective_ssm_jit_test_name);
+
+} // namespace
+} // namespace ov::test
diff --git a/src/plugins/intel_cpu/tests/functional/sources.cmake b/src/plugins/intel_cpu/tests/functional/sources.cmake
index b9ba7bc47a1..fd0a21b15ce 100644
--- a/src/plugins/intel_cpu/tests/functional/sources.cmake
+++ b/src/plugins/intel_cpu/tests/functional/sources.cmake
@@ -276,6 +276,7 @@ set(CPU_FUNC_TESTS_CUSTOM_SRCS
)
set(CPU_FUNC_TESTS_X64_SRCS
+ ${CMAKE_CURRENT_LIST_DIR}/custom/subgraph_tests/src/x64/selective_ssm_jit.cpp
${CMAKE_CURRENT_LIST_DIR}/custom/single_layer_tests/instances/x64/activation.cpp
${CMAKE_CURRENT_LIST_DIR}/custom/single_layer_tests/instances/x64/col2im.cpp
${CMAKE_CURRENT_LIST_DIR}/custom/single_layer_tests/instances/x64/conversion.cpp
@@ -644,6 +645,7 @@ set(CPU_FUNC_TESTS_SRCS
${CMAKE_CURRENT_LIST_DIR}/utils/convolution_params.hpp
${CMAKE_CURRENT_LIST_DIR}/utils/cpu_test_utils.cpp
${CMAKE_CURRENT_LIST_DIR}/utils/cpu_test_utils.hpp
+ ${CMAKE_CURRENT_LIST_DIR}/utils/ssm_reference.hpp
${CMAKE_CURRENT_LIST_DIR}/utils/filter_cpu_info.hpp
${CMAKE_CURRENT_LIST_DIR}/utils/fusing_test_utils.cpp
${CMAKE_CURRENT_LIST_DIR}/utils/fusing_test_utils.hpp
diff --git a/src/plugins/intel_cpu/tests/functional/utils/ssm_reference.hpp b/src/plugins/intel_cpu/tests/functional/utils/ssm_reference.hpp
new file mode 100644
index 00000000000..6e0ce1b8f09
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/utils/ssm_reference.hpp
@@ -0,0 +1,34 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <cstdint>
+#include <cstring>
+
+#include "openvino/core/type/bfloat16.hpp"
+
+namespace ov::test::utils {
+
+template <typename T>
+T ssm_reference_cast(float value, bool native_bf16 = true) {
+ return static_cast<T>(value);
+}
+
+template <>
+inline ov::bfloat16 ssm_reference_cast<ov::bfloat16>(float value, bool native_bf16) {
+ if (!native_bf16) {
+ return static_cast<ov::bfloat16>(value);
+ }
+ // Match native BF16 round-to-nearest-even without relying on the scalar constructor's rounding mode.
+ uint32_t bits;
+ std::memcpy(&bits, &value, sizeof(bits));
+ if ((bits & 0x7fffffffU) > 0x7f800000U) {
+ return ov::bfloat16::from_bits(static_cast<uint16_t>((bits >> 16) | 0x0040U));
+ }
+ bits += 0x7fffU + ((bits >> 16) & 1U);
+ return ov::bfloat16::from_bits(static_cast<uint16_t>(bits >> 16));
+}
+
+} // namespace ov::test::utils
diff --git a/src/plugins/intel_cpu/tests/unit/nodes/kernels/x64/selective_ssm_jit_kernel_test.cpp b/src/plugins/intel_cpu/tests/unit/nodes/kernels/x64/selective_ssm_jit_kernel_test.cpp
new file mode 100644
index 00000000000..aebb1fa2dc5
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/unit/nodes/kernels/x64/selective_ssm_jit_kernel_test.cpp
@@ -0,0 +1,148 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "nodes/kernels/x64/selective_ssm_jit_kernel.hpp"
+
+#include <gtest/gtest.h>
+
+#include <algorithm>
+#include <array>
+#include <cpu/x64/cpu_isa_traits.hpp>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <vector>
+
+#include "nodes/kernels/x64/selective_ssm_jit_runtime.hpp"
+
+namespace ov::intel_cpu::node::kernel::test {
+namespace {
+
+class SelectiveSSMJitKernel : public testing::Test {
+protected:
+ void SetUp() override {
+ using namespace dnnl::impl::cpu::x64;
+ if (!mayiuse(avx2)) {
+ GTEST_SKIP() << "SelectiveSSM JIT requires AVX2 or AVX-512.";
+ }
+ }
+};
+
+using PagedSelectiveSSMJitKernel = SelectiveSSMJitKernel;
+using ov::intel_cpu::kernel::is_selective_ssm_jit_precision_supported;
+
+template <dnnl::impl::cpu::x64::cpu_isa_t isa>
+void verify_bounded_generated_code_size() {
+ using ov::intel_cpu::kernel::jit_selective_ssm_kernel;
+ using ov::intel_cpu::kernel::jit_selective_ssm_state_mode;
+ for (const auto& precision : {element::f32, element::f16, element::bf16}) {
+ if (!is_selective_ssm_jit_precision_supported(precision)) {
+ continue;
+ }
+ for (const auto mode : {jit_selective_ssm_state_mode::in_place,
+ jit_selective_ssm_state_mode::separate,
+ jit_selective_ssm_state_mode::no_store}) {
+ const auto state_precision = mode == jit_selective_ssm_state_mode::in_place ? element::f32 : precision;
+ SCOPED_TRACE(testing::Message()
+ << "isa=" << isa << ", precision=" << precision << ", mode=" << static_cast<int>(mode));
+ jit_selective_ssm_kernel<isa> medium({precision, state_precision, 512, mode});
+ jit_selective_ssm_kernel<isa> large({precision, state_precision, 4096, mode});
+ ASSERT_NO_THROW(medium.create_kernel());
+ ASSERT_NO_THROW(large.create_kernel());
+ // EVEX disp8 can become disp32 for larger row strides. Allow bounded encoding/alignment growth,
+ // not code growth proportional to the 8x increase in state size.
+ constexpr size_t max_encoding_growth = isa == dnnl::impl::cpu::x64::avx2 ? 128U : 512U;
+ EXPECT_LE(large.getSize(), medium.getSize() + max_encoding_growth);
+ }
+ }
+}
+
+TEST_F(SelectiveSSMJitKernel, RuntimeVectorLoopBoundsGeneratedCodeSize) {
+ // Match the factory dispatch: shared conversion emitters also use the active host ISA.
+ using namespace dnnl::impl::cpu::x64;
+ if (mayiuse(avx512_core)) {
+ verify_bounded_generated_code_size<avx512_core>();
+ } else {
+ verify_bounded_generated_code_size<avx2>();
+ }
+}
+
+TEST_F(PagedSelectiveSSMJitKernel, SingleSnapshotWorkspaceCoversAliasedAndSeparateCache) {
+ constexpr size_t state_elements = 5 * 17;
+ // Functional inference covers outputs and snapshots. This seam additionally verifies scratch selection
+ // for both policies on the same ISA, which cannot be observed through the public inference API.
+ const auto cpu_parallel = std::make_shared<CpuParallel>(TbbPartitioner::STATIC);
+ const auto kernel = ov::intel_cpu::kernel::create_selective_ssm_jit_kernel(element::f32, 17);
+ ASSERT_NE(kernel, nullptr);
+ const auto make_values = [](size_t count, float scale) {
+ std::vector<float> values(count);
+ for (size_t i = 0; i < count; ++i) {
+ values[i] = scale * static_cast<float>(static_cast<int>(i % 11) - 5);
+ }
+ return values;
+ };
+ const float A = -0.2F;
+ const std::vector<float> dt(3, 0.1F);
+ const auto B = make_values(3 * 17, 0.007F);
+ const auto C = make_values(3 * 17, 0.009F);
+ const auto x = make_values(3 * 5, 0.01F);
+ const std::array<int32_t, 2> subsequences{0, 3};
+ const std::array<int32_t, 2> block_begins{0, 2};
+ const int32_t processed = 2;
+ const int32_t interval = 8;
+ const auto initial_cache = make_values(3 * state_elements, 0.01F);
+ for (const bool alias_read : {false, true}) {
+ SCOPED_TRACE(testing::Message() << "alias_read=" << alias_read);
+ const std::array<int32_t, 2> blocks{0, alias_read ? 0 : 1};
+ std::vector<float> baseline_cache;
+ std::vector<float> baseline_output;
+ for (const bool reuse_state_cache : {false, true}) {
+ auto cache = initial_cache;
+ std::vector<float> output(x.size());
+ std::vector<float> scratch(static_cast<size_t>(cpu_parallel->get_num_worker_threads()) * state_elements,
+ 17.F);
+ ov::intel_cpu::kernel::PagedSelectiveSSMJitRuntimeArgs args;
+ args.state_decay_rates = &A;
+ args.time_steps = dt.data();
+ args.input_projections = B.data();
+ args.output_projections = C.data();
+ args.input = x.data();
+ args.state_cache = cache.data();
+ args.subsequence_begins = subsequences.data();
+ args.block_indices = blocks.data();
+ args.block_indices_begins = block_begins.data();
+ args.num_processed_tokens = &processed;
+ args.cache_intervals = &interval;
+ args.output = output.data();
+ args.shape = {3, 1, 5, 1, 17, 3, 2, 1};
+ args.data_precision = element::f32;
+ args.index_precision = element::i32;
+ args.state_scratch = scratch.data();
+ args.head_dim_tile = 5;
+ args.cpu_parallel = cpu_parallel;
+ args.fp32_state_kernel = kernel.get();
+ args.reuse_state_cache = reuse_state_cache;
+ ov::intel_cpu::kernel::paged_selective_ssm_jit(args);
+ const bool untouched_scratch = std::all_of(scratch.begin(), scratch.end(), [](float value) {
+ return value == 17.F;
+ });
+ EXPECT_EQ(untouched_scratch, reuse_state_cache);
+ for (size_t i = 0; i < cache.size(); ++i) {
+ if (i / state_elements != static_cast<size_t>(blocks[1])) {
+ EXPECT_EQ(cache[i], initial_cache[i]) << "unchanged cache index=" << i;
+ }
+ }
+ if (!reuse_state_cache) {
+ baseline_cache = cache;
+ baseline_output = output;
+ } else {
+ EXPECT_EQ(cache, baseline_cache);
+ EXPECT_EQ(output, baseline_output);
+ }
+ }
+ }
+}
+
+} // namespace
+} // namespace ov::intel_cpu::node::kernel::test
diff --git a/src/plugins/intel_cpu/tests/unit/sources.cmake b/src/plugins/intel_cpu/tests/unit/sources.cmake
index 2acf1bbb5bc..440c246bcbe 100644
--- a/src/plugins/intel_cpu/tests/unit/sources.cmake
+++ b/src/plugins/intel_cpu/tests/unit/sources.cmake
@@ -185,6 +185,7 @@ set(CPU_UNIT_TESTS_X64_SRCS
${CMAKE_CURRENT_LIST_DIR}/softmax_kernel_test.cpp
${CMAKE_CURRENT_LIST_DIR}/xattention_test.cpp
${CMAKE_CURRENT_LIST_DIR}/nodes/eltwise_node_test.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/nodes/kernels/x64/selective_ssm_jit_kernel_test.cpp
${CMAKE_CURRENT_LIST_DIR}/snippets_transformations/x64/brgemm_supported_precisions.cpp
${CMAKE_CURRENT_LIST_DIR}/snippets_transformations/x64/fake_quantize_tokenization_test.cpp
${CMAKE_CURRENT_LIST_DIR}/snippets_transformations/x64/fuse_brgemm_cpu_postops.cpp