Skip to content

Commit

Permalink
vtsymbal hotkernels sample (#45)
Browse files Browse the repository at this point in the history
* adding host synchronize event handling to hot functions sample

* adding host synchronize event handling to hot functions sample
  • Loading branch information
vladimir-tsymbal authored Dec 15, 2023
1 parent c60f92b commit 9ee0e46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.49.20
0.49.21
15 changes: 15 additions & 0 deletions samples/ze_hot_kernels/ze_kernel_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ class ZeKernelCollector {

prologue_callbacks.Event.pfnHostResetCb = OnEnterEventHostReset;

epilogue_callbacks.Event.pfnHostSynchronizeCb = OnExitEventHostSynchronize;

prologue_callbacks.EventPool.pfnCreateCb = OnEnterEventPoolCreate;
epilogue_callbacks.EventPool.pfnCreateCb = OnExitEventPoolCreate;

Expand Down Expand Up @@ -475,6 +477,19 @@ class ZeKernelCollector {
}
}

static void OnExitEventHostSynchronize(ze_event_host_synchronize_params_t *params,
ze_result_t result,
void *global_data,
void **instance_data) {
if (*(params->phEvent) != nullptr) {
ZeKernelCollector* collector =
reinterpret_cast<ZeKernelCollector*>(global_data);
PTI_ASSERT(collector != nullptr);
collector->ProcessCall(*(params->phEvent));
collector->ProcessCalls();
}
}

static void CreateEvent(ze_context_handle_t context,
ze_event_pool_handle_t& event_pool,
ze_event_handle_t& event) {
Expand Down

0 comments on commit 9ee0e46

Please sign in to comment.