diff --git a/src/common/snippets/include/snippets/mha_parallel_wa_optimizer.hpp b/src/common/snippets/include/snippets/mha_parallel_wa_optimizer.hpp index 97d0cfce709095..e19cfc095de0aa 100644 --- a/src/common/snippets/include/snippets/mha_parallel_wa_optimizer.hpp +++ b/src/common/snippets/include/snippets/mha_parallel_wa_optimizer.hpp @@ -12,7 +12,15 @@ namespace ov { namespace snippets { namespace lowered { namespace pass { - +/** + * @class MHAParallelWAOptimizer + * @brief Optimizes the dynamic MHA execution increasing parallel work amount dy dividing Brgemm's "M" dimension to "parallel_m" + * and "kernel_m". Uses heuristics from snippets::pass::SplitDimensionM for dimension splitting. + * The optimizer performs the following steps: + * - Identifies applicable Brgemm operations within the LinearIR. + * - Finds parameters whose shapes and layouts need to be adjusted after the split. + * - Determines loops that should be adjusted. + */ class MHAParallelWAOptimizer : public lowered::pass::RuntimeOptimizer { public: MHAParallelWAOptimizer() = default; diff --git a/src/common/snippets/include/snippets/runtime_configurator.hpp b/src/common/snippets/include/snippets/runtime_configurator.hpp index 0550be144d41ca..058caade7a54fd 100644 --- a/src/common/snippets/include/snippets/runtime_configurator.hpp +++ b/src/common/snippets/include/snippets/runtime_configurator.hpp @@ -65,22 +65,6 @@ class RuntimeConfigurator { RuntimeConfigurator(std::shared_ptr c); virtual ~RuntimeConfigurator() = default; - // Note that get_type_info_static and get_type_info are needed to mimic OPENVINO_RTTI interface, - // so the standard OPENVINO_RTTI(...) macros could be used in derived classes. - _OPENVINO_HIDDEN_METHOD static const ::ov::DiscreteTypeInfo& get_type_info_static() { - static ::ov::DiscreteTypeInfo type_info_static {"RuntimeConfigurator"}; - type_info_static.hash(); - return type_info_static; - } - - virtual const DiscreteTypeInfo& get_type_info() const { - return get_type_info_static(); - } - - const char* get_type_name() const { - return get_type_info().name; - } - /** * @brief Update RuntimeConfig based on new state of LinearIR and return its * @param linear_ir LinearIR @@ -111,6 +95,18 @@ class RuntimeConfigurator { const std::vector& get_io_data_sizes() const { return m_io_data_sizes; } const std::map>& get_dynamic_buffer_clusters() const { return m_dynamic_buffer_clusters; } + /** + * @brief Computes the offsets for each dimension of a tensor shape. + * + * This function calculates the offsets for each dimension of a tensor shape, which represent the distance between + * consecutive elements of the corresponding dimension. If a dimension size is 1, the next dimension starts + * immediately, and the stride is 0. + * @param shape The shape of the tensor. + * @param offsets The offsets which should be updated. + * @param offsets_size Requested offsets size vector. + * @param dim_step The initial step size for the dimensions. + * @param idx_stride Defines the number of dimensions that should be skipped in the offsets vector. + */ static void compute_offsets(const ov::snippets::VectorDims& shape, ov::snippets::VectorDims& offsets, size_t offsets_size, @@ -122,6 +118,11 @@ class RuntimeConfigurator { std::vector ptr_increments; std::vector finalization_offsets; }; + /** + * @brief Retrieves the runtime parameters for a given UnifiedLoopInfo. + * @param unified_loop_info The UnifiedLoopInfo for which the runtime parameters are to be retrieved. + * @return A LoopInfoRuntimeParams object containing the runtime parameters. + */ static UnifiedLoopInfoRtParams get_loop_runtime_params(const lowered::UnifiedLoopInfoPtr& unified_loop_info); using LoopInfoRuntimeParamsMap = std::unordered_map; /** @@ -129,6 +130,11 @@ class RuntimeConfigurator { * @param linear_ir LinearIR */ static void update_loop_info(const lowered::LinearIRCPtr& linear_ir); + /** + * @brief Updates the ExpandedLoopInfo based on the initialized runtime parameters. + * @param expanded_loop_info The ExpandedLoopInfo to be updated. + * @param initialized_info_map A map containing the initialized runtime parameters for UnifiedLoopInfo. + */ static void update_expanded_loop_info(const lowered::ExpandedLoopInfoPtr& expanded_loop_info, LoopInfoRuntimeParamsMap& initializated_info_map); /** diff --git a/src/common/snippets/include/snippets/runtime_optimizer.hpp b/src/common/snippets/include/snippets/runtime_optimizer.hpp index 1b52d89d7e8a07..99522628e23c07 100644 --- a/src/common/snippets/include/snippets/runtime_optimizer.hpp +++ b/src/common/snippets/include/snippets/runtime_optimizer.hpp @@ -12,6 +12,11 @@ namespace ov { namespace snippets { namespace lowered { namespace pass { +/** + * @class RuntimeOptimizer + * @brief Base class for runtime optimizers that operate on LinearIR and RuntimeConfigurator during + * RuntimeConfigurator::update stage. + */ class RuntimeOptimizer : public ConstPass { public: RuntimeOptimizer() = default; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/brgemm_copy_b_loop_ports_adjuster.hpp b/src/plugins/intel_cpu/src/emitters/snippets/brgemm_copy_b_loop_ports_adjuster.hpp index c0264b43278a72..108d02c9e46b5e 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/brgemm_copy_b_loop_ports_adjuster.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/brgemm_copy_b_loop_ports_adjuster.hpp @@ -12,6 +12,10 @@ namespace ov { namespace intel_cpu { +/** + * @class BrgemmCopyBLoopPortsAdjuster + * @brief A runtime optimizer that adjusts blocked loops parameters for Brgemm operations which require repacking. + */ class BrgemmCopyBLoopPortsAdjuster : public ov::snippets::lowered::pass::RuntimeOptimizer { public: BrgemmCopyBLoopPortsAdjuster() = default; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/cpu_runtime_configurator.hpp b/src/plugins/intel_cpu/src/emitters/snippets/cpu_runtime_configurator.hpp index a59489b8cc6fc1..d067316cc78a87 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/cpu_runtime_configurator.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/cpu_runtime_configurator.hpp @@ -27,7 +27,6 @@ class CPURuntimeConfig : public ov::snippets::RuntimeConfig { class CPURuntimeConfigurator : public ov::snippets::RuntimeConfigurator { public: - OPENVINO_RTTI("CPURuntimeConfigurator", "0", ov::snippets::RuntimeConfigurator) CPURuntimeConfigurator(); /** diff --git a/src/plugins/intel_cpu/src/emitters/snippets/external_repacking_adjuster.hpp b/src/plugins/intel_cpu/src/emitters/snippets/external_repacking_adjuster.hpp index 451bd6b85fa08a..45a13cf2169090 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/external_repacking_adjuster.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/external_repacking_adjuster.hpp @@ -16,6 +16,11 @@ namespace ov { namespace intel_cpu { class CPURuntimeConfigurator; +/** + * @class BrgemmExternalRepackingAdjuster + * @brief A runtime optimizer that creates the memory descs for BRGEMM inputs which require external repacking. + * The generated memory descs are stored in the CPU runtime config. + */ class BrgemmExternalRepackingAdjuster : public ov::snippets::lowered::pass::RuntimeOptimizer { public: BrgemmExternalRepackingAdjuster() = default;