Skip to content

Conversation

againull
Copy link
Contributor

@againull againull commented May 28, 2025

Currently, we use std::chrono to record command_submit, command_start and command_end timestamps for host tasks. So, if there there is a mix of device tasks and host tasks submitted to the queue, they have different time base and inconvenient to use/compare. This PR makes host task timestamps to have the same time base as device tasks.

Currently, we use std::chrono to record  `command_submit`, `command_start`
and `command_end` timestamps for host tasks. So, if there there is a mix
of device tasks and host tasks submitted to the queue, they have a
different time base and inconvenient to use/compare.
This PR makes host task timestamps to have the same time base as device
tasks.
@againull againull force-pushed the host_task_time_base branch from 55afe43 to c79ef94 Compare May 28, 2025 19:25
@againull againull temporarily deployed to WindowsCILock May 28, 2025 19:25 — with GitHub Actions Inactive
@againull againull temporarily deployed to WindowsCILock May 28, 2025 19:52 — with GitHub Actions Inactive
@againull againull temporarily deployed to WindowsCILock May 28, 2025 19:52 — with GitHub Actions Inactive
@againull againull marked this pull request as ready for review May 28, 2025 22:25
@againull againull requested a review from a team as a code owner May 28, 2025 22:25
@againull againull requested a review from steffenlarsen May 28, 2025 22:25
const std::weak_ptr<queue_impl> &QueueWeakPtr) {
if (QueueImplPtr Queue = QueueWeakPtr.lock()) {
try {
return Queue->getDeviceImpl().getCurrentDeviceTime();
Copy link
Contributor

Choose a reason for hiding this comment

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

If all we need is the device, could it be safer to save a pointer to the device instead? Since devices don't change over the life of an application, we should not have to worry about it dying either, so we can avoid weak_ptr and locking.

Copy link
Contributor Author

@againull againull Jun 5, 2025

Choose a reason for hiding this comment

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

Sounds reasonable, I have changed it to store a pointer to the device.
Though it seems like the way how event_impl is constructed probably can be improved. Currently, at host task submission, event_impl is constructed with nullptr value for MQueue which is basically used to distinguish host and non-host task in the constructor. Then the queue where host task is submitted (MSubmittedQueue) is set via setSubmittedQueue. Probably better/safer to pass SubmittedQueue right at construction. That will also allow to get rid of setDevice in HostProfilingInfo and pass device at construction.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. We should avoid set*() functions that are meant for single-call initialization of members as much as possible.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM!

@againull
Copy link
Contributor Author

syclcompat/kernel/kernel_win.cpp failure is known: #17561

@againull againull merged commit c60a1fc into intel:sycl Jun 10, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants