-
Notifications
You must be signed in to change notification settings - Fork 116
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
[UR][L0][CUDA][HIP] Add enqueue timestamp recording extension #1400
Merged
Merged
Changes from 8 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
9aceab4
Add enqueue timestamp recording extension
steffenlarsen 578f347
Address comments
steffenlarsen b7b0a6f
Revert CUDA change
steffenlarsen e08bf52
Correctly enable recordings in HIP and CUDA for timestamp events
steffenlarsen bf5ea14
Fix use of event handle
steffenlarsen 206c4b1
Fix faulty disjunction
steffenlarsen b690920
Fix faulty disjunction 2
steffenlarsen 5db5ba8
Allow event creation to record timing for events
steffenlarsen 2f0e050
Address comments
steffenlarsen 32abd74
Merge branch 'main' into steffen/record_event
steffenlarsen 4261d04
Merge branch 'main' into steffen/record_event
steffenlarsen 5caceaf
Amend comments
steffenlarsen 0a958b3
Merge branch 'main' into steffen/record_event
steffenlarsen 0dd1815
Merge remote-tracking branch 'intel/main' into steffen/record_event
steffenlarsen d5aaba0
Fix merge mistake
steffenlarsen 5cdc724
Merge branch 'main' into steffen/record_event
steffenlarsen e7f496d
Merge branch 'main' into steffen/record_event
steffenlarsen 5fd441e
Move timestamp query to after commandlist get
steffenlarsen 2404fe6
Stop making new heap allocations for each recording
steffenlarsen be01218
Merge remote-tracking branch 'intel/main' into steffen/record_event
steffenlarsen 73de142
Fix diff
steffenlarsen 4a855ca
Merge remote-tracking branch 'intel/main' into steffen/record_event
steffenlarsen 4f0bf8c
Fix diff
steffenlarsen f7fe03e
Merge branch 'main' into steffen/record_event
steffenlarsen ecb6a82
Remove old use of urPrint
steffenlarsen cf13442
Merge branch 'main' into steffen/record_event
steffenlarsen c804856
Merge remote-tracking branch 'intel/main' into steffen/record_event
steffenlarsen 308f1dd
Merge remote-tracking branch 'intel/main' into steffen/record_event
steffenlarsen 06432bf
Remove trailing ws
steffenlarsen 84bad6c
Add wait-list to get-command-list
steffenlarsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<% | ||
OneApi=tags['$OneApi'] | ||
x=tags['$x'] | ||
X=x.upper() | ||
%> | ||
|
||
.. _experimental-enqueue-timestamp-recording: | ||
|
||
================================================================================ | ||
Enqueue Timestamp Recording | ||
================================================================================ | ||
|
||
.. warning:: | ||
|
||
Experimental features: | ||
|
||
* May be replaced, updated, or removed at any time. | ||
* Do not require maintaining API/ABI stability of their own additions over | ||
time. | ||
* Do not require conformance testing of their own additions. | ||
|
||
|
||
Motivation | ||
-------------------------------------------------------------------------------- | ||
Currently, the only way to get timestamp information is through enabling | ||
profiling on a queue and retrieve the information from events coming from | ||
steffenlarsen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
commands submitted to it. However, not all systems give full control of the | ||
queue construction to the programmer wanting the profiling information. To amend | ||
this, this extension adds the ability to enqueue a timestamp recording on any | ||
queue, with or without profiling enabled. This event can in turn be queried for | ||
the usual profiling information. | ||
|
||
|
||
API | ||
-------------------------------------------------------------------------------- | ||
|
||
Enums | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
* ${x}_device_info_t | ||
* ${X}_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP | ||
|
||
* ${x}_command_t | ||
* ${X}_COMMAND_TIMESTAMP_RECORDING_EXP | ||
|
||
Functions | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* ${x}EnqueueTimestampRecordingExp | ||
|
||
Changelog | ||
-------------------------------------------------------------------------------- | ||
|
||
+-----------+------------------------+ | ||
| Revision | Changes | | ||
+===========+========================+ | ||
| 1.0 | Initial Draft | | ||
+-----------+------------------------+ | ||
|
||
|
||
Support | ||
-------------------------------------------------------------------------------- | ||
|
||
Adapters which support this experimental feature *must* return true for the new | ||
`${X}_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP` device info query. | ||
|
||
|
||
Contributors | ||
-------------------------------------------------------------------------------- | ||
|
||
* Steffen Larsen `steffen.larsen@intel.com <steffen.larsen@intel.com>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# | ||
# Copyright (C) 2024 Intel Corporation | ||
# | ||
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See LICENSE.TXT | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# See YaML.md for syntax definition | ||
# | ||
--- #-------------------------------------------------------------------------- | ||
type: header | ||
desc: "Intel $OneApi Unified Runtime Experimental APIs for enqueuing timestamp recordings" | ||
ordinal: "99" | ||
--- #-------------------------------------------------------------------------- | ||
type: enum | ||
extend: true | ||
typed_etors: true | ||
desc: "Extension enums to $x_device_info_t to support timestamp recordings." | ||
name: $x_device_info_t | ||
etors: | ||
- name: TIMESTAMP_RECORDING_SUPPORT_EXP | ||
value: "0x2010" | ||
desc: "[$x_bool_t] returns true if the device supports timestamp recording" | ||
--- #-------------------------------------------------------------------------- | ||
type: enum | ||
extend: true | ||
desc: "Command Type experimental enumerations." | ||
name: $x_command_t | ||
etors: | ||
- name: TIMESTAMP_RECORDING_EXP | ||
value: "0x2002" | ||
desc: Event created by $xEnqueueTimestampRecordingExp | ||
--- #-------------------------------------------------------------------------- | ||
type: function | ||
desc: "Enqueue a command for recording the device timestamp" | ||
class: $xEnqueue | ||
name: TimestampRecordingExp | ||
params: | ||
- type: $x_queue_handle_t | ||
name: hQueue | ||
desc: "[in] handle of the queue object" | ||
- type: bool | ||
name: blocking | ||
desc: | | ||
[in] indicates whether the call to this function should block until | ||
until the device timestamp recording command has executed on the | ||
device. | ||
- type: uint32_t | ||
name: numEventsInWaitList | ||
desc: "[in] size of the event wait list" | ||
- type: "const $x_event_handle_t*" | ||
name: phEventWaitList | ||
desc: | | ||
[in][optional][range(0, numEventsInWaitList)] pointer to a list of events that must be complete before the kernel execution. | ||
If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. | ||
steffenlarsen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- type: $x_event_handle_t* | ||
name: phEvent | ||
desc: | | ||
[in,out] return an event object that identifies this particular kernel execution instance. Profiling information can be queried | ||
from this event as if `hQueue` had profiling enabled. Querying `UR_PROFILING_INFO_COMMAND_QUEUED` or `UR_PROFILING_INFO_COMMAND_SUBMIT` | ||
reports the timestamp at the time of the call to this function. Querying `UR_PROFILING_INFO_COMMAND_START` or `UR_PROFILING_INFO_COMMAND_END` | ||
reports the timestamp recorded when the command is executed on the device. | ||
returns: | ||
- $X_RESULT_ERROR_INVALID_NULL_HANDLE | ||
- $X_RESULT_ERROR_INVALID_NULL_POINTER | ||
- $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking you meant to delete this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it needs to be the last enumerator, as it's saying any value after that will result in
UR_RESULT_ERROR_INVALID_ENUMERATION
. I was skeptical at first too, but the generated script diff check insisted.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is the generator making the change. It's expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could probably be a bit more clever to do proper validation of the enum ranges.