Skip to content

Commit

Permalink
GPU event query & sync APIs (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
abagusetty authored Aug 24, 2023
1 parent 1f04172 commit 3b71eee
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/tamm/gpu_streams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,28 @@ static void gpuMemcpyAsync(T* dst, const T* src, size_t count, gpuMemcpyKind kin
#endif
}

static inline bool gpuEventQuery(gpuEvent_t event) {
#if defined(USE_DPCPP)
(event.get_info<sycl::info::event::command_execution_status>() ==
sycl::info::event_command_status::complete);
#elif defined(USE_HIP)
(hipEventQuery(event) == hipSuccess);
#elif defined(USE_CUDA)
(cudaEventQuery(event) == cudaSuccess);
#endif
}

static inline void gpuEventSynchronize(gpuEvent_t event) {
#if defined(USE_DPCPP)
event.wait();
#elif defined(USE_HIP)
hipEventSynchronize(event);
#elif defined(USE_CUDA)
cudaEventSynchronize(event);
#endif
}


class GPUStreamPool {
protected:
bool _initialized{false};
Expand Down

0 comments on commit 3b71eee

Please sign in to comment.