From eb5696d99d85e1d402188151e021bc4b14f93969 Mon Sep 17 00:00:00 2001 From: Anitha Raj Date: Fri, 14 Jul 2023 11:19:34 +0100 Subject: Optimize CpuReshapeKernel Resolves COMPMID-5279 Change-Id: Id9b007eed62c200702bbfcc83b94dab7b5de1714 Signed-off-by: Anitha Raj Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9962 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: SiCong Li Reviewed-by: Viet-Hoa Do Benchmark: Arm Jenkins --- src/cpu/kernels/CpuReshapeKernel.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/cpu/kernels/CpuReshapeKernel.h') diff --git a/src/cpu/kernels/CpuReshapeKernel.h b/src/cpu/kernels/CpuReshapeKernel.h index 17302c6731..eddbbf7135 100644 --- a/src/cpu/kernels/CpuReshapeKernel.h +++ b/src/cpu/kernels/CpuReshapeKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2022 Arm Limited. + * Copyright (c) 2017-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -58,6 +58,13 @@ public: void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; const char *name() const override; + /** Prepare the reshape kernel for execution (Only executed once) by calculating max or squashed window and selecting the _reshape_tensor_fn based on the presence of holes + * + * @param[in] tensors Pack of input and output tensors + * + */ + void prepare(ITensorPack &tensors); + /** Return minimum workload size of the relevant kernel * * @param[in] platform The CPU platform used to create the context. @@ -66,6 +73,21 @@ public: * @return[out] small_network_mws Minimum workload size for requsted configuration. */ size_t get_mws(const CPUInfo &platform, size_t thread_count) const override; + + /** Get the preferred dimension in which the scheduler splits the work into multiple jobs. + * + * @return The split dimension. + */ + size_t get_split_dimension() const + { + return _split_dimension; + } + +private: + size_t _split_dimension{ Window::DimY }; + + std::function _reshape_tensor_fn{}; + }; } // namespace kernels } // namespace cpu -- cgit v1.2.1