@@ -57,10 +57,6 @@ static bool isOnSameContext(const ContextImplPtr Context, queue_impl *Queue) {
5757 // contexts comparison.
5858 return Context == queue_impl::getContext (Queue);
5959}
60- static bool isOnSameContext (const ContextImplPtr Context,
61- const QueueImplPtr &Queue) {
62- return isOnSameContext (Context, Queue.get ());
63- }
6460
6561// / Checks if the required access mode is allowed under the current one.
6662static bool isAccessModeAllowed (access::mode Required, access::mode Current) {
@@ -183,7 +179,7 @@ MemObjRecord *Scheduler::GraphBuilder::getMemObjRecord(SYCLMemObjI *MemObject) {
183179}
184180
185181MemObjRecord *
186- Scheduler::GraphBuilder::getOrInsertMemObjRecord (const QueueImplPtr & Queue,
182+ Scheduler::GraphBuilder::getOrInsertMemObjRecord (queue_impl * Queue,
187183 const Requirement *Req) {
188184 SYCLMemObjI *MemObject = Req->MSYCLMemObj ;
189185 MemObjRecord *Record = getMemObjRecord (MemObject);
@@ -231,8 +227,8 @@ Scheduler::GraphBuilder::getOrInsertMemObjRecord(const QueueImplPtr &Queue,
231227 MemObject->MRecord .reset (
232228 new MemObjRecord{InteropCtxPtr, LeafLimit, AllocateDependency});
233229 std::vector<Command *> ToEnqueue;
234- getOrCreateAllocaForReq (MemObject->MRecord .get (), Req, InteropQueuePtr,
235- ToEnqueue);
230+ getOrCreateAllocaForReq (MemObject->MRecord .get (), Req,
231+ InteropQueuePtr. get (), ToEnqueue);
236232 assert (ToEnqueue.empty () && " Creation of the first alloca for a record "
237233 " shouldn't lead to any enqueuing (no linked "
238234 " alloca or exceeding the leaf limit)." );
@@ -274,14 +270,13 @@ void Scheduler::GraphBuilder::addNodeToLeaves(
274270}
275271
276272UpdateHostRequirementCommand *Scheduler::GraphBuilder::insertUpdateHostReqCmd (
277- MemObjRecord *Record, Requirement *Req, const QueueImplPtr & Queue,
273+ MemObjRecord *Record, Requirement *Req, queue_impl * Queue,
278274 std::vector<Command *> &ToEnqueue) {
279275 auto Context = queue_impl::getContext (Queue);
280276 AllocaCommandBase *AllocaCmd = findAllocaForReq (Record, Req, Context);
281277 assert (AllocaCmd && " There must be alloca for requirement!" );
282278 UpdateHostRequirementCommand *UpdateCommand =
283- new UpdateHostRequirementCommand (Queue.get (), *Req, AllocaCmd,
284- &Req->MData );
279+ new UpdateHostRequirementCommand (Queue, *Req, AllocaCmd, &Req->MData );
285280 // Need copy of requirement because after host accessor destructor call
286281 // dependencies become invalid if requirement is stored by pointer.
287282 const Requirement *StoredReq = UpdateCommand->getRequirement ();
@@ -330,9 +325,10 @@ static Command *insertMapUnmapForLinkedCmds(AllocaCommandBase *AllocaCmdSrc,
330325 return MapCmd;
331326}
332327
333- Command *Scheduler::GraphBuilder::insertMemoryMove (
334- MemObjRecord *Record, Requirement *Req, const QueueImplPtr &Queue,
335- std::vector<Command *> &ToEnqueue) {
328+ Command *
329+ Scheduler::GraphBuilder::insertMemoryMove (MemObjRecord *Record,
330+ Requirement *Req, queue_impl *Queue,
331+ std::vector<Command *> &ToEnqueue) {
336332 AllocaCommandBase *AllocaCmdDst =
337333 getOrCreateAllocaForReq (Record, Req, Queue, ToEnqueue);
338334 if (!AllocaCmdDst)
@@ -519,7 +515,7 @@ Scheduler::GraphBuilder::addHostAccessor(Requirement *Req,
519515 auto SYCLMemObj = static_cast <detail::SYCLMemObjT *>(Req->MSYCLMemObj );
520516 SYCLMemObj->handleWriteAccessorCreation ();
521517 }
522- // Host accessor is not attached to any queue so no QueueImplPtr object to be
518+ // Host accessor is not attached to any queue so no queue object to be
523519 // sent to getOrInsertMemObjRecord.
524520 MemObjRecord *Record = getOrInsertMemObjRecord (nullptr , Req);
525521 if (MPrintOptionsArray[BeforeAddHostAcc])
@@ -691,7 +687,7 @@ static bool checkHostUnifiedMemory(const ContextImplPtr &Ctx) {
691687// Note, creation of new allocation command can lead to the current context
692688// (Record->MCurContext) change.
693689AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq (
694- MemObjRecord *Record, const Requirement *Req, const QueueImplPtr & Queue,
690+ MemObjRecord *Record, const Requirement *Req, queue_impl * Queue,
695691 std::vector<Command *> &ToEnqueue) {
696692 auto Context = queue_impl::getContext (Queue);
697693 AllocaCommandBase *AllocaCmd =
@@ -710,8 +706,8 @@ AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
710706
711707 auto *ParentAlloca =
712708 getOrCreateAllocaForReq (Record, &ParentRequirement, Queue, ToEnqueue);
713- AllocaCmd = new AllocaSubBufCommand (Queue. get () , *Req, ParentAlloca,
714- ToEnqueue, ToCleanUp);
709+ AllocaCmd = new AllocaSubBufCommand (Queue, *Req, ParentAlloca, ToEnqueue ,
710+ ToCleanUp);
715711 } else {
716712
717713 const Requirement FullReq (/* Offset*/ {0 , 0 , 0 }, Req->MMemoryRange ,
@@ -787,8 +783,8 @@ AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
787783 }
788784 }
789785
790- AllocaCmd = new AllocaCommand (Queue. get (), FullReq, InitFromUserData,
791- LinkedAllocaCmd);
786+ AllocaCmd =
787+ new AllocaCommand (Queue, FullReq, InitFromUserData, LinkedAllocaCmd);
792788
793789 // Update linked command
794790 if (LinkedAllocaCmd) {
@@ -926,16 +922,16 @@ static void combineAccessModesOfReqs(std::vector<Requirement *> &Reqs) {
926922}
927923
928924Command *Scheduler::GraphBuilder::addCG (
929- std::unique_ptr<detail::CG> CommandGroup, const QueueImplPtr & Queue,
925+ std::unique_ptr<detail::CG> CommandGroup, queue_impl * Queue,
930926 std::vector<Command *> &ToEnqueue, bool EventNeeded,
931927 ur_exp_command_buffer_handle_t CommandBuffer,
932928 const std::vector<ur_exp_command_buffer_sync_point_t > &Dependencies) {
933929 std::vector<Requirement *> &Reqs = CommandGroup->getRequirements ();
934930 std::vector<detail::EventImplPtr> &Events = CommandGroup->getEvents ();
935931
936- auto NewCmd = std::make_unique<ExecCGCommand>(
937- std::move (CommandGroup), Queue. get (), EventNeeded, CommandBuffer,
938- std::move (Dependencies));
932+ auto NewCmd = std::make_unique<ExecCGCommand>(std::move (CommandGroup), Queue,
933+ EventNeeded, CommandBuffer,
934+ std::move (Dependencies));
939935
940936 if (!NewCmd)
941937 throw exception (make_error_code (errc::memory_allocation),
@@ -958,9 +954,9 @@ Command *Scheduler::GraphBuilder::addCG(
958954 bool isSameCtx = false ;
959955
960956 {
961- const QueueImplPtr & QueueForAlloca =
957+ queue_impl * QueueForAlloca =
962958 isInteropTask
963- ? static_cast <detail::CGHostTask &>(NewCmd->getCG ()).MQueue
959+ ? static_cast <detail::CGHostTask &>(NewCmd->getCG ()).MQueue . get ()
964960 : Queue;
965961
966962 Record = getOrInsertMemObjRecord (QueueForAlloca, Req);
@@ -990,15 +986,15 @@ Command *Scheduler::GraphBuilder::addCG(
990986 // Cannot directly copy memory from OpenCL device to OpenCL device -
991987 // create two copies: device->host and host->device.
992988 bool NeedMemMoveToHost = false ;
993- auto MemMoveTargetQueue = Queue;
989+ queue_impl * MemMoveTargetQueue = Queue;
994990
995991 if (isInteropTask) {
996992 const detail::CGHostTask &HT =
997993 static_cast <detail::CGHostTask &>(NewCmd->getCG ());
998994
999- if (!isOnSameContext (Record->MCurContext , HT.MQueue )) {
995+ if (!isOnSameContext (Record->MCurContext , HT.MQueue . get () )) {
1000996 NeedMemMoveToHost = true ;
1001- MemMoveTargetQueue = HT.MQueue ;
997+ MemMoveTargetQueue = HT.MQueue . get () ;
1002998 }
1003999 } else if (Queue && Record->MCurContext )
10041000 NeedMemMoveToHost = true ;
@@ -1230,7 +1226,9 @@ Command *Scheduler::GraphBuilder::connectDepEvent(
12301226 try {
12311227 std::shared_ptr<detail::HostTask> HT (new detail::HostTask);
12321228 std::unique_ptr<detail::CG> ConnectCG (new detail::CGHostTask (
1233- std::move (HT), /* Queue = */ Cmd->getQueue (), /* Context = */ {},
1229+ std::move (HT),
1230+ /* Queue = */ Cmd->getQueue (),
1231+ /* Context = */ {},
12341232 /* Args = */ {},
12351233 detail::CG::StorageInitHelper (
12361234 /* ArgsStorage = */ {}, /* AccStorage = */ {},
@@ -1281,11 +1279,11 @@ Command *Scheduler::GraphBuilder::addCommandGraphUpdate(
12811279 ext::oneapi::experimental::detail::exec_graph_impl *Graph,
12821280 std::vector<std::shared_ptr<ext::oneapi::experimental::detail::node_impl>>
12831281 Nodes,
1284- const QueueImplPtr & Queue, std::vector<Requirement *> Requirements,
1282+ queue_impl * Queue, std::vector<Requirement *> Requirements,
12851283 std::vector<detail::EventImplPtr> &Events,
12861284 std::vector<Command *> &ToEnqueue) {
12871285 auto NewCmd =
1288- std::make_unique<UpdateCommandBufferCommand>(Queue. get () , Graph, Nodes);
1286+ std::make_unique<UpdateCommandBufferCommand>(Queue, Graph, Nodes);
12891287 // If there are multiple requirements for the same memory object, its
12901288 // AllocaCommand creation will be dependent on the access mode of the first
12911289 // requirement. Combine these access modes to take all of them into account.
0 commit comments