Skip to content

[CPU] Refactor mamtul node#31696

Merged
maxnick merged 14 commits intoopenvinotoolkit:masterfrom
EgorDuplensky:matmul_refactoring_new
Sep 11, 2025
Merged

[CPU] Refactor mamtul node#31696
maxnick merged 14 commits intoopenvinotoolkit:masterfrom
EgorDuplensky:matmul_refactoring_new

Conversation

@EgorDuplensky
Copy link
Copy Markdown
Contributor

No description provided.

@EgorDuplensky EgorDuplensky requested review from a team as code owners August 12, 2025 11:26
@github-actions github-actions bot added the category: CPU OpenVINO CPU plugin label Aug 12, 2025
@EgorDuplensky EgorDuplensky force-pushed the matmul_refactoring_new branch 4 times, most recently from ed9e1b6 to 875d2b8 Compare August 18, 2025 17:50
@EgorDuplensky EgorDuplensky force-pushed the matmul_refactoring_new branch 5 times, most recently from cceb39d to c203318 Compare August 26, 2025 15:17
@EgorDuplensky EgorDuplensky requested a review from Copilot August 26, 2025 17:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the MatMul node implementation in Intel CPU plugin to align with a new executor framework. The refactoring modernizes the code architecture by replacing the legacy implementation with a factory-based executor pattern that supports multiple backend implementations.

Key changes include:

  • Refactored MatMul node to use new executor factory pattern
  • Simplified header dependencies and removed legacy code
  • Updated MatMul small executor to align with new interface
  • Added comprehensive MatMul implementations with support selection

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/plugins/intel_cpu/src/nodes/matmul.h Refactored header to use executor factory pattern, removed legacy members
src/plugins/intel_cpu/src/nodes/matmul.cpp Complete rewrite using executor factory, simplified initialization and execution
src/plugins/intel_cpu/src/nodes/executors/x64/matmul_small.hpp Updated interface to inherit from new Executor base class
src/plugins/intel_cpu/src/nodes/executors/x64/matmul_small.cpp Refactored implementation to work with new executor framework
src/plugins/intel_cpu/src/nodes/executors/variable_executor.hpp Added precreate parameter for optional executor initialization
src/plugins/intel_cpu/src/nodes/executors/matmul_implementations.cpp New file defining available MatMul executor implementations
src/plugins/intel_cpu/src/nodes/executors/matmul_config.hpp Extended MatMul attributes structure with additional configuration
src/plugins/intel_cpu/src/nodes/executors/implementations.hpp Added MatMul to executor implementations registry
Multiple DNNL files Updated to support MatMul attributes and maintain compatibility with FC attributes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@EgorDuplensky
Copy link
Copy Markdown
Contributor Author

@maxnick Could you please take a look

@EgorDuplensky EgorDuplensky force-pushed the matmul_refactoring_new branch 2 times, most recently from 4eeafa6 to 958a21d Compare August 29, 2025 12:05
@EgorDuplensky EgorDuplensky force-pushed the matmul_refactoring_new branch 2 times, most recently from 2874186 to 5872b2f Compare September 3, 2025 11:53
Copy link
Copy Markdown
Contributor

@maxnick maxnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

bool withBias = false;
bool weightsNonTransposed = false;
bool sparseWeights = false;
uint64_t dynamicQuantizationGroupSize = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. If we move dynamicQuantizationGroupSize behind bool declarations, we can reduce the size of MatMulAttrs struct by 8 bytes, due to data alignment:

struct MatMulAttrs {
    bool transposeA = false;
    bool transposeB = false;
    bool withBias = false;
    bool weightsNonTransposed = false;
    bool sparseWeights = false;

    bool constantWeights = false;
    bool fcSemantic = false;

    uint64_t dynamicQuantizationGroupSize = 0;

    // DQ scales for quantization
    std::vector<float> dqScales;

    // Post-operations for fused operations
    PostOps postOps;
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied

@maxnick maxnick added this to the 2025.4 milestone Sep 11, 2025
@maxnick maxnick added this pull request to the merge queue Sep 11, 2025
Merged via the queue into openvinotoolkit:master with commit d5dc214 Sep 11, 2025
259 of 264 checks passed
@maxnick maxnick deleted the matmul_refactoring_new branch September 11, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: CPU OpenVINO CPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants