Skip to content

Commit 1f6854e

Browse files
committed
Make command_submit = command_start = command_end for NOP
1 parent 066031d commit 1f6854e

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

sycl/source/detail/event_impl.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ event_impl::get_profiling_info<info::event_profiling::command_start>() {
348348
return get_event_profiling_info<info::event_profiling::command_start>(
349349
Handle, this->getAdapter());
350350
}
351-
return 0;
351+
// If command is nop (for example, USM operations for 0 bytes) return
352+
// recorded submission time. If event is created using default constructor,
353+
// 0 will be returned.
354+
return MSubmitTime;
352355
}
353356
if (!MHostProfilingInfo)
354357
throw sycl::exception(
@@ -367,7 +370,10 @@ uint64_t event_impl::get_profiling_info<info::event_profiling::command_end>() {
367370
return get_event_profiling_info<info::event_profiling::command_end>(
368371
Handle, this->getAdapter());
369372
}
370-
return 0;
373+
// If command is nop (for example, USM operations for 0 bytes) return
374+
// recorded submission time. If event is created using default constructor,
375+
// 0 will be returned.
376+
return MSubmitTime;
371377
}
372378
if (!MHostProfilingInfo)
373379
throw sycl::exception(

sycl/test-e2e/Regression/dummy_event_info.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ int main() {
1919
assert(e.get_info<info::event::command_execution_status>() ==
2020
info::event_command_status::complete);
2121
assert(e.get_info<info::event::reference_count>() == 0);
22-
assert(e.get_profiling_info<sycl::info::event_profiling::command_submit>() ==
23-
0);
24-
assert(e.get_profiling_info<sycl::info::event_profiling::command_start>() ==
25-
0);
26-
assert(e.get_profiling_info<sycl::info::event_profiling::command_end>() == 0);
22+
auto submit_time =
23+
e.get_profiling_info<sycl::info::event_profiling::command_submit>();
24+
auto start_time =
25+
e.get_profiling_info<sycl::info::event_profiling::command_start>();
26+
auto end_time =
27+
e.get_profiling_info<sycl::info::event_profiling::command_end>();
28+
29+
assert(submit_time == start_time);
30+
assert(start_time == end_time);
2731
}

0 commit comments

Comments
 (0)