Skip to content

Commit 307380c

Browse files
committed
Revert "[SYCL] Remove secondary queue from submit info DS (#18045)"
This reverts commit 37fd1cc.
1 parent c04e5db commit 307380c

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

sycl/include/sycl/queue.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ class __SYCL_EXPORT SubmissionInfo {
8686
sycl::detail::optional<SubmitPostProcessF> &PostProcessorFunc();
8787
const sycl::detail::optional<SubmitPostProcessF> &PostProcessorFunc() const;
8888

89-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
9089
std::shared_ptr<detail::queue_impl> &SecondaryQueue();
9190
const std::shared_ptr<detail::queue_impl> &SecondaryQueue() const;
92-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
9391

9492
ext::oneapi::experimental::event_mode_enum &EventMode();
9593
const ext::oneapi::experimental::event_mode_enum &EventMode() const;
@@ -3620,11 +3618,13 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
36203618
template <bool UseFallbackAssert, typename PropertiesT>
36213619
event submit_with_event(
36223620
PropertiesT Props, const detail::type_erased_cgfo_ty &CGF,
3623-
[[maybe_unused]] queue *SecondaryQueuePtr,
3621+
queue *SecondaryQueuePtr,
36243622
const detail::code_location &CodeLoc = detail::code_location::current()) {
36253623
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
36263624
detail::SubmissionInfo SI{};
36273625
ProcessSubmitProperties(Props, SI);
3626+
if (SecondaryQueuePtr)
3627+
SI.SecondaryQueue() = detail::getSyclObjImpl(*SecondaryQueuePtr);
36283628
if constexpr (UseFallbackAssert)
36293629
SI.PostProcessorFunc() =
36303630
[this, &SecondaryQueuePtr,

sycl/source/detail/queue_impl.hpp

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ enum QueueOrder { Ordered, OOO };
7070
// Implementation of the submission information storage.
7171
struct SubmissionInfoImpl {
7272
optional<detail::SubmitPostProcessF> MPostProcessorFunc = std::nullopt;
73-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
7473
std::shared_ptr<detail::queue_impl> MSecondaryQueue = nullptr;
75-
#endif
7674
ext::oneapi::experimental::event_mode_enum MEventMode =
7775
ext::oneapi::experimental::event_mode_enum::none;
7876
};
@@ -342,11 +340,12 @@ class queue_impl {
342340
/// group is being enqueued on.
343341
event submit(const detail::type_erased_cgfo_ty &CGF,
344342
const std::shared_ptr<queue_impl> &Self,
345-
[[maybe_unused]] const std::shared_ptr<queue_impl> &SecondQueue,
343+
const std::shared_ptr<queue_impl> &SecondQueue,
346344
const detail::code_location &Loc, bool IsTopCodeLoc,
347345
const SubmitPostProcessF *PostProcess = nullptr) {
348346
event ResEvent;
349347
SubmissionInfo SI{};
348+
SI.SecondaryQueue() = SecondQueue;
350349
if (PostProcess)
351350
SI.PostProcessorFunc() = *PostProcess;
352351
return submit_with_event(CGF, Self, SI, Loc, IsTopCodeLoc);
@@ -365,6 +364,21 @@ class queue_impl {
365364
const std::shared_ptr<queue_impl> &Self,
366365
const SubmissionInfo &SubmitInfo,
367366
const detail::code_location &Loc, bool IsTopCodeLoc) {
367+
if (SubmitInfo.SecondaryQueue()) {
368+
event ResEvent;
369+
const std::shared_ptr<queue_impl> &SecondQueue =
370+
SubmitInfo.SecondaryQueue();
371+
try {
372+
ResEvent = submit_impl(CGF, Self, Self, SecondQueue,
373+
/*CallerNeedsEvent=*/true, Loc, IsTopCodeLoc,
374+
SubmitInfo);
375+
} catch (...) {
376+
ResEvent = SecondQueue->submit_impl(CGF, SecondQueue, Self, SecondQueue,
377+
/*CallerNeedsEvent=*/true, Loc,
378+
IsTopCodeLoc, SubmitInfo);
379+
}
380+
return ResEvent;
381+
}
368382
event ResEvent =
369383
submit_impl(CGF, Self, Self, nullptr,
370384
/*CallerNeedsEvent=*/true, Loc, IsTopCodeLoc, SubmitInfo);
@@ -376,8 +390,21 @@ class queue_impl {
376390
const SubmissionInfo &SubmitInfo,
377391
const detail::code_location &Loc,
378392
bool IsTopCodeLoc) {
379-
submit_impl(CGF, Self, Self, nullptr, /*CallerNeedsEvent=*/false, Loc,
380-
IsTopCodeLoc, SubmitInfo);
393+
if (SubmitInfo.SecondaryQueue()) {
394+
const std::shared_ptr<queue_impl> SecondQueue =
395+
SubmitInfo.SecondaryQueue();
396+
try {
397+
submit_impl(CGF, Self, Self, SecondQueue,
398+
/*CallerNeedsEvent=*/false, Loc, IsTopCodeLoc, SubmitInfo);
399+
} catch (...) {
400+
SecondQueue->submit_impl(CGF, SecondQueue, Self, SecondQueue,
401+
/*CallerNeedsEvent=*/false, Loc, IsTopCodeLoc,
402+
SubmitInfo);
403+
}
404+
} else {
405+
submit_impl(CGF, Self, Self, nullptr, /*CallerNeedsEvent=*/false, Loc,
406+
IsTopCodeLoc, SubmitInfo);
407+
}
381408
}
382409

383410
/// Performs a blocking wait for the completion of all enqueued tasks in the

sycl/source/queue.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const optional<SubmitPostProcessF> &SubmissionInfo::PostProcessorFunc() const {
3232
return impl->MPostProcessorFunc;
3333
}
3434

35-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
3635
std::shared_ptr<detail::queue_impl> &SubmissionInfo::SecondaryQueue() {
3736
return impl->MSecondaryQueue;
3837
}
@@ -41,7 +40,6 @@ const std::shared_ptr<detail::queue_impl> &
4140
SubmissionInfo::SecondaryQueue() const {
4241
return impl->MSecondaryQueue;
4342
}
44-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
4543

4644
ext::oneapi::experimental::event_mode_enum &SubmissionInfo::EventMode() {
4745
return impl->MEventMode;

0 commit comments

Comments
 (0)