Skip to content
Merged
Changes from 1 commit
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
16 changes: 13 additions & 3 deletions sycl/doc/extensions/proposed/sycl_ext_oneapi_clock.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ when the kernel is submitted to the queue.
== Overview

This extension introduces a new free function `clock(scope)`. This function
allows the user to sample the value from one of three clocks provided by compute
units, depending on the value of the scope argument. `scope` is an
allows the user to sample the value from one of three clocks provided by the
compute units, depending on the value of the scope argument. `scope` is an
enumeration constant of the new `clock_scope` enum. It should be passed to the
function to define the clock source; e.g., `clock(clock_scope::sub_group)`
samples the value from a clock shared by all work-items executing in the same
Expand All @@ -89,7 +89,8 @@ supports.
|Description

|1
|Initial version of this extension.
|The APIs of this experimental extension are not versioned, so the feature-test
macro always has this value.
|===

=== New device aspect
Expand Down Expand Up @@ -126,7 +127,16 @@ enum class clock_scope : /* unspecified */ {
work_group,
device
};
```

An enumerator from `clock_scope` should be passed to the `clock()` function to
define the clock source. There are 3 clock sources: `sub_group`, `work_group`
and `device`. Values from the first one (`sub_group`) are shared by all
work-items executing in the same sub-group. Values from the second one
(`work_group`) are are shared by all work-items executing in the same work-group
etc.

```c++
uint64_t clock(clock_scope scope = clock_scope::sub_group);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to use the clock() to implement the usleep(usecond) function in kernel? or just provide a device function usleep()? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no way to convert these clocks to seconds, so unfortunately the answer is no.


} // namespace sycl::ext::oneapi::experimental
Expand Down