diff --git a/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp b/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp index 36f14b23845c1..1eec3af28d7a5 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp @@ -109,7 +109,7 @@ event submit_with_event_impl(const queue &Q, PropertiesT Props, CommandGroupFunc &&CGF, const sycl::detail::code_location &CodeLoc) { return Q.submit_with_event<__SYCL_USE_FALLBACK_ASSERT>( - Props, detail::type_erased_cgfo_ty{CGF}, nullptr, CodeLoc); + Props, detail::type_erased_cgfo_ty{CGF}, CodeLoc); } } // namespace detail diff --git a/sycl/include/sycl/queue.hpp b/sycl/include/sycl/queue.hpp index a0dbdf5c540e8..36006ac341bb6 100644 --- a/sycl/include/sycl/queue.hpp +++ b/sycl/include/sycl/queue.hpp @@ -66,7 +66,7 @@ auto get_native(const SyclObjectT &Obj) namespace detail { class queue_impl; -inline event submitAssertCapture(const queue &, event &, queue *, +inline event submitAssertCapture(const queue &, event &, const detail::code_location &); // Function to postprocess submitted command @@ -87,8 +87,10 @@ class __SYCL_EXPORT SubmissionInfo { sycl::detail::optional &PostProcessorFunc(); const sycl::detail::optional &PostProcessorFunc() const; +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES std::shared_ptr &SecondaryQueue(); const std::shared_ptr &SecondaryQueue() const; +#endif ext::oneapi::experimental::event_mode_enum &EventMode(); const ext::oneapi::experimental::event_mode_enum &EventMode() const; @@ -434,21 +436,18 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { /// Submits a command group function object to the queue, in order to be /// scheduled for execution on the device. /// - /// On a kernel error, this command group function object is then scheduled - /// for execution on a secondary queue. - /// /// \param CGF is a function object containing command group. - /// \param SecondaryQueue is a fallback SYCL queue. + /// \param SecondaryQueue is a fallback SYCL queue. (unused) /// \param CodeLoc is the code location of the submit call (default argument) /// \return a SYCL event object, which corresponds to the queue the command /// group is being enqueued on. template std::enable_if_t, event> submit( - T CGF, queue &SecondaryQueue, + T CGF, [[maybe_unused]] queue &SecondaryQueue, const detail::code_location &CodeLoc = detail::code_location::current()) { return submit_with_event<__SYCL_USE_FALLBACK_ASSERT>( sycl::ext::oneapi::experimental::empty_properties_t{}, - detail::type_erased_cgfo_ty{CGF}, &SecondaryQueue, CodeLoc); + detail::type_erased_cgfo_ty{CGF}, CodeLoc); } /// Prevents any commands submitted afterward to this queue from executing @@ -3582,7 +3581,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { -> backend_return_t; #if __SYCL_USE_FALLBACK_ASSERT - friend event detail::submitAssertCapture(const queue &, event &, queue *, + friend event detail::submitAssertCapture(const queue &, event &, const detail::code_location &); #endif @@ -3686,47 +3685,6 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { const detail::code_location &CodeLoc, bool IsTopCodeLoc) const; - /// Submits a command group function object to the queue, in order to be - /// scheduled for execution on the device. - /// - /// \param Props is a property list with submission properties. - /// \param CGF is a function object containing command group. - /// \param SecondaryQueuePtr is a pointer to the secondary queue. - /// \param CodeLoc is the code location of the submit call (default argument) - /// \return a SYCL event object for the submitted command group. - // - // UseFallBackAssert as template param vs `#if` in function body is necessary - // to prevent ODR-violation between TUs built with different fallback assert - // modes. - template - event submit_with_event(PropertiesT Props, - const detail::type_erased_cgfo_ty &CGF, - queue *SecondaryQueuePtr, - const detail::code_location &CodeLoc = - detail::code_location::current()) const { - detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); - detail::v1::SubmissionInfo SI{}; - ProcessSubmitProperties(Props, SI); - if (SecondaryQueuePtr) - SI.SecondaryQueue() = detail::getSyclObjImpl(*SecondaryQueuePtr); - if constexpr (UseFallbackAssert) - SI.PostProcessorFunc() = - [this, &SecondaryQueuePtr, - &TlsCodeLocCapture](bool IsKernel, bool KernelUsesAssert, event &E) { - if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) && - KernelUsesAssert && !device_has(aspect::accelerator)) { - // __devicelib_assert_fail isn't supported by Device-side Runtime - // Linking against fallback impl of __devicelib_assert_fail is - // performed by program manager class - // Fallback assert isn't supported for FPGA - submitAssertCapture(*this, E, SecondaryQueuePtr, - TlsCodeLocCapture.query()); - } - }; - return submit_with_event_impl(CGF, SI, TlsCodeLocCapture.query(), - TlsCodeLocCapture.isToplevel()); - } - /// Submits a command group function object to the queue, in order to be /// scheduled for execution on the device. /// @@ -3756,7 +3714,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { // Linking against fallback impl of __devicelib_assert_fail is // performed by program manager class // Fallback assert isn't supported for FPGA - submitAssertCapture(*this, E, nullptr, TlsCodeLocCapture.query()); + submitAssertCapture(*this, E, TlsCodeLocCapture.query()); } }; return submit_with_event_impl(CGF, SI, TlsCodeLocCapture.query(), @@ -3955,7 +3913,6 @@ class AssertInfoCopier; * Submit copy task for assert failure flag and host-task to check the flag * \param Event kernel's event to depend on i.e. the event represents the * kernel to check for assertion failure - * \param SecondaryQueue secondary queue for submit process, null if not used * \returns host tasks event * * This method doesn't belong to queue class to overcome msvc behaviour due to @@ -3963,7 +3920,6 @@ class AssertInfoCopier; * with no proper KernelInfo instance. */ event submitAssertCapture(const queue &Self, event &Event, - queue *SecondaryQueue, const detail::code_location &CodeLoc) { buffer Buffer{1}; @@ -4019,10 +3975,10 @@ event submitAssertCapture(const queue &Self, event &Event, CopierEv = Self.submit_with_event( sycl::ext::oneapi::experimental::empty_properties_t{}, CopierCGF, - SecondaryQueue, CodeLoc); + CodeLoc); CheckerEv = Self.submit_with_event( sycl::ext::oneapi::experimental::empty_properties_t{}, CheckerCGF, - SecondaryQueue, CodeLoc); + CodeLoc); return CheckerEv; } diff --git a/sycl/source/detail/handler_impl.hpp b/sycl/source/detail/handler_impl.hpp index 23ce36d691dc2..edf32dfa80f7e 100644 --- a/sycl/source/detail/handler_impl.hpp +++ b/sycl/source/detail/handler_impl.hpp @@ -31,10 +31,8 @@ enum class HandlerSubmissionState : std::uint8_t { class handler_impl { public: - handler_impl(queue_impl &Queue, queue_impl *SubmissionSecondaryQueue, - bool EventNeeded) - : MSubmissionSecondaryQueue(SubmissionSecondaryQueue), - MEventNeeded(EventNeeded), MQueueOrGraph{Queue} {}; + handler_impl(queue_impl &Queue, bool EventNeeded) + : MEventNeeded(EventNeeded), MQueueOrGraph{Queue} {}; handler_impl(ext::oneapi::experimental::detail::graph_impl &Graph) : MQueueOrGraph{Graph} {} @@ -65,10 +63,6 @@ class handler_impl { /// Registers mutually exclusive submission states. HandlerSubmissionState MSubmissionState = HandlerSubmissionState::NO_STATE; - /// Pointer to the secondary queue implementation. Nullptr if no - /// secondary queue fallback was given in the associated submission. - queue_impl *MSubmissionSecondaryQueue = nullptr; - /// Bool stores information about whether the event resulting from the /// corresponding work is required. bool MEventNeeded = true; diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index 24ed44b219e3a..64e10651602fe 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -304,14 +304,14 @@ void queue_impl::addEvent(const detail::EventImplPtr &EventImpl) { detail::EventImplPtr queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF, - queue_impl *SecondaryQueue, bool CallerNeedsEvent, - const detail::code_location &Loc, bool IsTopCodeLoc, + bool CallerNeedsEvent, const detail::code_location &Loc, + bool IsTopCodeLoc, const v1::SubmissionInfo &SubmitInfo) { #ifdef __INTEL_PREVIEW_BREAKING_CHANGES - detail::handler_impl HandlerImplVal(*this, SecondaryQueue, CallerNeedsEvent); + detail::handler_impl HandlerImplVal(*this, CallerNeedsEvent); handler Handler(HandlerImplVal); #else - handler Handler(shared_from_this(), SecondaryQueue, CallerNeedsEvent); + handler Handler(shared_from_this(), CallerNeedsEvent); #endif detail::handler_impl &HandlerImpl = *detail::getSyclObjImpl(Handler); @@ -390,8 +390,8 @@ queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF, Stream->generateFlushCommand(ServiceCGH); }; detail::type_erased_cgfo_ty CGF{L}; - detail::EventImplPtr FlushEvent = submit_impl( - CGF, SecondaryQueue, /*CallerNeedsEvent*/ true, Loc, IsTopCodeLoc, {}); + detail::EventImplPtr FlushEvent = + submit_impl(CGF, /*CallerNeedsEvent*/ true, Loc, IsTopCodeLoc, {}); if (EventImpl) EventImpl->attachEventToCompleteWeak(FlushEvent); if (!isInOrder()) { @@ -403,18 +403,6 @@ queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF, return EventImpl; } -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -detail::EventImplPtr -queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF, - const std::shared_ptr & /*PrimaryQueue*/, - const std::shared_ptr &SecondaryQueue, - bool CallerNeedsEvent, const detail::code_location &Loc, - bool IsTopCodeLoc, const SubmissionInfo &SubmitInfo) { - return submit_impl(CGF, SecondaryQueue.get(), CallerNeedsEvent, Loc, - IsTopCodeLoc, SubmitInfo); -} -#endif - template event queue_impl::submitWithHandler(const std::vector &DepEvents, bool CallerNeedsEvent, diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index 7e15c772f2697..f4ed064543ce8 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -66,7 +66,9 @@ enum QueueOrder { Ordered, OOO }; // Implementation of the submission information storage. struct SubmissionInfoImpl { optional MPostProcessorFunc = std::nullopt; +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES std::shared_ptr MSecondaryQueue = nullptr; +#endif ext::oneapi::experimental::event_mode_enum MEventMode = ext::oneapi::experimental::event_mode_enum::none; }; @@ -331,22 +333,16 @@ class queue_impl : public std::enable_shared_from_this { /// Submits a command group function object to the queue, in order to be /// scheduled for execution on the device. /// - /// On a kernel error, this command group function object is then scheduled - /// for execution on a secondary queue. - /// /// \param CGF is a function object containing command group. - /// \param SecondQueue is a shared_ptr to the secondary queue. /// \param Loc is the code location of the submit call (default argument) /// \param StoreAdditionalInfo makes additional info be stored in event_impl /// \return a SYCL event object, which corresponds to the queue the command /// group is being enqueued on. event submit(const detail::type_erased_cgfo_ty &CGF, - const std::shared_ptr &SecondQueue, const detail::code_location &Loc, bool IsTopCodeLoc, const SubmitPostProcessF *PostProcess = nullptr) { event ResEvent; v1::SubmissionInfo SI{}; - SI.SecondaryQueue() = SecondQueue; if (PostProcess) SI.PostProcessorFunc() = *PostProcess; return submit_with_event(CGF, SI, Loc, IsTopCodeLoc); @@ -364,9 +360,8 @@ class queue_impl : public std::enable_shared_from_this { const v1::SubmissionInfo &SubmitInfo, const detail::code_location &Loc, bool IsTopCodeLoc) { - detail::EventImplPtr ResEvent = - submit_impl(CGF, SubmitInfo.SecondaryQueue().get(), - /*CallerNeedsEvent=*/true, Loc, IsTopCodeLoc, SubmitInfo); + detail::EventImplPtr ResEvent = submit_impl(CGF, /*CallerNeedsEvent=*/true, + Loc, IsTopCodeLoc, SubmitInfo); return createSyclObjFromImpl(ResEvent); } @@ -374,8 +369,7 @@ class queue_impl : public std::enable_shared_from_this { const v1::SubmissionInfo &SubmitInfo, const detail::code_location &Loc, bool IsTopCodeLoc) { - submit_impl(CGF, SubmitInfo.SecondaryQueue().get(), - /*CallerNeedsEvent=*/false, Loc, IsTopCodeLoc, SubmitInfo); + submit_impl(CGF, /*CallerNeedsEvent=*/false, Loc, IsTopCodeLoc, SubmitInfo); } /// Performs a blocking wait for the completion of all enqueued tasks in the @@ -885,38 +879,15 @@ class queue_impl : public std::enable_shared_from_this { PostProcess(IsKernel, KernelUsesAssert, Event); } -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - /// Performs command group submission to the queue. - /// - /// \param CGF is a function object containing command group. - /// \param PrimaryQueue is a pointer to the primary queue. This may be the - /// same as this. - /// \param SecondaryQueue is a pointer to the secondary queue. This may be the - /// same as this. - /// \param CallerNeedsEvent is a boolean indicating whether the event is - /// required by the user after the call. - /// \param Loc is the code location of the submit call (default argument) - /// \param SubmitInfo is additional optional information for the submission. - /// \return a SYCL event representing submitted command group. - detail::EventImplPtr - submit_impl(const detail::type_erased_cgfo_ty &CGF, - const std::shared_ptr &PrimaryQueue, - const std::shared_ptr &SecondaryQueue, - bool CallerNeedsEvent, const detail::code_location &Loc, - bool IsTopCodeLoc, const SubmissionInfo &SubmitInfo); -#endif - /// Performs command group submission to the queue. /// /// \param CGF is a function object containing command group. - /// \param SecondaryQueue is a pointer to the secondary queue. /// \param CallerNeedsEvent is a boolean indicating whether the event is /// required by the user after the call. /// \param Loc is the code location of the submit call (default argument) /// \param SubmitInfo is additional optional information for the submission. /// \return a SYCL event representing submitted command group. detail::EventImplPtr submit_impl(const detail::type_erased_cgfo_ty &CGF, - queue_impl *SecondaryQueue, bool CallerNeedsEvent, const detail::code_location &Loc, bool IsTopCodeLoc, diff --git a/sycl/source/detail/scheduler/scheduler.hpp b/sycl/source/detail/scheduler/scheduler.hpp index 185f8f825877c..eb843a11b84e6 100644 --- a/sycl/source/detail/scheduler/scheduler.hpp +++ b/sycl/source/detail/scheduler/scheduler.hpp @@ -587,14 +587,6 @@ class Scheduler { void cleanupCommand(Command *Cmd, bool AllowUnsubmitted = false); - /// Reschedules the command passed using Queue provided. - /// - /// This can lead to rescheduling of all dependent commands. This can be - /// used when the user provides a "secondary" queue to the submit method - /// which may be used when the command fails to enqueue/execute in the - /// primary queue. - void rescheduleCommand(Command *Cmd, queue_impl *Queue); - /// \return a pointer to the corresponding memory object record for the /// SYCL memory object provided, or nullptr if it does not exist. MemObjRecord *getMemObjRecord(SYCLMemObjI *MemObject); diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index dc4aac9b1c645..f9d1769e573e7 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -353,22 +353,21 @@ handler::handler(std::unique_ptr &&HandlerImpl) handler::handler(std::shared_ptr Queue, bool CallerNeedsEvent) - : impl(std::make_shared(*Queue, nullptr, - CallerNeedsEvent)), + : impl(std::make_shared(*Queue, CallerNeedsEvent)), MQueueDoNotUse(std::move(Queue)) {} handler::handler( std::shared_ptr Queue, [[maybe_unused]] std::shared_ptr PrimaryQueue, - std::shared_ptr SecondaryQueue, bool CallerNeedsEvent) - : impl(std::make_shared(*Queue, SecondaryQueue.get(), - CallerNeedsEvent)), + [[maybe_unused]] std::shared_ptr SecondaryQueue, + bool CallerNeedsEvent) + : impl(std::make_shared(*Queue, CallerNeedsEvent)), MQueueDoNotUse(Queue) {} handler::handler(std::shared_ptr Queue, - detail::queue_impl *SecondaryQueue, bool CallerNeedsEvent) - : impl(std::make_shared(*Queue, SecondaryQueue, - CallerNeedsEvent)), + [[maybe_unused]] detail::queue_impl *SecondaryQueue, + bool CallerNeedsEvent) + : impl(std::make_shared(*Queue, CallerNeedsEvent)), MQueueDoNotUse(std::move(Queue)) {} handler::handler( @@ -2021,14 +2020,6 @@ void handler::use_kernel_bundle( "Context associated with the primary queue is different from the " "context associated with the kernel bundle"); - if (impl->MSubmissionSecondaryQueue && - impl->MSubmissionSecondaryQueue->get_context() != - ExecBundle.get_context()) - throw sycl::exception( - make_error_code(errc::invalid), - "Context associated with the secondary queue is different from the " - "context associated with the kernel bundle"); - setStateExplicitKernelBundle(); setHandlerKernelBundle(detail::getSyclObjImpl(ExecBundle)); } @@ -2649,7 +2640,7 @@ __SYCL_EXPORT void HandlerAccess::preProcess(handler &CGH, queue_impl &Q = CGH.impl->get_queue(); bool EventNeeded = !Q.isInOrder(); #ifdef __INTEL_PREVIEW_BREAKING_CHANGES - handler_impl HandlerImpl{Q, nullptr, EventNeeded}; + handler_impl HandlerImpl{Q, EventNeeded}; handler AuxHandler{HandlerImpl}; #else handler AuxHandler{Q.shared_from_this(), EventNeeded}; @@ -2668,8 +2659,7 @@ __SYCL_EXPORT void HandlerAccess::postProcess(handler &CGH, if (!InOrder) CGH.impl->MEventNeeded = true; - handler PostProcessHandler{ - std::make_unique(Q, nullptr, EventNeeded)}; + handler PostProcessHandler{std::make_unique(Q, EventNeeded)}; PostProcessHandler.copyCodeLoc(CGH); // Extend lifetimes of auxiliary resources till the last kernel in the chain // finishes: diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index ed0b0e42e6e6f..f4e0824391fd1 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -33,6 +33,7 @@ const optional &SubmissionInfo::PostProcessorFunc() const { return impl->MPostProcessorFunc; } +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES std::shared_ptr &SubmissionInfo::SecondaryQueue() { return impl->MSecondaryQueue; } @@ -41,6 +42,7 @@ const std::shared_ptr & SubmissionInfo::SecondaryQueue() const { return impl->MSecondaryQueue; } +#endif ext::oneapi::experimental::event_mode_enum &SubmissionInfo::EventMode() { return impl->MEventMode; @@ -209,14 +211,16 @@ event queue::submit_impl(std::function CGH, return submit_with_event_impl(std::move(CGH), {}, CodeLoc, IsTopCodeLoc); } -event queue::submit_impl(std::function CGH, queue SecondQueue, +event queue::submit_impl(std::function CGH, + [[maybe_unused]] queue SecondQueue, const detail::code_location &CodeLoc) { - return impl->submit(CGH, SecondQueue.impl, CodeLoc, true); + return impl->submit(CGH, CodeLoc, true); } -event queue::submit_impl(std::function CGH, queue SecondQueue, +event queue::submit_impl(std::function CGH, + [[maybe_unused]] queue SecondQueue, const detail::code_location &CodeLoc, bool IsTopCodeLoc) { - return impl->submit(CGH, SecondQueue.impl, CodeLoc, IsTopCodeLoc); + return impl->submit(CGH, CodeLoc, IsTopCodeLoc); } void queue::submit_without_event_impl(std::function CGH, @@ -245,17 +249,16 @@ event queue::submit_impl_and_postprocess( } event queue::submit_impl_and_postprocess( - std::function CGH, queue SecondQueue, + std::function CGH, [[maybe_unused]] queue SecondQueue, const detail::code_location &CodeLoc, const detail::SubmitPostProcessF &PostProcess) { - return impl->submit(CGH, SecondQueue.impl, CodeLoc, true, &PostProcess); + return impl->submit(CGH, CodeLoc, true, &PostProcess); } event queue::submit_impl_and_postprocess( - std::function CGH, queue SecondQueue, + std::function CGH, [[maybe_unused]] queue SecondQueue, const detail::code_location &CodeLoc, const detail::SubmitPostProcessF &PostProcess, bool IsTopCodeLoc) { - return impl->submit(CGH, SecondQueue.impl, CodeLoc, IsTopCodeLoc, - &PostProcess); + return impl->submit(CGH, CodeLoc, IsTopCodeLoc, &PostProcess); } event queue::submit_with_event_impl(std::function CGH, diff --git a/sycl/unittests/SYCL2020/KernelBundle.cpp b/sycl/unittests/SYCL2020/KernelBundle.cpp index 870686944aca3..52074dbaabeb6 100644 --- a/sycl/unittests/SYCL2020/KernelBundle.cpp +++ b/sycl/unittests/SYCL2020/KernelBundle.cpp @@ -264,98 +264,6 @@ TEST(KernelBundle, UseKernelBundleWrongContextPrimaryQueueOnly) { } } -TEST(KernelBundle, UseKernelBundleWrongContextPrimaryQueueValidSecondaryQueue) { - sycl::unittest::UrMock<> Mock; - - const sycl::device Dev = sycl::platform().get_devices()[0]; - const sycl::context PrimaryCtx{Dev}; - const sycl::context SecondaryCtx{Dev}; - - ASSERT_NE(PrimaryCtx, SecondaryCtx); - - auto KernelBundle = sycl::get_kernel_bundle( - SecondaryCtx, {Dev}); - - sycl::queue PrimaryQueue{PrimaryCtx, Dev}; - sycl::queue SecondaryQueue{SecondaryCtx, Dev}; - - class UnqiueException {}; - - try { - PrimaryQueue.submit( - [&](sycl::handler &CGH) { - try { - CGH.use_kernel_bundle(KernelBundle); - FAIL() << "No exception was thrown."; - CGH.single_task([]() {}); - } catch (const sycl::exception &e) { - ASSERT_EQ(e.code().value(), static_cast(sycl::errc::invalid)) - << "sycl::exception code was not the expected " - "sycl::errc::invalid."; - // Throw uniquely identifiable exception to distinguish between that - // the sycl::exception originates from the correct level. - throw UnqiueException{}; - } catch (...) { - FAIL() << "Unexpected exception was thrown in kernel invocation " - "function."; - } - }, - SecondaryQueue); - } catch (const UnqiueException &) { - // Expected path - } catch (const sycl::exception &) { - FAIL() << "sycl::exception thrown at the wrong level."; - } catch (...) { - FAIL() << "Unexpected exception was thrown in submit."; - } -} - -TEST(KernelBundle, UseKernelBundleValidPrimaryQueueWrongContextSecondaryQueue) { - sycl::unittest::UrMock<> Mock; - - const sycl::device Dev = sycl::platform().get_devices()[0]; - const sycl::context PrimaryCtx{Dev}; - const sycl::context SecondaryCtx{Dev}; - - ASSERT_NE(PrimaryCtx, SecondaryCtx); - - auto KernelBundle = sycl::get_kernel_bundle( - PrimaryCtx, {Dev}); - - sycl::queue PrimaryQueue{PrimaryCtx, Dev}; - sycl::queue SecondaryQueue{SecondaryCtx, Dev}; - - class UnqiueException {}; - - try { - PrimaryQueue.submit( - [&](sycl::handler &CGH) { - try { - CGH.use_kernel_bundle(KernelBundle); - FAIL() << "No exception was thrown."; - CGH.single_task([]() {}); - } catch (const sycl::exception &e) { - ASSERT_EQ(e.code().value(), static_cast(sycl::errc::invalid)) - << "sycl::exception code was not the expected " - "sycl::errc::invalid."; - // Throw uniquely identifiable exception to distinguish between that - // the sycl::exception originates from the correct level. - throw UnqiueException{}; - } catch (...) { - FAIL() << "Unexpected exception was thrown in kernel invocation " - "function."; - } - }, - SecondaryQueue); - } catch (const UnqiueException &) { - // Expected path - } catch (const sycl::exception &) { - FAIL() << "sycl::exception thrown at the wrong level."; - } catch (...) { - FAIL() << "Unexpected exception was thrown in submit."; - } -} - TEST(KernelBundle, UseKernelBundleWrongContextPrimaryQueueAndSecondaryQueue) { sycl::unittest::UrMock<> Mock; @@ -374,32 +282,22 @@ TEST(KernelBundle, UseKernelBundleWrongContextPrimaryQueueAndSecondaryQueue) { sycl::queue PrimaryQueue{PrimaryCtx, Dev}; sycl::queue SecondaryQueue{SecondaryCtx, Dev}; - class UnqiueException {}; - + size_t EnqueueCounter = 0; try { PrimaryQueue.submit( [&](sycl::handler &CGH) { - try { - CGH.use_kernel_bundle(KernelBundle); - FAIL() << "No exception was thrown."; - CGH.single_task([]() {}); - } catch (const sycl::exception &e) { - ASSERT_EQ(e.code().value(), static_cast(sycl::errc::invalid)) - << "sycl::exception code was not the expected " - "sycl::errc::invalid."; - // Throw uniquely identifiable exception to distinguish between that - // the sycl::exception originates from the correct level. - throw UnqiueException{}; - } catch (...) { - FAIL() << "Unexpected exception was thrown in kernel invocation " - "function."; - } + CGH.use_kernel_bundle(KernelBundle); + ++EnqueueCounter; + CGH.single_task([]() {}); }, SecondaryQueue); - } catch (const UnqiueException &) { - // Expected path - } catch (const sycl::exception &) { - FAIL() << "sycl::exception thrown at the wrong level."; + FAIL() << "Submit should always throw."; + } catch (const sycl::exception &e) { + ASSERT_EQ(EnqueueCounter, size_t{0}) + << "Exception was not thrown from primary queue."; + ASSERT_EQ(e.code().value(), static_cast(sycl::errc::invalid)) + << "sycl::exception code was not the expected " + "sycl::errc::invalid."; } catch (...) { FAIL() << "Unexpected exception was thrown in submit."; } diff --git a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp index 5f3dc3be84517..27f860fb25659 100644 --- a/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp +++ b/sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp @@ -137,7 +137,7 @@ class MockHandler : public sycl::handler { MockHandler(sycl::detail::queue_impl &Queue) : sycl::handler(std::make_unique( - Queue, nullptr, /*CallerNeedsEvent*/ true)) {} + Queue, /*CallerNeedsEvent*/ true)) {} std::unique_ptr finalize() { auto CGH = static_cast(this); diff --git a/sycl/unittests/scheduler/HostTaskAndBarrier.cpp b/sycl/unittests/scheduler/HostTaskAndBarrier.cpp index b609a9e683212..66509107d8967 100644 --- a/sycl/unittests/scheduler/HostTaskAndBarrier.cpp +++ b/sycl/unittests/scheduler/HostTaskAndBarrier.cpp @@ -62,25 +62,24 @@ class BarrierHandlingWithHostTask : public ::testing::Test { auto L = [&](handler &CGH) { CGH.host_task(BlockHostTask ? CustomHostLambda : [] {}); }; - return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, nullptr, - {}, true); + return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, {}, + true); } else if (Type == TestCGType::KERNEL_TASK) { auto L = [&](handler &CGH) { CGH.single_task([] {}); }; - return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, nullptr, - {}, true); + return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, {}, + true); } else // (Type == TestCGType::BARRIER) { auto L = [&](handler &CGH) { CGH.ext_oneapi_barrier(); }; - return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, nullptr, - {}, true); + return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, {}, + true); } } sycl::event InsertBarrierWithWaitList(const std::vector &WaitList) { auto L = [&](handler &CGH) { CGH.ext_oneapi_barrier(WaitList); }; - return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, nullptr, - {}, true); + return QueueDevImpl->submit(sycl::detail::type_erased_cgfo_ty{L}, {}, true); } std::vector BuildAndCheckInnerQueueState() { diff --git a/sycl/unittests/scheduler/SchedulerTestUtils.hpp b/sycl/unittests/scheduler/SchedulerTestUtils.hpp index 043d219386157..30966b26e742a 100644 --- a/sycl/unittests/scheduler/SchedulerTestUtils.hpp +++ b/sycl/unittests/scheduler/SchedulerTestUtils.hpp @@ -222,7 +222,7 @@ class MockHandler : public sycl::handler { public: MockHandler(sycl::detail::queue_impl &Queue, bool CallerNeedsEvent) : sycl::handler(std::make_unique( - Queue, nullptr, CallerNeedsEvent)) {} + Queue, CallerNeedsEvent)) {} // Methods using sycl::handler::addReduction; using sycl::handler::getType;