Compute Library
 19.08
GCScheduler Class Reference

Provides global access to a OpenGL ES context and command queue. More...

#include <GCScheduler.h>

Public Member Functions

void default_init ()
 Initialises the context and command queue used by the scheduler to default values and sets a default device and kernel path for the GCKernelLibrary. More...
 
void dispatch (IGCKernel &kernel, bool flush=true)
 Schedule the execution of the passed kernel if possible. More...
 
void init (EGLDisplay dpy, EGLContext ctx)
 Initialises the display and context to be used by the scheduler. More...
 
void memory_barrier ()
 Defines a barrier ordering memory transactions. More...
 
GPUTarget get_target () const
 Get the target GPU. More...
 
void set_target (GPUTarget target)
 Accessor to set target GPU to be used by the scheduler. More...
 

Static Public Member Functions

static GCSchedulerget ()
 Access the scheduler singleton. More...
 

Detailed Description

Provides global access to a OpenGL ES context and command queue.

Definition at line 36 of file GCScheduler.h.

Member Function Documentation

◆ default_init()

void default_init ( )

Initialises the context and command queue used by the scheduler to default values and sets a default device and kernel path for the GCKernelLibrary.

Definition at line 48 of file GCScheduler.cpp.

49 {
50  setup_context();
51 
52  init(_display, _context);
53 }
void init(EGLDisplay dpy, EGLContext ctx)
Initialises the display and context to be used by the scheduler.
Definition: GCScheduler.cpp:55

References GCScheduler::init().

Referenced by GCDeviceBackend::initialize_backend(), and main().

◆ dispatch()

void dispatch ( IGCKernel kernel,
bool  flush = true 
)

Schedule the execution of the passed kernel if possible.

Parameters
[in]kernelKernel to execute.
[in]flush(Optional) Specifies if the command queue will be flushed after running the kernel.

Definition at line 69 of file GCScheduler.cpp.

70 {
71  kernel.run(kernel.window());
72  if(flush)
73  {
75  }
76 }
#define ARM_COMPUTE_GL_CHECK(x)
Definition: OpenGLES.h:45
virtual void run(const Window &window)=0
Enqueue the OpenGL ES shader to process the given window.
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
void GL_APIENTRY glFlush(void)
Definition: OpenGLES.cpp:555

References ARM_COMPUTE_GL_CHECK, glFlush(), IGCKernel::run(), and IKernel::window().

Referenced by GCGEMM::prepare(), IGCSimpleFunction::run(), GCDropoutLayer::run(), GCConcatenateLayer::run(), GCConvolutionLayerReshapeWeights::run(), GCBatchNormalizationLayer::run(), GCNormalizationLayer::run(), GCDepthwiseConvolutionLayer3x3::run(), GCSoftmaxLayer::run(), GCPoolingLayer::run(), GCNormalizePlanarYUVLayer::run(), GCDirectConvolutionLayer::run(), GCFullyConnectedLayer::run(), GCGEMM::run(), and GCConvolutionLayer::run().

◆ get()

◆ get_target()

GPUTarget get_target ( ) const
inline

Get the target GPU.

Returns
The target GPU.

Definition at line 71 of file GCScheduler.h.

72  {
73  return _target;
74  }

Referenced by GCGEMM::configure().

◆ init()

void init ( EGLDisplay  dpy,
EGLContext  ctx 
)

Initialises the display and context to be used by the scheduler.

Parameters
[in]dpyThe EGL display connection
[in]ctxThe EGL rendering context

Definition at line 55 of file GCScheduler.cpp.

56 {
57  _target = get_target_from_device();
58 
59  GCKernelLibrary::get().init("./cs_shaders/", dpy, ctx);
60 }
GPUTarget get_target_from_device(const cl::Device &device)
Helper function to get the GPU target from CL device.
Definition: CLHelpers.cpp:131
static GCKernelLibrary & get()
Get the static instance of GCKernelLibrary.
void init(std::string shader_path="./", EGLDisplay dpy=EGL_NO_DISPLAY, EGLContext ctx=EGL_NO_CONTEXT)
Initialises the kernel library.

References GCKernelLibrary::get(), arm_compute::get_target_from_device(), and GCKernelLibrary::init().

Referenced by GCScheduler::default_init().

◆ memory_barrier()

void memory_barrier ( )

Defines a barrier ordering memory transactions.

Definition at line 78 of file GCScheduler.cpp.

79 {
80  ARM_COMPUTE_GL_CHECK(glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT));
81 }
#define ARM_COMPUTE_GL_CHECK(x)
Definition: OpenGLES.h:45
void GL_APIENTRY glMemoryBarrier(GLbitfield barriers)
Definition: OpenGLES.cpp:620

References ARM_COMPUTE_GL_CHECK, and glMemoryBarrier().

Referenced by GCGEMM::prepare(), IGCSimpleFunction::run(), GCNormalizationLayer::run(), GCSoftmaxLayer::run(), GCDepthwiseConvolutionLayer3x3::run(), GCPoolingLayer::run(), GCDirectConvolutionLayer::run(), GCFullyConnectedLayer::run(), GCGEMM::run(), and GCConvolutionLayer::run().

◆ set_target()

void set_target ( GPUTarget  target)
inline

Accessor to set target GPU to be used by the scheduler.

Parameters
[in]targetThe target GPU.

Definition at line 80 of file GCScheduler.h.

81  {
82  _target = target;
83  }

The documentation for this class was generated from the following files: