From 8afe6c7631891601897d7dd5b9ac68375ac01b19 Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Mon, 6 Sep 2021 14:32:19 +0100 Subject: OpenCL job chaining support Resolve COMPMID-4714 Change-Id: I53b74956da10a8d7ffa2c5681f3b7f74acaa3201 Signed-off-by: Giorgio Arena Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6215 Reviewed-by: Gian Marco Iodice Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- arm_compute/runtime/CL/CLScheduler.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 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 56852aec6e..37d9e2ad05 100644 --- a/arm_compute/runtime/CL/CLScheduler.h +++ b/arm_compute/runtime/CL/CLScheduler.h @@ -76,14 +76,14 @@ public: /** Schedule the execution of the passed kernel if possible. * * @param[in] kernel Kernel to execute. - * @param[in] flush (Optional) Specifies if the command queue will be flushed after running the kernel. + * @param[in] flush (Optional) Specifies if the command queue will be flushed after running the kernel. This will be ignored if job chaining is enabled. */ void enqueue(ICLKernel &kernel, bool flush = true); /** Schedule the execution of the passed kernel if possible. * * @param[in] kernel Kernel to execute. * @param[in] tensors Vector containing the tensors to operate on. - * @param[in] flush (Optional) Specifies if the command queue will be flushed after running the kernel. + * @param[in] flush (Optional) Specifies if the command queue will be flushed after running the kernel. This will be ignored if job chaining is enabled. */ void enqueue_op(ICLKernel &kernel, ITensorPack &tensors, bool flush = true); @@ -163,6 +163,12 @@ public: */ void tune_kernel_static(ICLKernel &kernel); + /** Enable job chaining. The command queue will only be flushed when @p job_chaining_size kernels have been enqueued. + * + * @param[in] job_chaining_size Kernels to enqueue before flushing + */ + void enable_job_chaining(int job_chaining_size); + bool is_initialised() const; private: @@ -177,6 +183,9 @@ private: ICLTuner *_cl_tuner; CLGEMMHeuristicsHandle *_gemm_heuristics; CLBackendType _backend_type; + bool _job_chaining_enabled; + int _job_chaining_size; + int _job_chaining_count; }; } // namespace arm_compute #endif /* ARM_COMPUTE_CLSCHEDULER_H */ -- cgit v1.2.1