diff options
author | Jim Flynn <jim.flynn@arm.com> | 2022-02-14 11:22:29 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2022-02-14 14:14:20 +0000 |
commit | 5e7335b8ac8a63b81706316fda11348579a04726 (patch) | |
tree | 4ff8b7ece57d78a854420538df8a3c670cf15e95 /src/backends/cl/workloads | |
parent | fe1b067a677c0c991289ff2409e964b2b1b49318 (diff) | |
download | armnn-5e7335b8ac8a63b81706316fda11348579a04726.tar.gz |
Add implementation of reconfigure function to Cl Convert workloads
Change-Id: Id993a300847bde012dd38ef7f44fcd3c14867349
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com>
Diffstat (limited to 'src/backends/cl/workloads')
4 files changed, 28 insertions, 4 deletions
diff --git a/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.cpp b/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.cpp index d4110df0ae..8ccf157aca 100644 --- a/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.cpp +++ b/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.cpp @@ -25,9 +25,13 @@ ClConvertFp16ToFp32Workload::ClConvertFp16ToFp32Workload( arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(this->m_Data.m_Inputs[0])->GetTensor(); arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(this->m_Data.m_Outputs[0])->GetTensor(); + // Create Proxy tensor and set the initial tensor handle to it + m_InputProxy = std::make_unique<ICLTensorProxy>(&input); + m_OutputProxy = std::make_unique<ICLTensorProxy>(&output); + { ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClConvertFp16ToFp32Workload_configure"); - m_Layer.configure(clCompileContext, &input, &output, g_AclConvertPolicy, 0); + m_Layer.configure(clCompileContext, m_InputProxy.get(), m_OutputProxy.get(), g_AclConvertPolicy, 0); } } @@ -92,7 +96,10 @@ void ClConvertFp16ToFp32Workload::ReplaceOutputTensorHandle(ITensorHandle* tenso void ClConvertFp16ToFp32Workload::Reconfigure() { - throw armnn::UnimplementedException("Reconfigure not implemented for this workload"); + arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); + arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); + m_InputProxy->set(&input); + m_OutputProxy->set(&output); } } //namespace armnn diff --git a/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.hpp b/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.hpp index e78ffa4aff..efca378f97 100644 --- a/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.hpp +++ b/src/backends/cl/workloads/ClConvertFp16ToFp32Workload.hpp @@ -9,6 +9,8 @@ #include <arm_compute/runtime/CL/functions/CLDepthConvertLayer.h> +#include <cl/ICLTensorProxy.hpp> + namespace armnn { @@ -29,6 +31,9 @@ public: private: mutable arm_compute::CLDepthConvertLayer m_Layer; virtual void Reconfigure(); + + std::unique_ptr<ICLTensorProxy> m_InputProxy; + std::unique_ptr<ICLTensorProxy> m_OutputProxy; }; arm_compute::Status ClConvertFp16ToFp32WorkloadValidate(const TensorInfo& input, const TensorInfo& output); diff --git a/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.cpp b/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.cpp index d4ae925d9f..a44a80c997 100644 --- a/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.cpp +++ b/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.cpp @@ -25,9 +25,13 @@ ClConvertFp32ToFp16Workload::ClConvertFp32ToFp16Workload( arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(this->m_Data.m_Inputs[0])->GetTensor(); arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(this->m_Data.m_Outputs[0])->GetTensor(); + // Create Proxy tensor and set the initial tensor handle to it + m_InputProxy = std::make_unique<ICLTensorProxy>(&input); + m_OutputProxy = std::make_unique<ICLTensorProxy>(&output); + { ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClConvertFp32ToFp16Workload_configure"); - m_Layer.configure(clCompileContext, &input, &output, g_AclConvertPolicy, 0); + m_Layer.configure(clCompileContext, m_InputProxy.get(), m_OutputProxy.get(), g_AclConvertPolicy, 0); } } @@ -92,7 +96,10 @@ void ClConvertFp32ToFp16Workload::ReplaceOutputTensorHandle(ITensorHandle* tenso void ClConvertFp32ToFp16Workload::Reconfigure() { - throw armnn::UnimplementedException("Reconfigure not implemented for this workload"); + arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); + arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); + m_InputProxy->set(&input); + m_OutputProxy->set(&output); } } //namespace armnn diff --git a/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.hpp b/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.hpp index a4baef8555..adffd8123e 100644 --- a/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.hpp +++ b/src/backends/cl/workloads/ClConvertFp32ToFp16Workload.hpp @@ -9,6 +9,8 @@ #include <arm_compute/runtime/CL/functions/CLDepthConvertLayer.h> +#include <cl/ICLTensorProxy.hpp> + namespace armnn { @@ -28,6 +30,9 @@ public: private: mutable arm_compute::CLDepthConvertLayer m_Layer; virtual void Reconfigure(); + + std::unique_ptr<ICLTensorProxy> m_InputProxy; + std::unique_ptr<ICLTensorProxy> m_OutputProxy; }; arm_compute::Status ClConvertFp32ToFp16WorkloadValidate(const TensorInfo& input, const TensorInfo& output); |