Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / src / gpu / ocl_base_event.h
1 #pragma once
2
3 #include "ocl_toolkit.h"
4
5 namespace cldnn { namespace gpu {
6
7 struct profiling_period_ocl_start_stop
8 {
9     const char* name;
10     cl_profiling_info start;
11     cl_profiling_info stop;
12 };
13
14 struct base_event : virtual public event_impl
15 {
16 public:
17     base_event(std::shared_ptr<gpu_toolkit> ctx, cl::Event const& ev, uint64_t queue_stamp = 0) : _ctx(ctx), _event(ev), _queue_stamp(queue_stamp)
18     {}
19
20     auto get_context() const { return _ctx; }
21     cl::Event get() { return _event; }
22
23     uint64_t get_queue_stamp() const { return _queue_stamp; }
24
25 private:
26     std::shared_ptr<gpu_toolkit> _ctx;
27     cl::Event _event;
28     bool _callback_set = false;
29     uint64_t _queue_stamp = 0;
30
31     void set_ocl_callback();
32
33     static void CL_CALLBACK ocl_event_completion_callback(cl_event, cl_int, void* me);
34
35 private:
36     void wait_impl() override;
37     bool is_set_impl() override;
38     bool add_event_handler_impl(cldnn_event_handler, void*) override;
39     bool get_profiling_info_impl(std::list<cldnn_profiling_interval>& info) override;
40 };
41
42 }}