-
Notifications
You must be signed in to change notification settings - Fork 787
[WIP][SYCL] update event profiling support with the new APIs. #2251
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2359,29 +2359,30 @@ pi_result piEventGetProfilingInfo(pi_event Event, pi_profiling_info ParamName, | |
size_t *ParamValueSizeRet) { | ||
|
||
assert(Event); | ||
uint64_t ZeTimerResolution = | ||
Event->Queue->Context->Device->ZeDeviceProperties.timerResolution; | ||
|
||
ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet); | ||
|
||
switch (ParamName) { | ||
case PI_PROFILING_INFO_COMMAND_START: { | ||
uint64_t ContextStart; | ||
ZE_CALL(zeEventGetTimestamp( | ||
Event->ZeEvent, ZE_EVENT_TIMESTAMP_CONTEXT_START, &ContextStart)); | ||
ContextStart *= ZeTimerResolution; | ||
return ReturnValue(uint64_t{ContextStart}); | ||
ze_kernel_timestamp_result_t* tsResult = nullptr; | ||
ZE_CALL(zeCommandListAppendQueryKernelTimestamps( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't see how this is going to achieve what's needed. It looks like these timestamp query should be appended around the command being profiled. Could you explain how this is working? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are requesting here in the host for the timestamp after execution has completed. We need to use |
||
Event->ZeCommandList, 1, &(Event->ZeEvent), tsResult, nullptr, nullptr, | ||
1, &(Event->ZeEvent))); | ||
return ReturnValue(*tsResult); | ||
} | ||
case PI_PROFILING_INFO_COMMAND_END: { | ||
uint64_t ContextEnd; | ||
ZE_CALL(zeEventGetTimestamp(Event->ZeEvent, ZE_EVENT_TIMESTAMP_CONTEXT_END, | ||
&ContextEnd)); | ||
ContextEnd *= ZeTimerResolution; | ||
return ReturnValue(uint64_t{ContextEnd}); | ||
ze_kernel_timestamp_result_t* tsResult = nullptr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be allocated, and different from the "start" memory, right? |
||
ZE_CALL(zeCommandListAppendQueryKernelTimestamps( | ||
Event->ZeCommandList, 1, &(Event->ZeEvent), tsResult, nullptr, nullptr, | ||
1, &(Event->ZeEvent))); | ||
return ReturnValue(*tsResult); | ||
} | ||
case PI_PROFILING_INFO_COMMAND_QUEUED: | ||
case PI_PROFILING_INFO_COMMAND_SUBMIT: | ||
// TODO: Support these when Level Zero supported is added. | ||
return ReturnValue(uint64_t{0}); | ||
uint64_t *tsResult; | ||
ZE_CALL(zeCommandListAppendWriteGlobalTimestamp( | ||
Event->ZeCommandList, tsResult, nullptr, 1, &(Event->ZeEvent))); | ||
return ReturnValue(*tsResult); | ||
default: | ||
zePrint("piEventGetProfilingInfo: not supported ParamName\n"); | ||
return PI_INVALID_VALUE; | ||
|
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.
why is this not allocated memory?