19 #include "cldnn_defs.h" 21 #include "profiling.hpp" 46 if (_impl ==
nullptr)
throw std::invalid_argument(
"implementation pointer should not be null");
54 event& operator=(
const event& other)
56 if (_impl == other._impl)
return *
this;
68 friend bool operator==(
const event& lhs,
const event& rhs) {
return lhs._impl == rhs._impl; }
69 friend bool operator!=(
const event& lhs,
const event& rhs) {
return !(lhs == rhs); }
75 void set()
const { check_status<void>(
"set event failed", [=](status_t* status) {
cldnn_set_event(_impl, status); }); }
80 check_status<void>(
"set event handler failed", [=](status_t* status) {
cldnn_add_event_handler(_impl, handler, param, status); });
86 using namespace instrumentation;
89 status_t err_invalid_arg = CLDNN_SUCCESS;
97 std::vector<cldnn_profiling_interval> profiling_info_ref(size_ret);
99 check_status<void>(
"get event profiling info failed", [&](status_t* status)
103 assert(profiling_info_ref.size() == size_ret);
105 std::vector<profiling_interval> result(profiling_info_ref.size());
107 std::begin(profiling_info_ref),
108 std::end(profiling_info_ref),
114 std::make_shared<profiling_period_basic>(std::chrono::nanoseconds(ref.nanoseconds))
127 check_status<void>(
"retain event failed", [=](status_t* status) {
cldnn_retain_event(_impl, status); });
131 check_status<void>(
"retain event failed", [=](status_t* status) {
cldnn_release_event(_impl, status); });
134 CLDNN_API_CLASS(
event)
CLDNN_API cldnn_event cldnn_create_user_event(cldnn_engine engine, cldnn_status *status)
Creates an event which can be set by user.
Represents an clDNN Event object.
::cldnn_engine get() const
get C API engine handler.
void(* cldnn_event_handler)(void *)
user-defined event handler callback.
CLDNN_API void cldnn_release_event(cldnn_event event, cldnn_status *status)
Decrement reference counter for the event object. Deletes object when counter becomes zero...
struct cldnn_event_impl * cldnn_event
Event object.
std::vector< instrumentation::profiling_interval > get_profiling_info() const
Get profiling info for the event associated with network output.
CLDNN_API void cldnn_add_event_handler(cldnn_event event, cldnn_event_handler handler, void *param, cldnn_status *status)
Register call back to be called on event completion.
void wait() const
Wait for event completion.
CLDNN_API void cldnn_get_event_profiling_info(cldnn_event event, cldnn_profiling_interval *profiling, size_t size, size_t *size_ret, cldnn_status *status)
Returns the profiling information for an network primitive associated with event. ...
CLDNN_API void cldnn_retain_event(cldnn_event event, cldnn_status *status)
Increment reference counter for the event object.
static event create_user_event(const engine &engine)
Create an event which can be set to 'completed' by user.
void set_event_handler(cldnn_event_handler handler, void *param) const
Register call back to be called on event completion.
const char * name
Profiling interval name.
event(cldnn_event impl)
Construct from C API handler cldnn_event.
Represents clDNN engine object.
CLDNN_API void cldnn_wait_for_event(cldnn_event event, cldnn_status *status)
Waits for event completion or error.
CLDNN_API void cldnn_set_event(cldnn_event event, cldnn_status *status)
Set event status to completed.
Profiling information for an executed network primitive.