Skip to content

[SYCL] Fix event info queries for dummy non-host events #3424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,13 @@ template <>
cl_ulong
event_impl::get_profiling_info<info::event_profiling::command_submit>() const {
if (!MHostEvent) {
return get_event_profiling_info<info::event_profiling::command_submit>::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.",
Expand All @@ -239,8 +244,13 @@ template <>
cl_ulong
event_impl::get_profiling_info<info::event_profiling::command_start>() const {
if (!MHostEvent) {
return get_event_profiling_info<info::event_profiling::command_start>::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.",
Expand All @@ -252,8 +262,12 @@ template <>
cl_ulong
event_impl::get_profiling_info<info::event_profiling::command_end>() const {
if (!MHostEvent) {
return get_event_profiling_info<info::event_profiling::command_end>::get(
this->getHandleRef(), this->getPlugin());
if (MEvent)
return get_event_profiling_info<info::event_profiling::command_end>::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.",
Expand All @@ -262,7 +276,7 @@ event_impl::get_profiling_info<info::event_profiling::command_end>() const {
}

template <> cl_uint event_impl::get_info<info::event::reference_count>() const {
if (!MHostEvent) {
if (!MHostEvent && MEvent) {
return get_event_info<info::event::reference_count>::get(
this->getHandleRef(), this->getPlugin());
}
Expand All @@ -272,7 +286,7 @@ template <> cl_uint event_impl::get_info<info::event::reference_count>() const {
template <>
info::event_command_status
event_impl::get_info<info::event::command_execution_status>() const {
if (!MHostEvent) {
if (!MHostEvent && MEvent) {
return get_event_info<info::event::command_execution_status>::get(
this->getHandleRef(), this->getPlugin());
}
Expand Down