From 7d3ba52abecbe36ccd3d2bd7cfdece14b7311559 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Fri, 24 May 2024 19:30:49 +0200 Subject: [PATCH] refactor functions --- .../src/nodes/executors/acl/acl_executor.cpp | 8 +++---- .../src/nodes/executors/acl/acl_executor.hpp | 9 ++++---- .../executors/acl/acl_fullyconnected.cpp | 21 ++++++++++--------- .../executors/acl/acl_fullyconnected.hpp | 4 ++-- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.cpp index be5c7335c19ea2..b0d84968d3716f 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.cpp @@ -36,9 +36,9 @@ bool ACLCommonExecutor::update(const MemoryArgs &memory) { acl_tensors_layouts_list[cpu_mem_ptr.first]); } - auto status = this->prepare_tensors_info(); - if (!status) { - DEBUG_LOG("ACL operator validation was failed: ", status.error_description()); + this->prepareTensorsInfo(); + if (!tensorsInfoValidateStatus) { + DEBUG_LOG("ACL operator validation was failed: ", tensorsInfoValidateStatus.error_description()); return false; } @@ -47,7 +47,7 @@ bool ACLCommonExecutor::update(const MemoryArgs &memory) { aclMemoryArgs[acl_tensor_info.first]->allocator()->init(*acl_tensor_info.second); } - configureThreadSafe([&] { this->configure_function(); }); + configureThreadSafe([&] { this->configureFunction(); }); return true; } diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.hpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.hpp index 957f57c6111576..e7098c25cedad1 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_executor.hpp @@ -22,11 +22,11 @@ struct ACLTensorAttrs { class ACLCommonExecutor : public Executor { public: - virtual arm_compute::Status prepare_tensors_info() { - OPENVINO_THROW_NOT_IMPLEMENTED("This version of the 'prepare_tensors_info' method is not implemented by executor"); + virtual void prepareTensorsInfo() { + OPENVINO_THROW_NOT_IMPLEMENTED("This version of the 'prepareTensorsInfo' method is not implemented by executor"); } - virtual void configure_function() { - OPENVINO_THROW_NOT_IMPLEMENTED("This version of the 'configure_function' method is not implemented by executor"); + virtual void configureFunction() { + OPENVINO_THROW_NOT_IMPLEMENTED("This version of the 'configureFunction' method is not implemented by executor"); } impl_desc_type implType() const override { return impl_desc_type::acl; @@ -35,6 +35,7 @@ class ACLCommonExecutor : public Executor { bool update(const MemoryArgs& memory) override; protected: + arm_compute::Status tensorsInfoValidateStatus; ACLFunction iFunction = nullptr; ACLMemoryArgs aclMemoryArgs; ACLMemoryInfoArgs aclMemoryInfoArgs; diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp index 36132b14fc92ff..803505860b8928 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp @@ -52,7 +52,7 @@ bool ACLFullyConnectedExecutor::supports(const FCConfig &config) { return true; } -arm_compute::Status ACLFullyConnectedExecutor::prepare_tensors_info() { +void ACLFullyConnectedExecutor::prepareTensorsInfo() { auto wei_shape = aclMemoryInfoArgs.at(ARG_WEI)->tensor_shape(); if (wei_shape.num_dimensions() == 3) { aclMemoryInfoArgs.at(ARG_WEI)->set_tensor_shape({wei_shape[0] * wei_shape[1], wei_shape[2]}); @@ -74,7 +74,7 @@ arm_compute::Status ACLFullyConnectedExecutor::prepare_tensors_info() { aclMemoryInfoArgs.at(ARG_WEI)->tensor_shape().total_size(), false, expected_weight_format); - auto opt_impl_status = arm_compute::NEFullyConnectedLayer::has_opt_impl( + tensorsInfoValidateStatus = arm_compute::NEFullyConnectedLayer::has_opt_impl( expected_weight_format, aclMemoryInfoArgs.at(ARG_SRC).get(), aclMemoryInfoArgs.at(ARG_WEI).get(), @@ -82,7 +82,7 @@ arm_compute::Status ACLFullyConnectedExecutor::prepare_tensors_info() { aclMemoryInfoArgs.at(ARG_DST).get(), fullyConnectedLayerInfo, weightsInfo); - if (!opt_impl_status) { return opt_impl_status; } + if (!tensorsInfoValidateStatus) { return; } fullyConnectedLayerInfo.enable_fast_math = arm_compute::is_fixed_format_fast_math(expected_weight_format); if (!fullyConnectedLayerInfo.transpose_weights) { @@ -91,15 +91,16 @@ arm_compute::Status ACLFullyConnectedExecutor::prepare_tensors_info() { aclMemoryInfoArgs.at(ARG_WEI)->set_tensor_shape(temp_weights_shape); } - return arm_compute::NEFullyConnectedLayer::validate(aclMemoryInfoArgs.at(ARG_SRC).get(), - aclMemoryInfoArgs.at(ARG_WEI).get(), - withBias ? aclMemoryInfoArgs.at(ARG_BIAS).get() : nullptr, - aclMemoryInfoArgs.at(ARG_DST).get(), - fullyConnectedLayerInfo, - weightsInfo); + tensorsInfoValidateStatus = arm_compute::NEFullyConnectedLayer::validate( + aclMemoryInfoArgs.at(ARG_SRC).get(), + aclMemoryInfoArgs.at(ARG_WEI).get(), + withBias ? aclMemoryInfoArgs.at(ARG_BIAS).get() : nullptr, + aclMemoryInfoArgs.at(ARG_DST).get(), + fullyConnectedLayerInfo, + weightsInfo); } -void ACLFullyConnectedExecutor::configure_function() { +void ACLFullyConnectedExecutor::configureFunction() { iFunction = std::make_unique(); reinterpret_cast(iFunction.get())->configure( aclMemoryArgs.at(ARG_SRC).get(), diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp index bc6e4ea40791ce..16fb2ff042f114 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp @@ -19,9 +19,9 @@ class ACLFullyConnectedExecutor : public ACLCommonExecutor { static bool supports(const FCConfig& config); - arm_compute::Status prepare_tensors_info() override; + void prepareTensorsInfo() override; - void configure_function() override; + void configureFunction() override; impl_desc_type implType() const override { return impl_desc_type::gemm_acl;