Skip to content

[SYCL] Fix scheduler unit test: EnqueueNoMemObjDoubleKernelDepHostBlo… #7793

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 1 commit into from
Dec 16, 2022
Merged
Changes from all commits
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
7 changes: 4 additions & 3 deletions sycl/unittests/scheduler/EnqueueWithDependsOnDeps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ TEST_F(DependsOnTests, EnqueueNoMemObjDoubleKernelDepHostBlocked) {
// kernels on host task completion
std::vector<EventImplPtr> Events;

detail::Command *Cmd1 = AddTaskCG(TestCGType::HOST_TASK, Events);
detail::Command *Cmd1 =
AddTaskCG(TestCGType::HOST_TASK, Events, &CustomHostLambda);
Comment on lines +230 to +231
Copy link
Contributor

Choose a reason for hiding this comment

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

Do I get it right that the main purpose of CustomHostLambda is to prevent tests from running in parallel?

Copy link
Contributor Author

@KseniyaTikhomirova KseniyaTikhomirova Dec 16, 2022

Choose a reason for hiding this comment

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

no, it is used to block host task from its completion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

host task should block dependent kernels till its completion, I need to hold host task to check it. I do it with mutex I lock before host task submission and unlock after some intermediate checks. Than I wait till host task completion and check that kernels were enqueued.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

EventImplPtr Cmd1Event = Cmd1->getEvent();
Cmd1->MIsBlockable = true;
Cmd1->MEnqueueStatus = detail::EnqueueResultT::SyclEnqueueBlocked;
Expand Down Expand Up @@ -269,9 +270,9 @@ TEST_F(DependsOnTests, EnqueueNoMemObjDoubleKernelDepHost) {
// kernels on host task completion
std::vector<EventImplPtr> Events;

detail::Command *Cmd1 = AddTaskCG(TestCGType::HOST_TASK, Events);
detail::Command *Cmd1 =
AddTaskCG(TestCGType::HOST_TASK, Events, &CustomHostLambda);
EventImplPtr Cmd1Event = Cmd1->getEvent();
Cmd1->MEnqueueStatus = detail::EnqueueResultT::SyclEnqueueBlocked;

// Depends on host task
Events.push_back(Cmd1Event);
Expand Down