From db4a6c15e55aaffbe555c33f3e10795d822701e7 Mon Sep 17 00:00:00 2001 From: SiCong Li Date: Fri, 5 Feb 2021 09:30:57 +0000 Subject: Integrate MLGO into CLGEMM and CLGEMMLowpMatrixMultiplyCore: Part2 * Associate CLScheduler with CLGEMMHeuristicsHandle * Add option in arm_compute_validation for mlgo file path * Extend logging for the selection of gemm configurations Resolves: COMPMID-3843, COMPMID-3844 Signed-off-by: SiCong Li Change-Id: I869c3a4122414ae6a7bbd721966c1da37621ca11 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5002 Tested-by: Arm Jenkins Reviewed-by: Manuel Bottini Reviewed-by: Gian Marco Iodice Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- arm_compute/runtime/CL/CLScheduler.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'arm_compute/runtime/CL/CLScheduler.h') diff --git a/arm_compute/runtime/CL/CLScheduler.h b/arm_compute/runtime/CL/CLScheduler.h index 8a22832792..d3a91da751 100644 --- a/arm_compute/runtime/CL/CLScheduler.h +++ b/arm_compute/runtime/CL/CLScheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 Arm Limited. + * Copyright (c) 2016-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -30,6 +30,7 @@ #include "arm_compute/core/Error.h" #include "arm_compute/core/Types.h" #include "arm_compute/core/experimental/Types.h" +#include "arm_compute/runtime/CL/CLGEMMHeuristicsHandle.h" #include "arm_compute/runtime/CL/ICLTuner.h" namespace arm_compute @@ -57,15 +58,17 @@ public: * and sets a default device and kernel path for the @ref CLKernelLibrary. * * @param[in] cl_tuner (Optional) Pointer to ICLTuner (default=nullptr) + * @param[in] gemm_h (Optional) Pointer to CLGEMMHeuristicsHandle (default = nullptr) */ - void default_init(ICLTuner *cl_tuner = nullptr); + void default_init(ICLTuner *cl_tuner = nullptr, CLGEMMHeuristicsHandle *gemm_h = nullptr); /** Initialises the scheduler with context and device provided by the user * * @param[in] device OpenCL device to be used * @param[in] ctx OpenCL ctx to be used * @param[in] cl_tuner (Optional) Pointer to ICLTuner (default=nullptr) + * @param[in] gemm_h (Optional) Pointer to CLGEMMHeuristicsHandle (default = nullptr) */ - void default_init_with_context(cl::Device &device, cl::Context &ctx, ICLTuner *cl_tuner = nullptr); + void default_init_with_context(cl::Device &device, cl::Context &ctx, ICLTuner *cl_tuner = nullptr, CLGEMMHeuristicsHandle *gemm_h = nullptr); /** Schedule the execution of the passed kernel if possible. * @@ -88,8 +91,9 @@ public: * @param[in] device A CL device. * @param[in] cl_tuner (Optional) Pointer to OpenCL tuner (default=nullptr) * Note: It is caller's responsibility to release the allocated memory for CLTuner + * @param[in] gemm_h (Optional) Pointer to CLGEMMHeuristicsHandle (default = nullptr) */ - void init(cl::Context context, cl::CommandQueue queue, const cl::Device &device, ICLTuner *cl_tuner = nullptr); + void init(cl::Context context, cl::CommandQueue queue, const cl::Device &device, ICLTuner *cl_tuner = nullptr, CLGEMMHeuristicsHandle *gemm_h = nullptr); /** Accessor for the associated CL context. * @@ -109,6 +113,12 @@ public: */ GPUTarget target() const; + /** Accessor for the associated CLGEMMHeuristicsHandle + * + * @return Pointer to CLGEMMHeuristicsHandle + */ + CLGEMMHeuristicsHandle *gemm_heuristics() const; + /** Accessor to set the CL context to be used by the scheduler. * * @param[in] context A CL context. @@ -161,6 +171,7 @@ private: bool _is_initialised; ICLTuner *_cl_tuner; std::unique_ptr _cl_default_static_tuner; + CLGEMMHeuristicsHandle *_gemm_heuristics; }; } // namespace arm_compute #endif /* ARM_COMPUTE_CLSCHEDULER_H */ -- cgit v1.2.1