Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CPU][ARM] Enable fast math in ACL deconvolution executor (#26615)

Aleksandr Vorond0056bd5154d
diff --git a/src/plugins/intel_cpu/src/config.cpp b/src/plugins/intel_cpu/src/config.cpp
index 2b9cdcc4ac1..421dca07747 100644
--- a/src/plugins/intel_cpu/src/config.cpp
+++ b/src/plugins/intel_cpu/src/config.cpp
@@ -400,6 +400,12 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {
inferencePrecision = ov::element::undefined;
}
}
+ // enable ACL fast math in PERFORMANCE mode
+#if defined(OV_CPU_WITH_ACL)
+ if (executionMode == ov::hint::ExecutionMode::PERFORMANCE) {
+ aclFastMath = true;
+ }
+#endif
// disable dynamic quantization and kv quantization for best accuracy
if (executionMode == ov::hint::ExecutionMode::ACCURACY) {
if (!fcDynamicQuantizationGroupSizeSetExplicitly) {
diff --git a/src/plugins/intel_cpu/src/config.h b/src/plugins/intel_cpu/src/config.h
index eeb8e78f5fa..79cdf3a5e82 100644
--- a/src/plugins/intel_cpu/src/config.h
+++ b/src/plugins/intel_cpu/src/config.h
@@ -53,6 +53,9 @@ struct Config {
uint64_t fcDynamicQuantizationGroupSize = 32;
ov::element::Type kvCachePrecision = ov::element::f16;
bool fcDynamicQuantizationGroupSizeSetExplicitly = false;
+#if defined(OV_CPU_WITH_ACL)
+ bool aclFastMath = false;
+#endif
#if defined(OPENVINO_ARCH_X86_64)
size_t rtCacheCapacity = 5000ul;
#else
diff --git a/src/plugins/intel_cpu/src/nodes/deconv.cpp b/src/plugins/intel_cpu/src/nodes/deconv.cpp
index 57046a0a06d..8a7f95268b4 100644
--- a/src/plugins/intel_cpu/src/nodes/deconv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/deconv.cpp
@@ -219,6 +219,9 @@ Deconvolution::Deconvolution(const std::shared_ptr<ov::Node>& op,
for (size_t i = 0; i < deconvAttrs.dilation.size(); i++) {
deconvAttrs.kernel.push_back(weightDims[withGroups + 2 + i]);
}
+#if defined(OV_CPU_WITH_ACL)
+ deconvAttrs.aclFastMath = context->getConfig().aclFastMath;
+#endif
externOutShape = inputShapes.size() == 3;
biasPort = externOutShape ? 3 : 2;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp
index 1345451669b..7d400bf96d7 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp
@@ -99,7 +99,7 @@ bool AclDeconvExecutor::init(const DeconvAttrs& deconvAttrs,
deconv = std::make_unique<arm_compute::NEDeconvolutionLayer>();
configureThreadSafe([&] {
- deconv->configure(&srcTensor, &weiTensor, deconvAttrs.withBiasesParam ? &biasTensor : nullptr, &dstTensor, deconv_info);
+ deconv->configure(&srcTensor, &weiTensor, deconvAttrs.withBiasesParam ? &biasTensor : nullptr, &dstTensor, deconv_info, deconvAttrs.aclFastMath);
});
return true;
}
@@ -271,7 +271,8 @@ bool AclDeconvExecutorBuilder::customIsSupported(const DeconvAttrs &deconvAttrs,
&weiTensorInfo,
deconvAttrs.withBiasesParam ? &biasTensorInfo : nullptr,
&dstTensorInfo,
- deconv_info);
+ deconv_info,
+ deconvAttrs.aclFastMath);
if (!status) {
DEBUG_LOG("NEDeconvolutionLayer validation failed: ", status.error_description());
return false;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp b/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp
index 9528e5a5ef0..c632cc0cf99 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp
@@ -22,6 +22,9 @@ struct DeconvAttrs {
std::vector<ptrdiff_t> paddingR;
ov::CoordinateDiff outputPadding;
bool withBiasesParam = false;
+#if defined(OV_CPU_WITH_ACL)
+ bool aclFastMath = false;
+#endif
};
class DeconvExecutor {