@@ -72,20 +72,6 @@ pi_result redefinedEventsWait(pi_uint32 num_events,
72
72
pi_result redefinedEventGetInfo (pi_event event, pi_event_info param_name,
73
73
size_t param_value_size, void *param_value,
74
74
size_t *param_value_size_ret) {
75
- #if 0
76
- EXPECT_EQ(param_name, PI_EVENT_INFO_COMMAND_EXECUTION_STATUS)
77
- << "Unexpected event info requested";
78
- // Report first half of events as complete.
79
- // Report second half of events as running.
80
- // This is important, because removal algorithm assumes that
81
- // events are likely to be removed oldest first, and stops removing
82
- // at the first non-completed event.
83
- static int Counter = 0;
84
- auto *Result = reinterpret_cast<pi_event_status *>(param_value);
85
- *Result = (Counter < (ExpectedEventThreshold / 2)) ? PI_EVENT_COMPLETE
86
- : PI_EVENT_RUNNING;
87
- Counter++;
88
- #endif
89
75
return PI_SUCCESS;
90
76
}
91
77
@@ -127,7 +113,7 @@ bool preparePiMock(platform &Plt) {
127
113
return true ;
128
114
}
129
115
130
- TEST (QueueWait, Finish ) {
116
+ TEST (QueueWait, QueueWaitTest ) {
131
117
platform Plt{default_selector ()};
132
118
if (!preparePiMock (Plt))
133
119
return ;
@@ -161,38 +147,40 @@ TEST(QueueWait, Finish) {
161
147
}
162
148
163
149
// Blocked commands
164
- TestContext = {};
165
- buffer<int , 1 > buf{range<1 >(1 )};
166
- event HostTaskEvent = Q.submit ([&](handler &Cgh) {
167
- auto acc = buf.template get_access <access::mode::read>(Cgh);
168
- Cgh.host_task ([=]() { (void )acc; });
169
- });
170
- std::shared_ptr<detail::event_impl> HostTaskEventImpl =
171
- detail::getSyclObjImpl (HostTaskEvent);
172
- auto *Cmd = static_cast <detail::Command *>(HostTaskEventImpl->getCommand ());
173
- detail::Command *EmptyTask = *Cmd->MUsers .begin ();
174
- ASSERT_EQ (EmptyTask->getType (), detail::Command::EMPTY_TASK);
175
- HostTaskEvent.wait ();
176
- // Use the empty task produced by the host task to block the next commands
177
- while (EmptyTask->MEnqueueStatus !=
178
- detail::EnqueueResultT::SyclEnqueueSuccess)
179
- continue ;
180
- EmptyTask->MEnqueueStatus = detail::EnqueueResultT::SyclEnqueueBlocked;
181
- Q.submit ([&](handler &Cgh) {
182
- auto acc = buf.template get_access <access::mode::discard_write>(Cgh);
183
- Cgh.fill (acc, 42 );
184
- });
185
- Q.submit ([&](handler &Cgh) {
186
- auto acc = buf.template get_access <access::mode::discard_write>(Cgh);
187
- Cgh.fill (acc, 42 );
188
- });
189
- // Unblock the empty task to allow the submitted events to complete once
190
- // enqueued.
191
- EmptyTask->MEnqueueStatus = detail::EnqueueResultT::SyclEnqueueSuccess;
192
- Q.wait ();
193
- // Only a single event (the last one) should be waited for here.
194
- ASSERT_EQ (TestContext.NEventsWaitedFor , 1 );
195
- ASSERT_TRUE (TestContext.PiQueueFinishCalled );
150
+ {
151
+ TestContext = {};
152
+ buffer<int , 1 > buf{range<1 >(1 )};
153
+ event HostTaskEvent = Q.submit ([&](handler &Cgh) {
154
+ auto acc = buf.template get_access <access::mode::read>(Cgh);
155
+ Cgh.host_task ([=]() { (void )acc; });
156
+ });
157
+ std::shared_ptr<detail::event_impl> HostTaskEventImpl =
158
+ detail::getSyclObjImpl (HostTaskEvent);
159
+ auto *Cmd = static_cast <detail::Command *>(HostTaskEventImpl->getCommand ());
160
+ detail::Command *EmptyTask = *Cmd->MUsers .begin ();
161
+ ASSERT_EQ (EmptyTask->getType (), detail::Command::EMPTY_TASK);
162
+ HostTaskEvent.wait ();
163
+ // Use the empty task produced by the host task to block the next commands
164
+ while (EmptyTask->MEnqueueStatus !=
165
+ detail::EnqueueResultT::SyclEnqueueSuccess)
166
+ continue ;
167
+ EmptyTask->MEnqueueStatus = detail::EnqueueResultT::SyclEnqueueBlocked;
168
+ Q.submit ([&](handler &Cgh) {
169
+ auto acc = buf.template get_access <access::mode::discard_write>(Cgh);
170
+ Cgh.fill (acc, 42 );
171
+ });
172
+ Q.submit ([&](handler &Cgh) {
173
+ auto acc = buf.template get_access <access::mode::discard_write>(Cgh);
174
+ Cgh.fill (acc, 42 );
175
+ });
176
+ // Unblock the empty task to allow the submitted events to complete once
177
+ // enqueued.
178
+ EmptyTask->MEnqueueStatus = detail::EnqueueResultT::SyclEnqueueSuccess;
179
+ Q.wait ();
180
+ // Only a single event (the last one) should be waited for here.
181
+ ASSERT_EQ (TestContext.NEventsWaitedFor , 1 );
182
+ ASSERT_TRUE (TestContext.PiQueueFinishCalled );
183
+ }
196
184
197
185
// Test behaviour for emulating an OOO queue with multiple in-order ones.
198
186
TestContext = {};
0 commit comments