Skip to content

[SYCL] Prevent fallback assert postprocessor being passed to CUDA and HIP devices #4604

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 5 commits into from
Oct 7, 2021
Merged
Changes from 2 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
35 changes: 20 additions & 15 deletions sycl/include/CL/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ class __SYCL_EXPORT queue {
event Event;

#if __SYCL_USE_FALLBACK_ASSERT
if (!is_host()) {
if (!is_host() && get_backend() != backend::cuda &&
get_backend() != backend::hip) {
auto PostProcess = [this, &CodeLoc](bool IsKernel, bool KernelUsesAssert,
event &E) {
if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) &&
Expand Down Expand Up @@ -289,22 +290,26 @@ 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 (get_backend() != backend::cuda && get_backend() != backend::hip) {
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);
}
};

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