Skip to content

[SYCL] Don't use secondary queue for fallback #18188

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
Apr 25, 2025
Merged
Show file tree
Hide file tree
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
35 changes: 4 additions & 31 deletions sycl/source/detail/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,23 +364,9 @@ class queue_impl {
const std::shared_ptr<queue_impl> &Self,
const SubmissionInfo &SubmitInfo,
const detail::code_location &Loc, bool IsTopCodeLoc) {
if (SubmitInfo.SecondaryQueue()) {
event ResEvent;
const std::shared_ptr<queue_impl> &SecondQueue =
SubmitInfo.SecondaryQueue();
try {
ResEvent = submit_impl(CGF, Self, Self, SecondQueue,
/*CallerNeedsEvent=*/true, Loc, IsTopCodeLoc,
SubmitInfo);
} catch (...) {
ResEvent = SecondQueue->submit_impl(CGF, SecondQueue, Self, SecondQueue,
/*CallerNeedsEvent=*/true, Loc,
IsTopCodeLoc, SubmitInfo);
}
return ResEvent;
}

event ResEvent =
submit_impl(CGF, Self, Self, nullptr,
submit_impl(CGF, Self, Self, SubmitInfo.SecondaryQueue(),
/*CallerNeedsEvent=*/true, Loc, IsTopCodeLoc, SubmitInfo);
return discard_or_return(ResEvent);
}
Expand All @@ -390,21 +376,8 @@ class queue_impl {
const SubmissionInfo &SubmitInfo,
const detail::code_location &Loc,
bool IsTopCodeLoc) {
if (SubmitInfo.SecondaryQueue()) {
const std::shared_ptr<queue_impl> SecondQueue =
SubmitInfo.SecondaryQueue();
try {
submit_impl(CGF, Self, Self, SecondQueue,
/*CallerNeedsEvent=*/false, Loc, IsTopCodeLoc, SubmitInfo);
} catch (...) {
SecondQueue->submit_impl(CGF, SecondQueue, Self, SecondQueue,
/*CallerNeedsEvent=*/false, Loc, IsTopCodeLoc,
SubmitInfo);
}
} else {
submit_impl(CGF, Self, Self, nullptr, /*CallerNeedsEvent=*/false, Loc,
IsTopCodeLoc, SubmitInfo);
}
submit_impl(CGF, Self, Self, SubmitInfo.SecondaryQueue(),
/*CallerNeedsEvent=*/false, Loc, IsTopCodeLoc, SubmitInfo);
}

/// Performs a blocking wait for the completion of all enqueued tasks in the
Expand Down
38 changes: 16 additions & 22 deletions sycl/source/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1928,34 +1928,28 @@ void handler::verifyDeviceHasProgressGuarantee(
}

bool handler::supportsUSMMemcpy2D() {
for (detail::queue_impl *QueueImpl :
{impl->MSubmissionPrimaryQueue, impl->MSubmissionSecondaryQueue}) {
if (QueueImpl &&
!checkContextSupports(QueueImpl->getContextImplPtr(),
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT))
return false;
}
return true;
auto &PrimQueue = impl->MSubmissionPrimaryQueue;
if (PrimQueue)
return checkContextSupports(PrimQueue->getContextImplPtr(),
UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT);
else
// Return true when handler_impl is constructed with a graph.
return true;
}

bool handler::supportsUSMFill2D() {
for (detail::queue_impl *QueueImpl :
{impl->MSubmissionPrimaryQueue, impl->MSubmissionSecondaryQueue}) {
if (QueueImpl && !checkContextSupports(QueueImpl->getContextImplPtr(),
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT))
return false;
}
return true;
auto &PrimQueue = impl->MSubmissionPrimaryQueue;
if (PrimQueue)
return checkContextSupports(PrimQueue->getContextImplPtr(),
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT);
else
// Return true when handler_impl is constructed with a graph.
return true;
}

bool handler::supportsUSMMemset2D() {
for (detail::queue_impl *QueueImpl :
{impl->MSubmissionPrimaryQueue, impl->MSubmissionSecondaryQueue}) {
if (QueueImpl && !checkContextSupports(QueueImpl->getContextImplPtr(),
UR_CONTEXT_INFO_USM_FILL2D_SUPPORT))
return false;
}
return true;
// memset use the same UR check as fill2D.
return supportsUSMFill2D();
}

id<2> handler::computeFallbackKernelBounds(size_t Width, size_t Height) {
Expand Down