Skip to content

Commit 7b8f3b5

Browse files
[SYCL] Use secondary queue in assert post-processing (intel#4759)
For submissions with a secondary queue the post-process lambda currently captures the secondary queue but does not pass it along. These changes uses the secondary queue if it is not a host queue. Signed-off-by: Steffen Larsen <[email protected]>
1 parent 2b0ebab commit 7b8f3b5

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

sycl/include/CL/sycl/queue.hpp

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -295,22 +295,31 @@ class __SYCL_EXPORT queue {
295295
event Event;
296296

297297
#if __SYCL_USE_FALLBACK_ASSERT
298-
auto PostProcess = [this, &SecondaryQueue, &CodeLoc](
299-
bool IsKernel, bool KernelUsesAssert, event &E) {
300-
if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) &&
301-
KernelUsesAssert) {
302-
// __devicelib_assert_fail isn't supported by Device-side Runtime
303-
// Linking against fallback impl of __devicelib_assert_fail is performed
304-
// by program manager class
305-
submitAssertCapture(*this, E, /* SecondaryQueue = */ nullptr, CodeLoc);
306-
}
307-
};
298+
if (!is_host()) {
299+
auto PostProcess = [this, &SecondaryQueue, &CodeLoc](
300+
bool IsKernel, bool KernelUsesAssert, event &E) {
301+
if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) &&
302+
KernelUsesAssert) {
303+
// Only secondary queues on devices need to be added to the assert
304+
// capture.
305+
// TODO: Handle case where primary queue is host but the secondary
306+
// queue is not.
307+
queue *DeviceSecondaryQueue =
308+
SecondaryQueue.is_host() ? nullptr : &SecondaryQueue;
309+
// __devicelib_assert_fail isn't supported by Device-side Runtime
310+
// Linking against fallback impl of __devicelib_assert_fail is
311+
// performed by program manager class
312+
submitAssertCapture(*this, E, DeviceSecondaryQueue, CodeLoc);
313+
}
314+
};
308315

309-
Event =
310-
submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc, PostProcess);
311-
#else
312-
Event = submit_impl(CGF, SecondaryQueue, CodeLoc);
316+
Event = submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc,
317+
PostProcess);
318+
} else
313319
#endif // __SYCL_USE_FALLBACK_ASSERT
320+
{
321+
Event = submit_impl(CGF, SecondaryQueue, CodeLoc);
322+
}
314323

315324
return Event;
316325
}

0 commit comments

Comments
 (0)