Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Lock mutex only for critical region in interop-level-zero-thread.cpp #1418

Merged
merged 4 commits into from
Nov 28, 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
18 changes: 11 additions & 7 deletions SYCL/Plugin/interop-level-zero-thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,19 @@ ze_event_handle_t getEvent() {
}

void worker() {
std::unique_lock<std::mutex> lk(mt);

while (true) {
cv.wait(lk, []() { return ops.size() > 0 || stop_worker; });
if (stop_worker)
return;
auto op = ops.front();
ops.pop_front();

operation op;
{

std::unique_lock<std::mutex> lk(mt);
cv.wait(lk, []() { return ops.size() > 0 || stop_worker; });
if (stop_worker)
return;

op = ops.front();
ops.pop_front();
}
for (auto dep : op.deps) {
// Wait for dependencies to complete
while (dep.get_info<sycl::info::event::command_execution_status>() !=
Expand Down