diff --git a/sycl/source/detail/event_impl.cpp b/sycl/source/detail/event_impl.cpp index 6689c779eefff..f6d41c3878584 100644 --- a/sycl/source/detail/event_impl.cpp +++ b/sycl/source/detail/event_impl.cpp @@ -226,8 +226,13 @@ template <> cl_ulong event_impl::get_profiling_info() const { if (!MHostEvent) { - return get_event_profiling_info::get( - this->getHandleRef(), this->getPlugin()); + if (MEvent) + return get_event_profiling_info< + info::event_profiling::command_submit>::get(this->getHandleRef(), + this->getPlugin()); + // TODO this should throw an exception if the queue the dummy event is + // bound to does not support profiling info. + return 0; } if (!MHostProfilingInfo) throw invalid_object_error("Profiling info is not available.", @@ -239,8 +244,13 @@ template <> cl_ulong event_impl::get_profiling_info() const { if (!MHostEvent) { - return get_event_profiling_info::get( - this->getHandleRef(), this->getPlugin()); + if (MEvent) + return get_event_profiling_info< + info::event_profiling::command_start>::get(this->getHandleRef(), + this->getPlugin()); + // TODO this should throw an exception if the queue the dummy event is + // bound to does not support profiling info. + return 0; } if (!MHostProfilingInfo) throw invalid_object_error("Profiling info is not available.", @@ -252,8 +262,12 @@ template <> cl_ulong event_impl::get_profiling_info() const { if (!MHostEvent) { - return get_event_profiling_info::get( - this->getHandleRef(), this->getPlugin()); + if (MEvent) + return get_event_profiling_info::get( + this->getHandleRef(), this->getPlugin()); + // TODO this should throw an exception if the queue the dummy event is + // bound to does not support profiling info. + return 0; } if (!MHostProfilingInfo) throw invalid_object_error("Profiling info is not available.", @@ -262,7 +276,7 @@ event_impl::get_profiling_info() const { } template <> cl_uint event_impl::get_info() const { - if (!MHostEvent) { + if (!MHostEvent && MEvent) { return get_event_info::get( this->getHandleRef(), this->getPlugin()); } @@ -272,7 +286,7 @@ template <> cl_uint event_impl::get_info() const { template <> info::event_command_status event_impl::get_info() const { - if (!MHostEvent) { + if (!MHostEvent && MEvent) { return get_event_info::get( this->getHandleRef(), this->getPlugin()); }