intel / intel/llvm

can we use time difference between two events?

Open
#6,514 14 comments 0 reactions 0 assignees View on GitHub
bug confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

copy from https://docs.oneapi.io/versions/latest/iface/event.html

Descriptor | Return type | Description
-- | -- | --
command_submit | cl_ulong | Time in nanoseconds when command_group was submitted
command_start | cl_ulong | Time in nanoseconds when command_group started execution
command_end | cl_ulong | Time in nanoseconds when command_group finished execution

"Time in nanoseconds" gives me the sense that it is an absolute time (it doesn't matter what the starting point is), so, I think it makes sense to use the time difference between two events as below pseudocode.
```
ycl::property_list properties{sycl::property::queue::enable_profiling(), sycl::property::queue::in_order()};
auto q = sycl::queue(sycl::gpu_selector(), properties);
...
q.wait();

auto e1 = q.ext_oneapi_submit_barrier();

// ... do what we need to queue workloads into sycl queue
foo();

auto e2 = q.ext_oneapi_submit_barrier();
e2.wait();

elapsed_time = e2.get_profiling_info() -
e1.get_profiling_info()
```

is elapsed_time (in pseudocode) the GPU time to execute foo()? thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.