@@ -302,17 +302,19 @@ fill_copy_args(detail::handler_impl *impl,
302302
303303} // namespace detail
304304
305- handler::handler (std::shared_ptr<detail::queue_impl> Queue,
305+ handler::handler (std::shared_ptr<detail::queue_impl> & Queue,
306306 bool CallerNeedsEvent)
307- : MImplOwner(std::make_unique<detail::handler_impl>(Queue, nullptr ,
307+ : MImplOwner(std::make_unique<detail::handler_impl>(Queue.get() , nullptr ,
308308 CallerNeedsEvent)),
309- impl (MImplOwner.get()), MQueue(std::move( Queue) ) {}
309+ impl (MImplOwner.get()), MQueue(Queue) {}
310310
311311handler::handler (detail::handler_impl *HandlerImpl,
312- std::shared_ptr<detail::queue_impl> Queue)
313- : impl(HandlerImpl), MQueue(std::move( Queue) ) {}
312+ std::shared_ptr<detail::queue_impl> & Queue)
313+ : impl(HandlerImpl), MQueue(Queue) {}
314314
315- handler::handler (detail::handler_impl *HandlerImpl) : impl(HandlerImpl) {}
315+ static std::shared_ptr<detail::queue_impl> DummyQueue;
316+
317+ handler::handler (detail::handler_impl *HandlerImpl) : impl(HandlerImpl), MQueue(DummyQueue) {}
316318
317319// Sets the submission state to indicate that an explicit kernel bundle has been
318320// set. Throws a sycl::exception with errc::invalid if the current state
@@ -1660,21 +1662,17 @@ void handler::ext_oneapi_signal_external_semaphore(
16601662
16611663void handler::use_kernel_bundle (
16621664 const kernel_bundle<bundle_state::executable> &ExecBundle) {
1663- std::shared_ptr<detail::queue_impl> PrimaryQueue =
1664- impl->MSubmissionPrimaryQueue ;
16651665 if ((!impl->MGraph &&
1666- (PrimaryQueue ->get_context () != ExecBundle.get_context ())) ||
1666+ (impl-> MSubmissionPrimaryQueue ->get_context () != ExecBundle.get_context ())) ||
16671667 (impl->MGraph &&
16681668 (impl->MGraph ->getContext () != ExecBundle.get_context ())))
16691669 throw sycl::exception (
16701670 make_error_code (errc::invalid),
16711671 " Context associated with the primary queue is different from the "
16721672 " context associated with the kernel bundle" );
16731673
1674- std::shared_ptr<detail::queue_impl> SecondaryQueue =
1675- impl->MSubmissionSecondaryQueue ;
1676- if (SecondaryQueue &&
1677- SecondaryQueue->get_context () != ExecBundle.get_context ())
1674+ if (impl->MSubmissionSecondaryQueue &&
1675+ impl->MSubmissionSecondaryQueue ->get_context () != ExecBundle.get_context ())
16781676 throw sycl::exception (
16791677 make_error_code (errc::invalid),
16801678 " Context associated with the secondary queue is different from the "
@@ -1816,7 +1814,7 @@ void handler::verifyDeviceHasProgressGuarantee(
18161814}
18171815
18181816bool handler::supportsUSMMemcpy2D () {
1819- for (const std::shared_ptr< detail::queue_impl> & QueueImpl :
1817+ for (detail::queue_impl * QueueImpl :
18201818 {impl->MSubmissionPrimaryQueue , impl->MSubmissionSecondaryQueue }) {
18211819 if (QueueImpl &&
18221820 !checkContextSupports (QueueImpl->getContextImplPtr (),
@@ -1827,7 +1825,7 @@ bool handler::supportsUSMMemcpy2D() {
18271825}
18281826
18291827bool handler::supportsUSMFill2D () {
1830- for (const std::shared_ptr< detail::queue_impl> & QueueImpl :
1828+ for (detail::queue_impl * QueueImpl :
18311829 {impl->MSubmissionPrimaryQueue , impl->MSubmissionSecondaryQueue }) {
18321830 if (QueueImpl && !checkContextSupports (QueueImpl->getContextImplPtr (),
18331831 UR_CONTEXT_INFO_USM_FILL2D_SUPPORT))
@@ -1837,7 +1835,7 @@ bool handler::supportsUSMFill2D() {
18371835}
18381836
18391837bool handler::supportsUSMMemset2D () {
1840- for (const std::shared_ptr< detail::queue_impl> & QueueImpl :
1838+ for (detail::queue_impl * QueueImpl :
18411839 {impl->MSubmissionPrimaryQueue , impl->MSubmissionSecondaryQueue }) {
18421840 if (QueueImpl && !checkContextSupports (QueueImpl->getContextImplPtr (),
18431841 UR_CONTEXT_INFO_USM_FILL2D_SUPPORT))
0 commit comments