Skip to content

[SYCL] Make host task blocking and detach empty command. Part 1 #6995

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

Merged
merged 14 commits into from
Dec 13, 2022

Conversation

KseniyaTikhomirova
Copy link
Contributor

@KseniyaTikhomirova KseniyaTikhomirova commented Oct 7, 2022

It is intended to solve existing gap in implementation that kernel enqueue depending on host task via depends_on will wait for host task completion in its own enqueue. I want to change this approach and make it similar with the one we use when we have memory dependencies.
It also should help with cleanup process because now host task is represented with two instances - ExecCGCommand and EmptyCommand that introduces leaks in some scenarios.

Signed-off-by: Tikhomirova, Kseniya [email protected]

@hdelan
Copy link
Contributor

hdelan commented Oct 14, 2022

Could you give a brief description of what this PR is achieving and why it is needed? Thanks

@KseniyaTikhomirova
Copy link
Contributor Author

KseniyaTikhomirova commented Oct 14, 2022

Could you give a brief description of what this PR is achieving and why it is needed? Thanks

It is intended to solve existing gap in implementation that kernel enqueue depending on host task via depends_on will wait for host task completion in its own enqueue. I want to change this approach and make it similar with the one we use when we have memory dependencies.
It also should help with cleanup process because now host task is represented with two instances - ExecCGCommand and EmptyCommand that introduces leaks in some scenarios.

TO conclude this PR (not fully ready yet) has intension to:

  1. make command enqueue to not wait for host task completion in its enqueueImp and to be enqueued on host task completion -> holding read lock less, give a chance to the commands with different dependency stack to be enqueued earlier
  2. fix some memory leaks related to pair host task + empty task
  3. ideally to remove empty task at all as class

Please let me know if you need more details or have any concerns.

@KseniyaTikhomirova
Copy link
Contributor Author

fixes #7146

Signed-off-by: Tikhomirova, Kseniya <[email protected]>
@KseniyaTikhomirova KseniyaTikhomirova marked this pull request as ready for review December 11, 2022 19:42
@KseniyaTikhomirova KseniyaTikhomirova requested a review from a team as a code owner December 11, 2022 19:42
Copy link
Contributor

@sergey-semenov sergey-semenov left a comment

Choose a reason for hiding this comment

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

LGTM aside from some minor comments, feel free to apply separately.

return MEnqueueStatus == EnqueueResultT::SyclEnqueueBlocked;
return MIsBlockable && MEnqueueStatus == EnqueueResultT::SyclEnqueueBlocked;
}
// Shows thst command could be enqueud, but is blocking enqueue of all
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Shows thst command could be enqueud, but is blocking enqueue of all
// Shows that command could be enqueued, but is blocking enqueue of all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in e213e81

@@ -325,6 +337,14 @@ class Command {
/// Indicates that the node will be freed by cleanup after enqueue. Such nodes
/// should be ignored by other cleanup mechanisms.
bool MPostEnqueueCleanup = false;

/// Contains list of commands that depends on the host command explicitly (by
/// depends_on). Not involved into cleanup process since it is one-way link
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// depends_on). Not involved into cleanup process since it is one-way link
/// depends_on). Not involved in the cleanup process since it is one-way link

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in e213e81


/// Contains list of commands that depends on the host command explicitly (by
/// depends_on). Not involved into cleanup process since it is one-way link
/// and not holds resources.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// and not holds resources.
/// and does not hold resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in e213e81

BlockingT Blocking = NON_BLOCKING);

static bool handleBlockingCmd(Command *Cmd, EnqueueResultT &EnqueueResult,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment for this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in e213e81

Signed-off-by: Tikhomirova, Kseniya <[email protected]>
@KseniyaTikhomirova
Copy link
Contributor Author

KseniyaTikhomirova commented Dec 13, 2022

@intel/llvm-gatekeepers the change is ready for merge, sorry, closed PR by accident and should wait for checks again

@againull againull merged commit c44050a into intel:sycl Dec 13, 2022
@pvchupin
Copy link
Contributor

@aelovikov-intel
Copy link
Contributor

#7770, hopefully.

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.

6 participants