Skip to content

Commit 5872b2f

Browse files
committed
Apply review comments
1 parent 8528cfb commit 5872b2f

11 files changed

+26
-16
lines changed

src/plugins/intel_cpu/src/nodes/conv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ void Convolution::initSupportedPrimitiveDescriptors() {
476476

477477
m_attrs.isGraphQuantized = context->isGraphQuantized();
478478
m_attrs.fcSemantic = false;
479-
m_attrs.nonConstantWeights = !getParentEdgeAt(WEIGHTS)->getParent()->isConstant();
479+
m_attrs.constantWeights = getParentEdgeAt(WEIGHTS)->getParent()->isConstant();
480480
m_attrs.weightsNonTransposed = false;
481481
m_attrs.dqScales = getDQScales();
482482

src/plugins/intel_cpu/src/nodes/executors/convolution_config.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ struct ConvAttrs {
3232
// @todo can we just check for port precisions instead?
3333
bool isGraphQuantized = false;
3434
bool fcSemantic = false;
35-
bool nonConstantWeights = false;
35+
// there are models with non-constant weights
36+
bool constantWeights = true;
3637
ZeroPointsType inputZeroPointsType = ZeroPointsType::None;
3738
std::vector<float> dqScales;
3839

src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ DnnlConvolutionPrimitive::IntermediateReorders::IntermediateReorders(const Key&
9898
createIfNotEqual(key.dst->getDnnlDesc(), primDesc.dst_desc(), AllocateMemoryFor::Dst, engine);
9999
}
100100

101-
if (key.nonConstantWeights && key.wei->getDnnlDesc() != primDesc.weights_desc()) {
101+
if (!key.constantWeights && key.wei->getDnnlDesc() != primDesc.weights_desc()) {
102102
m_inputReorders[DNNL_ARG_WEIGHTS] =
103103
createIfNotEqual(key.wei->getDnnlDesc(), primDesc.weights_desc(), AllocateMemoryFor::Dst, engine);
104104
}
@@ -142,7 +142,7 @@ size_t DnnlConvolutionPrimitive::Key::hash() const {
142142

143143
seed = hash_combine(seed, get_attr_hash(*attr.get()));
144144
seed = hash_combine(seed, fcSemantic);
145-
seed = hash_combine(seed, nonConstantWeights);
145+
seed = hash_combine(seed, constantWeights);
146146

147147
return seed;
148148
}
@@ -168,7 +168,7 @@ bool DnnlConvolutionPrimitive::Key::operator==(const Key& rhs) const {
168168

169169
result = result && *attr.get() == *rhs.attr.get();
170170
result = result && fcSemantic == rhs.fcSemantic;
171-
result = result && nonConstantWeights == rhs.nonConstantWeights;
171+
result = result && constantWeights == rhs.constantWeights;
172172

173173
return result;
174174
}
@@ -858,7 +858,7 @@ std::shared_ptr<DnnlConvolutionPrimitive> DnnlConvolutionPrimitive::create(
858858
paddingR,
859859
shapeAgnosticData->m_primAttrs.attr,
860860
attrs.fcSemantic,
861-
attrs.nonConstantWeights};
861+
attrs.constantWeights};
862862

863863
const auto defaultImplType = shapeAgnosticData->m_implType;
864864

src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class DnnlConvolutionPrimitive {
4040

4141
dnnl::primitive_attr attr;
4242

43-
bool fcSemantic;
44-
bool nonConstantWeights;
43+
bool fcSemantic = false;
44+
bool constantWeights = true;
4545

4646
[[nodiscard]] size_t hash() const;
4747
bool operator==(const Key& rhs) const;

src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_executor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class DnnlExecutor : public Executor {
126126
const PrimitivePtr currentPrimitive,
127127
const PrimitivePtr newPrimitive,
128128
const MemoryPtr& memory) {
129-
if (m_attrs.nonConstantWeights) { // non constant weights are handled by the primitive
129+
if (m_attrs.constantWeights) { // non constant weights are handled by the primitive
130130
m_primArgs[DNNL_ARG_WEIGHTS] = memory->getPrimitive();
131131
return;
132132
}

src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ DnnlShapeAgnosticDataPtr DnnlMatMulPrimitive::createShapeAgnosticData(const MatM
543543
useWeightsDecompression,
544544
attrs.fcSemantic);
545545

546-
if (!attrs.nonConstantWeights && cacheWeights) {
546+
if (attrs.constantWeights && cacheWeights) {
547547
const auto weightsDesc = DnnlExtensionUtils::makeDescriptor(primDesc.weights_desc());
548548
auto originalWeightsDesc = MemoryDescUtils::convertToDnnlMemoryDesc(weiDesc);
549549

src/plugins/intel_cpu/src/nodes/executors/executor_factory.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,14 @@ class ExecutorFactory {
8383
* - Simple Executor, if there is only one available implementation
8484
*
8585
* @param memory memory arguments.
86+
* @param initVariableExecutor whether to init first available implementation of variable executor or not.
87+
* This option is mostly a workaround at the moment.
88+
* In general it might be beneficial to initialize all the shape dependent implementations
89+
* of the variable executor in advance to avoid first-time call delays.
8690
*
8791
* @return A shared pointer to the created Executor.
8892
*/
89-
ExecutorPtr make(const MemoryArgs& memory, bool precreate = true) {
93+
ExecutorPtr make(const MemoryArgs& memory, bool initVariableExecutor = true) {
9094
std::vector<ExecutorImplementationRef> implementations;
9195

9296
auto acceptsConfig = [](const ExecutorImplementationRef& impl, const executor::Config<Attrs>& config) {
@@ -121,7 +125,11 @@ class ExecutorFactory {
121125
return theOnlyImplementation.create(m_attrs, memory, m_context);
122126
}
123127

124-
return std::make_shared<VariableExecutor<Attrs>>(memory, m_attrs, m_context, implementations, precreate);
128+
return std::make_shared<VariableExecutor<Attrs>>(memory,
129+
m_attrs,
130+
m_context,
131+
implementations,
132+
initVariableExecutor);
125133
}
126134

127135
private:

src/plugins/intel_cpu/src/nodes/executors/fullyconnected_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct FCAttrs {
2020
bool weightsNonTransposed = false;
2121
bool sparseWeights = false;
2222
uint64_t dynamicQuantizationGroupSize = 0;
23-
bool nonConstantWeights = false;
23+
bool constantWeights = true;
2424

2525
ov::intel_cpu::Config::ModelType modelType = ov::intel_cpu::Config::ModelType::Unknown;
2626

src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ const std::vector<ExecutorImplementation<FCAttrs>>& getImplementations() {
422422
false};
423423
matMulAttrs.postOps = attrs.postOps;
424424
matMulAttrs.transposeB = attrs.weightsNonTransposed;
425+
matMulAttrs.constantWeights = true;
425426

426427
return std::make_shared<
427428
DnnlExecutor<DnnlMatMulPrimitive, MatMulAttrs, DnnlShapeAgnosticData,

src/plugins/intel_cpu/src/nodes/executors/matmul_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct MatMulAttrs {
1919
bool weightsNonTransposed = false;
2020
bool sparseWeights = false;
2121
uint64_t dynamicQuantizationGroupSize = 0;
22-
bool nonConstantWeights = true;
22+
bool constantWeights = false;
2323
bool fcSemantic = false;
2424

2525
// DQ scales for quantization

0 commit comments

Comments
 (0)