@@ -56,10 +56,6 @@ static bool isOnSameContext(const ContextImplPtr Context, queue_impl *Queue) {
5656 // contexts comparison.
5757 return Context == queue_impl::getContext (Queue);
5858}
59- static bool isOnSameContext (const ContextImplPtr Context,
60- const QueueImplPtr &Queue) {
61- return isOnSameContext (Context, Queue.get ());
62- }
6359
6460// / Checks if the required access mode is allowed under the current one.
6561static bool isAccessModeAllowed (access::mode Required, access::mode Current) {
@@ -182,7 +178,7 @@ MemObjRecord *Scheduler::GraphBuilder::getMemObjRecord(SYCLMemObjI *MemObject) {
182178}
183179
184180MemObjRecord *
185- Scheduler::GraphBuilder::getOrInsertMemObjRecord (const QueueImplPtr & Queue,
181+ Scheduler::GraphBuilder::getOrInsertMemObjRecord (queue_impl * Queue,
186182 const Requirement *Req) {
187183 SYCLMemObjI *MemObject = Req->MSYCLMemObj ;
188184 MemObjRecord *Record = getMemObjRecord (MemObject);
@@ -230,8 +226,8 @@ Scheduler::GraphBuilder::getOrInsertMemObjRecord(const QueueImplPtr &Queue,
230226 MemObject->MRecord .reset (
231227 new MemObjRecord{InteropCtxPtr.get (), LeafLimit, AllocateDependency});
232228 std::vector<Command *> ToEnqueue;
233- getOrCreateAllocaForReq (MemObject->MRecord .get (), Req, InteropQueuePtr,
234- ToEnqueue);
229+ getOrCreateAllocaForReq (MemObject->MRecord .get (), Req,
230+ InteropQueuePtr. get (), ToEnqueue);
235231 assert (ToEnqueue.empty () && " Creation of the first alloca for a record "
236232 " shouldn't lead to any enqueuing (no linked "
237233 " alloca or exceeding the leaf limit)." );
@@ -273,14 +269,13 @@ void Scheduler::GraphBuilder::addNodeToLeaves(
273269}
274270
275271UpdateHostRequirementCommand *Scheduler::GraphBuilder::insertUpdateHostReqCmd (
276- MemObjRecord *Record, Requirement *Req, const QueueImplPtr & Queue,
272+ MemObjRecord *Record, Requirement *Req, queue_impl * Queue,
277273 std::vector<Command *> &ToEnqueue) {
278274 auto Context = queue_impl::getContext (Queue);
279275 AllocaCommandBase *AllocaCmd = findAllocaForReq (Record, Req, Context);
280276 assert (AllocaCmd && " There must be alloca for requirement!" );
281277 UpdateHostRequirementCommand *UpdateCommand =
282- new UpdateHostRequirementCommand (Queue.get (), *Req, AllocaCmd,
283- &Req->MData );
278+ new UpdateHostRequirementCommand (Queue, *Req, AllocaCmd, &Req->MData );
284279 // Need copy of requirement because after host accessor destructor call
285280 // dependencies become invalid if requirement is stored by pointer.
286281 const Requirement *StoredReq = UpdateCommand->getRequirement ();
@@ -329,9 +324,10 @@ static Command *insertMapUnmapForLinkedCmds(AllocaCommandBase *AllocaCmdSrc,
329324 return MapCmd;
330325}
331326
332- Command *Scheduler::GraphBuilder::insertMemoryMove (
333- MemObjRecord *Record, Requirement *Req, const QueueImplPtr &Queue,
334- std::vector<Command *> &ToEnqueue) {
327+ Command *
328+ Scheduler::GraphBuilder::insertMemoryMove (MemObjRecord *Record,
329+ Requirement *Req, queue_impl *Queue,
330+ std::vector<Command *> &ToEnqueue) {
335331 AllocaCommandBase *AllocaCmdDst =
336332 getOrCreateAllocaForReq (Record, Req, Queue, ToEnqueue);
337333 if (!AllocaCmdDst)
@@ -518,7 +514,7 @@ Scheduler::GraphBuilder::addHostAccessor(Requirement *Req,
518514 auto SYCLMemObj = static_cast <detail::SYCLMemObjT *>(Req->MSYCLMemObj );
519515 SYCLMemObj->handleWriteAccessorCreation ();
520516 }
521- // Host accessor is not attached to any queue so no QueueImplPtr object to be
517+ // Host accessor is not attached to any queue so no queue object to be
522518 // sent to getOrInsertMemObjRecord.
523519 MemObjRecord *Record = getOrInsertMemObjRecord (nullptr , Req);
524520 if (MPrintOptionsArray[BeforeAddHostAcc])
@@ -690,7 +686,7 @@ static bool checkHostUnifiedMemory(const ContextImplPtr &Ctx) {
690686// Note, creation of new allocation command can lead to the current context
691687// (Record->MCurContext) change.
692688AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq (
693- MemObjRecord *Record, const Requirement *Req, const QueueImplPtr & Queue,
689+ MemObjRecord *Record, const Requirement *Req, queue_impl * Queue,
694690 std::vector<Command *> &ToEnqueue) {
695691 auto Context = queue_impl::getContext (Queue);
696692 AllocaCommandBase *AllocaCmd =
@@ -709,8 +705,8 @@ AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
709705
710706 auto *ParentAlloca =
711707 getOrCreateAllocaForReq (Record, &ParentRequirement, Queue, ToEnqueue);
712- AllocaCmd = new AllocaSubBufCommand (Queue. get () , *Req, ParentAlloca,
713- ToEnqueue, ToCleanUp);
708+ AllocaCmd = new AllocaSubBufCommand (Queue, *Req, ParentAlloca, ToEnqueue ,
709+ ToCleanUp);
714710 } else {
715711
716712 const Requirement FullReq (/* Offset*/ {0 , 0 , 0 }, Req->MMemoryRange ,
@@ -786,8 +782,8 @@ AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
786782 }
787783 }
788784
789- AllocaCmd = new AllocaCommand (Queue. get (), FullReq, InitFromUserData,
790- LinkedAllocaCmd);
785+ AllocaCmd =
786+ new AllocaCommand (Queue, FullReq, InitFromUserData, LinkedAllocaCmd);
791787
792788 // Update linked command
793789 if (LinkedAllocaCmd) {
@@ -925,16 +921,16 @@ static void combineAccessModesOfReqs(std::vector<Requirement *> &Reqs) {
925921}
926922
927923Command *Scheduler::GraphBuilder::addCG (
928- std::unique_ptr<detail::CG> CommandGroup, const QueueImplPtr & Queue,
924+ std::unique_ptr<detail::CG> CommandGroup, queue_impl * Queue,
929925 std::vector<Command *> &ToEnqueue, bool EventNeeded,
930926 ur_exp_command_buffer_handle_t CommandBuffer,
931927 const std::vector<ur_exp_command_buffer_sync_point_t > &Dependencies) {
932928 std::vector<Requirement *> &Reqs = CommandGroup->getRequirements ();
933929 std::vector<detail::EventImplPtr> &Events = CommandGroup->getEvents ();
934930
935- auto NewCmd = std::make_unique<ExecCGCommand>(
936- std::move (CommandGroup), Queue. get (), EventNeeded, CommandBuffer,
937- std::move (Dependencies));
931+ auto NewCmd = std::make_unique<ExecCGCommand>(std::move (CommandGroup), Queue,
932+ EventNeeded, CommandBuffer,
933+ std::move (Dependencies));
938934
939935 if (!NewCmd)
940936 throw exception (make_error_code (errc::memory_allocation),
@@ -957,9 +953,9 @@ Command *Scheduler::GraphBuilder::addCG(
957953 bool isSameCtx = false ;
958954
959955 {
960- const QueueImplPtr & QueueForAlloca =
956+ queue_impl * QueueForAlloca =
961957 isInteropTask
962- ? static_cast <detail::CGHostTask &>(NewCmd->getCG ()).MQueue
958+ ? static_cast <detail::CGHostTask &>(NewCmd->getCG ()).MQueue . get ()
963959 : Queue;
964960
965961 Record = getOrInsertMemObjRecord (QueueForAlloca, Req);
@@ -989,15 +985,15 @@ Command *Scheduler::GraphBuilder::addCG(
989985 // Cannot directly copy memory from OpenCL device to OpenCL device -
990986 // create two copies: device->host and host->device.
991987 bool NeedMemMoveToHost = false ;
992- auto MemMoveTargetQueue = Queue;
988+ queue_impl * MemMoveTargetQueue = Queue;
993989
994990 if (isInteropTask) {
995991 const detail::CGHostTask &HT =
996992 static_cast <detail::CGHostTask &>(NewCmd->getCG ());
997993
998- if (!isOnSameContext (Record->MCurContext , HT.MQueue )) {
994+ if (!isOnSameContext (Record->MCurContext , HT.MQueue . get () )) {
999995 NeedMemMoveToHost = true ;
1000- MemMoveTargetQueue = HT.MQueue ;
996+ MemMoveTargetQueue = HT.MQueue . get () ;
1001997 }
1002998 } else if (Queue && Record->MCurContext )
1003999 NeedMemMoveToHost = true ;
@@ -1229,7 +1225,9 @@ Command *Scheduler::GraphBuilder::connectDepEvent(
12291225 try {
12301226 std::shared_ptr<detail::HostTask> HT (new detail::HostTask);
12311227 std::unique_ptr<detail::CG> ConnectCG (new detail::CGHostTask (
1232- std::move (HT), /* Queue = */ Cmd->getQueue (), /* Context = */ {},
1228+ std::move (HT),
1229+ /* Queue = */ Cmd->getQueue (),
1230+ /* Context = */ {},
12331231 /* Args = */ {},
12341232 detail::CG::StorageInitHelper (
12351233 /* ArgsStorage = */ {}, /* AccStorage = */ {},
@@ -1280,11 +1278,11 @@ Command *Scheduler::GraphBuilder::addCommandGraphUpdate(
12801278 ext::oneapi::experimental::detail::exec_graph_impl *Graph,
12811279 std::vector<std::shared_ptr<ext::oneapi::experimental::detail::node_impl>>
12821280 Nodes,
1283- const QueueImplPtr & Queue, std::vector<Requirement *> Requirements,
1281+ queue_impl * Queue, std::vector<Requirement *> Requirements,
12841282 std::vector<detail::EventImplPtr> &Events,
12851283 std::vector<Command *> &ToEnqueue) {
12861284 auto NewCmd =
1287- std::make_unique<UpdateCommandBufferCommand>(Queue. get () , Graph, Nodes);
1285+ std::make_unique<UpdateCommandBufferCommand>(Queue, Graph, Nodes);
12881286 // If there are multiple requirements for the same memory object, its
12891287 // AllocaCommand creation will be dependent on the access mode of the first
12901288 // requirement. Combine these access modes to take all of them into account.
0 commit comments