aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2022-03-03 10:09:01 +0000
committerGiorgio Arena <giorgio.arena@arm.com>2022-03-08 10:41:03 +0000
commit232c45253a84c16fc70eae6406cac5f4048efaca (patch)
tree32aa46ed0cb2bdc9877709d0573f45778894fefe /src/runtime/CL
parent4cbcb840caca1346de5f2271b67e4ede17b72734 (diff)
downloadComputeLibrary-232c45253a84c16fc70eae6406cac5f4048efaca.tar.gz
Merge kernel prototype patch
Resolves: COMPMID-5151 Signed-off-by: Giorgio Arena <giorgio.arena@arm.com> Change-Id: Ic4024d5cd4819fe917a1d49621f1866ae2e90a37 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7260 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: SiCong Li <sicong.li@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL')
-rw-r--r--src/runtime/CL/CLScheduler.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/runtime/CL/CLScheduler.cpp b/src/runtime/CL/CLScheduler.cpp
index 9d340438b8..22bf850d6e 100644
--- a/src/runtime/CL/CLScheduler.cpp
+++ b/src/runtime/CL/CLScheduler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2021 Arm Limited.
+ * Copyright (c) 2016-2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,6 +27,10 @@
#include "arm_compute/runtime/CL/CLTuner.h"
#include "src/core/CL/ICLKernel.h"
+#if defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
+#include "src/gpu/cl/kernels/experimental/dynamic_fusion/ClCompositeKernel.h"
+#endif // defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
+
namespace arm_compute
{
cl::Context &CLScheduler::context()
@@ -185,6 +189,35 @@ void CLScheduler::enqueue_common(ICLKernel &kernel, ITensorPack &tensors, bool f
}
}
+#if defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
+
+void CLScheduler::enqueue_common(ICLKernel &kernel, experimental::dynamic_fusion::TensorBinding &tensors, const experimental::dynamic_fusion::ClExecutionDescriptor &exec_desc, bool flush)
+{
+ ARM_COMPUTE_ERROR_ON_MSG(!_is_initialised,
+ "The CLScheduler is not initialised yet! Please call the CLScheduler::get().default_init(), \
+ or CLScheduler::get()::init() and CLKernelLibrary::get()::init() function before running functions!");
+
+ const bool inject_memory = !tensors._binding.empty();
+
+ // Run kernel
+ inject_memory ? kernel.run_composite_op(tensors, kernel.window(), _queue, exec_desc) : kernel.run(kernel.window(), _queue);
+
+ if(_job_chaining_enabled)
+ {
+ if(++_job_chaining_count >= _job_chaining_size)
+ {
+ _job_chaining_count = 0;
+ _queue.flush();
+ }
+ }
+ else if(flush)
+ {
+ _queue.flush();
+ }
+}
+
+#endif // defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
+
void CLScheduler::enqueue(ICLKernel &kernel, bool flush)
{
ITensorPack pack;
@@ -196,6 +229,15 @@ void CLScheduler::enqueue_op(ICLKernel &kernel, ITensorPack &tensors, bool flush
enqueue_common(kernel, tensors, flush);
}
+#if defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
+
+void CLScheduler::enqueue_op(ICLKernel &kernel, experimental::dynamic_fusion::TensorBinding &tensors, const experimental::dynamic_fusion::ClExecutionDescriptor &exec_desc, bool flush)
+{
+ enqueue_common(kernel, tensors, exec_desc, flush);
+}
+
+#endif // defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
+
void CLScheduler::enable_job_chaining(int job_chaining_size)
{
_job_chaining_enabled = true;