aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/CLScheduler.cpp
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2019-09-24 11:03:47 +0100
committerPablo Marquez <pablo.tello@arm.com>2019-10-15 14:05:55 +0000
commitdb8485ac24135f17e9882c76196924435abc064f (patch)
treedfe4ff6a50012ac93c6b1cf3fb29c099a7592522 /src/runtime/CL/CLScheduler.cpp
parenta046e164b96a8441b2fa14ef578f7db46a0e97da (diff)
downloadComputeLibrary-db8485ac24135f17e9882c76196924435abc064f.tar.gz
COMPMID-2205: CL runtime context.
CL Interfaces implemented. Concrete classes implemented. One test (ActivationLayer) ported to the new interface. Change-Id: I283808bec36ccfc2f13fe048c45cbbee698ce525 Signed-off-by: Pablo Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/1998 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL/CLScheduler.cpp')
-rw-r--r--src/runtime/CL/CLScheduler.cpp70
1 files changed, 65 insertions, 5 deletions
diff --git a/src/runtime/CL/CLScheduler.cpp b/src/runtime/CL/CLScheduler.cpp
index 701ffe0ab1..e78eaa482f 100644
--- a/src/runtime/CL/CLScheduler.cpp
+++ b/src/runtime/CL/CLScheduler.cpp
@@ -23,13 +23,71 @@
*/
#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/CL/CLHelpers.h"
-
+#include "arm_compute/core/CL/CLKernelLibrary.h"
#include "arm_compute/core/CL/ICLKernel.h"
+#include "arm_compute/runtime/CL/CLHelpers.h"
#include "arm_compute/runtime/CL/CLTuner.h"
#include "arm_compute/runtime/CL/tuners/Tuners.h"
-using namespace arm_compute;
+namespace arm_compute
+{
+cl::Context &CLScheduler::context()
+{
+ ARM_COMPUTE_ERROR_ON(!_is_initialised);
+ _context = CLKernelLibrary::get().context();
+ return _context;
+}
+
+cl::CommandQueue &CLScheduler::queue()
+{
+ ARM_COMPUTE_ERROR_ON(!_is_initialised);
+ return _queue;
+}
+
+GPUTarget CLScheduler::target() const
+{
+ return _target;
+}
+
+void CLScheduler::set_queue(cl::CommandQueue queue)
+{
+ _queue = std::move(queue);
+}
+
+void CLScheduler::set_target(GPUTarget target)
+{
+ _target = target;
+}
+
+void CLScheduler::set_tuner(ICLTuner *tuner)
+{
+ _cl_tuner = tuner;
+}
+
+void CLScheduler::sync()
+{
+ _queue.finish();
+}
+
+cl::Event CLScheduler::enqueue_sync_event()
+{
+ cl::Event event;
+ _queue.enqueueMarker(&event);
+ return event;
+}
+
+void CLScheduler::tune_kernel_static(ICLKernel &kernel)
+{
+ if(_cl_tuner != nullptr)
+ {
+ _cl_tuner->tune_kernel_static(kernel);
+ }
+}
+
+bool CLScheduler::is_initialised() const
+{
+ return _is_initialised;
+}
std::once_flag CLScheduler::_initialize_symbols;
@@ -49,8 +107,9 @@ void CLScheduler::default_init_with_context(cl::Device &device, cl::Context &ctx
{
if(!_is_initialised)
{
- cl::CommandQueue queue = cl::CommandQueue(ctx, device);
- CLKernelLibrary::get().init("./cl_kernels/", ctx, device);
+ const std::string cl_kernels_folder("./cl_kernels/");
+ cl::CommandQueue queue = cl::CommandQueue(ctx, device);
+ CLKernelLibrary::get().init(cl_kernels_folder, ctx, device);
init(ctx, queue, device, cl_tuner);
_cl_default_static_tuner = tuners::TunerFactory::create_tuner(_target);
_cl_tuner = (cl_tuner == nullptr) ? _cl_default_static_tuner.get() : cl_tuner;
@@ -113,3 +172,4 @@ void CLScheduler::enqueue(ICLKernel &kernel, bool flush)
_queue.flush();
}
}
+} // namespace arm_compute