Skip to content
Open
Show file tree
Hide file tree
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: 14 additions & 4 deletions sycl/source/detail/device_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2318,10 +2318,20 @@ class device_impl {
void unregisterQueue(queue_impl *Q) {
std::lock_guard<std::mutex> Lock(MQueuesMutex);
auto It = std::find(MQueues.begin(), MQueues.end(), Q);
assert(It != MQueues.end() && "Queue not found in device's queue list");
// Swap with last element and pop — O(1) removal, order doesn't matter.
std::swap(*It, MQueues.back());
MQueues.pop_back();

// device_impl can be destroyed before queue_impl in unittests.
// On Windows, unittests involving host tasks race with scheduler
// cleanup (invoked by ~UrMock). UrMock constructor destroys the
// platform cache, along with device_impl. Now, when two unittests
// involving host tasks run one after another, URMock destructor of
// first can race with URMock constructor of second, causing device_impl
// to not have registered queue.
if (It != MQueues.end()) {
// Swap with last element and pop — O(1) removal,
// order doesn't matter.
std::swap(*It, MQueues.back());
MQueues.pop_back();
}
}

private:
Expand Down
5 changes: 0 additions & 5 deletions sycl/unittests/scheduler/InOrderQueueHostTaskDeps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,7 @@ TEST_F(SchedulerTest, InOrderQueueCrossDeps) {
EXPECT_EQ(std::get<1>(ExecutedCommands[2]) /*EventsCount*/, 0u);
}

#ifdef _WIN32
// https://github.com/intel/llvm/issues/22412
TEST_F(SchedulerTest, DISABLED_InOrderQueueCrossDepsShortcutFuncs) {
#else
TEST_F(SchedulerTest, InOrderQueueCrossDepsShortcutFuncs) {
#endif
ExecutedCommands.clear();
sycl::unittest::UrMock<> Mock;
mock::getCallbacks().set_before_callback(
Expand Down
Loading