Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
allnes committed Oct 24, 2023
1 parent 2f3c2a8 commit b598b77
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/plugins/intel_cpu/src/nodes/executors/acl/acl_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ bool ACLConvertExecutor::init(const ConvertParams& convertParams,

if (isCopyOp) {
acl_copy = std::make_unique<NECopy>();
lockACLConfiguration([&]{ acl_copy->configure(&srcTensor, &dstTensor); });
configureThreadSafe([&] { acl_copy->configure(&srcTensor, &dstTensor); });
} else {
acl_cast = std::make_unique<NECast>();
lockACLConfiguration([&]{ acl_cast->configure(&srcTensor, &dstTensor, ConvertPolicy::SATURATE); });
configureThreadSafe([&] { acl_cast->configure(&srcTensor, &dstTensor, ConvertPolicy::SATURATE); });
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool AclDeconvExecutor::init(const DeconvAttrs& deconvAttrs,
biasTensor.allocator()->init(biasTensorInfo);

deconv = std::make_unique<arm_compute::NEDeconvolutionLayer>();
lockACLConfiguration([&] {
configureThreadSafe([&] {
deconv->configure(&srcTensor, &weiTensor, deconvAttrs.withBiasesParam ? &biasTensor : nullptr, &dstTensor,
deconv_info);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ bool AclEltwiseExecutor::init(const EltwiseAttrs &eltwiseAttrs, const std::vecto
IE_THROW() << "Unsupported operation type for ACL Eltwise executor: " << static_cast<int>(aclEltwiseAttrs.algorithm);
}

lockACLConfiguration([&]{ ifunc = exec_func(); });
configureThreadSafe([&] { ifunc = exec_func(); });
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bool ov::intel_cpu::ACLInterpolateExecutor::init(const InterpolateAttrs &interpo
dstTensor.allocator()->init(dstTensorInfo);

acl_scale = std::make_unique<arm_compute::NEScale>();
lockACLConfiguration([&] {
configureThreadSafe([&] {
acl_scale->configure(&srcTensor, &dstTensor, arm_compute::ScaleKernelInfo(acl_policy,
arm_compute::BorderMode::REPLICATE,
arm_compute::PixelValue(),
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool AclMVNExecutor::init(const MVNAttrs& mvnAttrs,
dstTensor.allocator()->init(dstTensorInfo);

mvn = std::make_unique<arm_compute::NEMeanStdDevNormalizationLayer>();
lockACLConfiguration([&]{ mvn->configure(&srcTensor, &dstTensor, mvnAttrs.epsValue_); });
configureThreadSafe([&] { mvn->configure(&srcTensor, &dstTensor, mvnAttrs.epsValue_); });

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ bool AclPoolingExecutor::init(const PoolingAttrs& poolingAttrs,
};
}
}
lockACLConfiguration([&]{ ifunc = exec_func(); });
configureThreadSafe([&] { ifunc = exec_func(); });
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ bool AclReduceExecutor::init(const ReduceAttrs& reduceAttrs,
default:
IE_THROW() << "Unsupported operation type for ACL Reduce executor: " << static_cast<int>(reduceAttrs.operation);
}
lockACLConfiguration([&]{ ifunc = exec_func(); });
configureThreadSafe([&] { ifunc = exec_func(); });
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool ov::intel_cpu::ACLTransposeExecutor::init(const ov::intel_cpu::TransposePar
dstTensor.allocator()->init(dstTensorInfo);

acl_permute = std::make_unique<arm_compute::NEPermute>();
lockACLConfiguration([&]{ acl_permute->configure(&srcTensor, &dstTensor, order); });
configureThreadSafe([&] { acl_permute->configure(&srcTensor, &dstTensor, order); });
return true;
}

Expand Down
14 changes: 7 additions & 7 deletions src/plugins/intel_cpu/src/nodes/executors/acl/acl_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,20 @@ inline arm_compute::DataLayout getAclDataLayoutByMemoryDesc(MemoryDescCPtr desc)
* @brief Return static mutex for lock ComputeLibrary configuration
* @return static std::mutex
*/
static arm_compute::Mutex & getMutexConfig() {
static arm_compute::Mutex & getConfigurationMutex() {
static arm_compute::Mutex mtx_config;
return mtx_config;
}

/**
* @brief run thread-safe configure for ComputeLibrary configuration function
* @brief run thread-safe configure for ComputeLibrary configuration function.
* Arm Compute Library 23.08 does not officially support thread-safe configure() calls.
* For example, calling configure for Eltwise operations from multiple streams leads to a data race and seg fault.
* @param config ComputeLibrary configuration function
*/
inline void lockACLConfiguration(std::function<void(void)> config) {
// We get a problem (seg. faults, data race etc) for eltwise operations when we use several configure(...) functions in parallel.
// We created issue about this problem here: https://github.com/ARM-software/ComputeLibrary/issues/1073
// TODO: change it when we will get an answer to our question in issue
std::lock_guard<arm_compute::Mutex> _lock {getMutexConfig()};
inline void configureThreadSafe(std::function<void(void)> config) {
// Issue: CVS-123514
std::lock_guard<arm_compute::Mutex> _lock {getConfigurationMutex()};
config();
}

Expand Down

0 comments on commit b598b77

Please sign in to comment.