Skip to content

Commit f9f3008

Browse files
committed
making stream::flush synchronous to avoid circular event dep
1 parent 8b2faa8 commit f9f3008

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

sycl/source/detail/stream_impl.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ void stream_impl::flush(const EventImplPtr &LeadEvent) {
116116
fflush(stdout);
117117
});
118118
});
119-
if (LeadEvent) {
120-
LeadEvent->attachEventToComplete(detail::getSyclObjImpl(Event));
121-
LeadEvent->getSubmittedQueue()->registerStreamServiceEvent(
122-
detail::getSyclObjImpl(Event));
123-
}
119+
Event.wait();
124120
}
125121

126122
void stream_impl::flush() { flush(nullptr); }

sycl/unittests/scheduler/CommandsWaitForEvents.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ TEST_F(SchedulerTest, StreamAUXCmdsWait) {
159159
[=]() { Out << "Hello, World!" << endl; });
160160
});
161161

162-
ASSERT_TRUE(QueueImplProxy->MStreamsServiceEvents.size() == 1)
163-
<< "Expected 1 service stream event";
162+
ASSERT_TRUE(QueueImplProxy->MStreamsServiceEvents.size() == 0)
163+
<< "Expected 0 service stream event";
164164

165165
std::shared_ptr<sycl::detail::event_impl> EventImpl =
166166
detail::getSyclObjImpl(Event);
167167

168168
auto EventImplProxy = std::static_pointer_cast<EventImplProxyT>(EventImpl);
169169

170-
ASSERT_TRUE(EventImplProxy->MPostCompleteEvents.size() == 1)
171-
<< "Expected 1 post complete event";
170+
ASSERT_TRUE(EventImplProxy->MPostCompleteEvents.size() == 0)
171+
<< "Expected 0 post complete event";
172172

173173
Q.wait();
174174

0 commit comments

Comments
 (0)