Skip to content

[SYCL] Use secondary queue in assert post-processing #4759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
37 changes: 23 additions & 14 deletions sycl/include/CL/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,22 +295,31 @@ class __SYCL_EXPORT queue {
event Event;

#if __SYCL_USE_FALLBACK_ASSERT
auto PostProcess = [this, &SecondaryQueue, &CodeLoc](
bool IsKernel, bool KernelUsesAssert, event &E) {
if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) &&
KernelUsesAssert) {
// __devicelib_assert_fail isn't supported by Device-side Runtime
// Linking against fallback impl of __devicelib_assert_fail is performed
// by program manager class
submitAssertCapture(*this, E, /* SecondaryQueue = */ nullptr, CodeLoc);
}
};
if (!is_host()) {
auto PostProcess = [this, &SecondaryQueue, &CodeLoc](
bool IsKernel, bool KernelUsesAssert, event &E) {
if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) &&
KernelUsesAssert) {
// Only secondary queues on devices need to be added to the assert
// capture.
// TODO: Handle case where primary queue is host but the secondary
// queue is not.
queue *DeviceSecondaryQueue =
SecondaryQueue.is_host() ? nullptr : &SecondaryQueue;
// __devicelib_assert_fail isn't supported by Device-side Runtime
// Linking against fallback impl of __devicelib_assert_fail is
// performed by program manager class
submitAssertCapture(*this, E, DeviceSecondaryQueue, CodeLoc);
}
};

Event =
submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc, PostProcess);
#else
Event = submit_impl(CGF, SecondaryQueue, CodeLoc);
Event = submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc,
PostProcess);
} else
#endif // __SYCL_USE_FALLBACK_ASSERT
{
Event = submit_impl(CGF, SecondaryQueue, CodeLoc);
}

return Event;
}
Expand Down