[CPU] Refactor mamtul node#31696
Conversation
ed9e1b6 to
875d2b8
Compare
cceb39d to
c203318
Compare
There was a problem hiding this comment.
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.
src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp
Show resolved
Hide resolved
src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/matmul.cpp
Outdated
Show resolved
Hide resolved
c203318 to
72fcb80
Compare
|
@maxnick Could you please take a look |
4eeafa6 to
958a21d
Compare
src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.cpp
Outdated
Show resolved
Hide resolved
2874186 to
5872b2f
Compare
| bool withBias = false; | ||
| bool weightsNonTransposed = false; | ||
| bool sparseWeights = false; | ||
| uint64_t dynamicQuantizationGroupSize = 0; |
There was a problem hiding this comment.
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;
};5872b2f to
f00012c
Compare
d5dc214
No description provided.