From 94f799e8f6f605333d40472860fb472e8ba6d83d Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Wed, 9 Jun 2021 16:37:32 +0100 Subject: Fix incorrect memory handling in ported functions Details of the functions: - ClSoftmax - CpuSoftmax - CpuPool2d Change-Id: Icd2c14d5df010c3b2301e2693ce6f414d7c61916 Resolves: COMPMID-4404 Signed-off-by: Manuel Bottini Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5797 Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- src/runtime/gpu/cl/operators/ClSoftmax.h | 36 +++++++------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) (limited to 'src/runtime/gpu/cl/operators/ClSoftmax.h') diff --git a/src/runtime/gpu/cl/operators/ClSoftmax.h b/src/runtime/gpu/cl/operators/ClSoftmax.h index e38b7c595a..f19a51fc5e 100644 --- a/src/runtime/gpu/cl/operators/ClSoftmax.h +++ b/src/runtime/gpu/cl/operators/ClSoftmax.h @@ -67,7 +67,7 @@ public: experimental::MemoryRequirements workspace() const override; private: - enum class InternalTensorIdx + enum InternalTensorIdx { MAX = 0, SUM, @@ -77,41 +77,19 @@ private: COUNT }; - /** Create a single internal tensor - * - * @param[in] info The information used to create a tensor - * @param[in] idx The index within the internal array the created tensor will be held - */ - void create_internal_tensor(TensorInfo &info, InternalTensorIdx idx); - /** Create all required internal tensors */ - void create_internal_tensor(); - /** Function to convert from internal tensor index to @ref TensorType used externally */ - TensorType convert_internal_idx_to_tensor_type(InternalTensorIdx idx) const; - /** Function to import workspace memory allocated by the caller into internal tensor instances */ - void import_workspace_memory(ITensorPack &tensors); - /** Function to permute the given source tensor when permutation is required */ - void run_source_permute(const ITensor *src); - /** Function to permute the intemediate tensor to the final destination tensor when permutation is required */ - void run_destination_permute(ITensor *dst); - /** Function to run @ref arm_compute::opencl::kernels::ClLogits1DMaxShiftExpSumKernel */ - void run_max_sum(const ITensor *src); - /** Function to run @ref kernels::ClLogits1DNormKernel */ - void run_norm(ITensor *dst); - std::unique_ptr _permute_input; std::unique_ptr _permute_output; std::unique_ptr _max_shift_exp_sum_kernel; std::unique_ptr _norm_kernel; bool _needs_permute{ false }; - std::array(InternalTensorIdx::COUNT)> _internal_info{}; - std::array, static_cast(InternalTensorIdx::COUNT)> _internal_tensor{}; + TensorInfo _max_info; + TensorInfo _sum_info; + TensorInfo _tmp_info; + TensorInfo _permuted_src_info; + TensorInfo _permuted_dst_info; - TensorInfo &_max_info; - TensorInfo &_sum_info; - TensorInfo &_tmp_info; - TensorInfo &_permuted_src_info; - TensorInfo &_permuted_dst_info; + experimental::MemoryRequirements _aux_mem{}; }; } // opencl -- cgit v1.2.1