@@ -57,10 +57,6 @@ static bool isOnSameContext(const ContextImplPtr Context, queue_impl *Queue) {
57
57
// contexts comparison.
58
58
return Context == queue_impl::getContext (Queue);
59
59
}
60
- static bool isOnSameContext (const ContextImplPtr Context,
61
- const QueueImplPtr &Queue) {
62
- return isOnSameContext (Context, Queue.get ());
63
- }
64
60
65
61
// / Checks if the required access mode is allowed under the current one.
66
62
static bool isAccessModeAllowed (access::mode Required, access::mode Current) {
@@ -183,7 +179,7 @@ MemObjRecord *Scheduler::GraphBuilder::getMemObjRecord(SYCLMemObjI *MemObject) {
183
179
}
184
180
185
181
MemObjRecord *
186
- Scheduler::GraphBuilder::getOrInsertMemObjRecord (const QueueImplPtr & Queue,
182
+ Scheduler::GraphBuilder::getOrInsertMemObjRecord (queue_impl * Queue,
187
183
const Requirement *Req) {
188
184
SYCLMemObjI *MemObject = Req->MSYCLMemObj ;
189
185
MemObjRecord *Record = getMemObjRecord (MemObject);
@@ -231,8 +227,8 @@ Scheduler::GraphBuilder::getOrInsertMemObjRecord(const QueueImplPtr &Queue,
231
227
MemObject->MRecord .reset (
232
228
new MemObjRecord{InteropCtxPtr, LeafLimit, AllocateDependency});
233
229
std::vector<Command *> ToEnqueue;
234
- getOrCreateAllocaForReq (MemObject->MRecord .get (), Req, InteropQueuePtr,
235
- ToEnqueue);
230
+ getOrCreateAllocaForReq (MemObject->MRecord .get (), Req,
231
+ InteropQueuePtr. get (), ToEnqueue);
236
232
assert (ToEnqueue.empty () && " Creation of the first alloca for a record "
237
233
" shouldn't lead to any enqueuing (no linked "
238
234
" alloca or exceeding the leaf limit)." );
@@ -274,14 +270,13 @@ void Scheduler::GraphBuilder::addNodeToLeaves(
274
270
}
275
271
276
272
UpdateHostRequirementCommand *Scheduler::GraphBuilder::insertUpdateHostReqCmd (
277
- MemObjRecord *Record, Requirement *Req, const QueueImplPtr & Queue,
273
+ MemObjRecord *Record, Requirement *Req, queue_impl * Queue,
278
274
std::vector<Command *> &ToEnqueue) {
279
275
auto Context = queue_impl::getContext (Queue);
280
276
AllocaCommandBase *AllocaCmd = findAllocaForReq (Record, Req, Context);
281
277
assert (AllocaCmd && " There must be alloca for requirement!" );
282
278
UpdateHostRequirementCommand *UpdateCommand =
283
- new UpdateHostRequirementCommand (Queue.get (), *Req, AllocaCmd,
284
- &Req->MData );
279
+ new UpdateHostRequirementCommand (Queue, *Req, AllocaCmd, &Req->MData );
285
280
// Need copy of requirement because after host accessor destructor call
286
281
// dependencies become invalid if requirement is stored by pointer.
287
282
const Requirement *StoredReq = UpdateCommand->getRequirement ();
@@ -330,9 +325,10 @@ static Command *insertMapUnmapForLinkedCmds(AllocaCommandBase *AllocaCmdSrc,
330
325
return MapCmd;
331
326
}
332
327
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) {
336
332
AllocaCommandBase *AllocaCmdDst =
337
333
getOrCreateAllocaForReq (Record, Req, Queue, ToEnqueue);
338
334
if (!AllocaCmdDst)
@@ -519,7 +515,7 @@ Scheduler::GraphBuilder::addHostAccessor(Requirement *Req,
519
515
auto SYCLMemObj = static_cast <detail::SYCLMemObjT *>(Req->MSYCLMemObj );
520
516
SYCLMemObj->handleWriteAccessorCreation ();
521
517
}
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
523
519
// sent to getOrInsertMemObjRecord.
524
520
MemObjRecord *Record = getOrInsertMemObjRecord (nullptr , Req);
525
521
if (MPrintOptionsArray[BeforeAddHostAcc])
@@ -691,7 +687,7 @@ static bool checkHostUnifiedMemory(const ContextImplPtr &Ctx) {
691
687
// Note, creation of new allocation command can lead to the current context
692
688
// (Record->MCurContext) change.
693
689
AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq (
694
- MemObjRecord *Record, const Requirement *Req, const QueueImplPtr & Queue,
690
+ MemObjRecord *Record, const Requirement *Req, queue_impl * Queue,
695
691
std::vector<Command *> &ToEnqueue) {
696
692
auto Context = queue_impl::getContext (Queue);
697
693
AllocaCommandBase *AllocaCmd =
@@ -710,8 +706,8 @@ AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
710
706
711
707
auto *ParentAlloca =
712
708
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);
715
711
} else {
716
712
717
713
const Requirement FullReq (/* Offset*/ {0 , 0 , 0 }, Req->MMemoryRange ,
@@ -787,8 +783,8 @@ AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
787
783
}
788
784
}
789
785
790
- AllocaCmd = new AllocaCommand (Queue. get (), FullReq, InitFromUserData,
791
- LinkedAllocaCmd);
786
+ AllocaCmd =
787
+ new AllocaCommand (Queue, FullReq, InitFromUserData, LinkedAllocaCmd);
792
788
793
789
// Update linked command
794
790
if (LinkedAllocaCmd) {
@@ -926,16 +922,16 @@ static void combineAccessModesOfReqs(std::vector<Requirement *> &Reqs) {
926
922
}
927
923
928
924
Command *Scheduler::GraphBuilder::addCG (
929
- std::unique_ptr<detail::CG> CommandGroup, const QueueImplPtr & Queue,
925
+ std::unique_ptr<detail::CG> CommandGroup, queue_impl * Queue,
930
926
std::vector<Command *> &ToEnqueue, bool EventNeeded,
931
927
ur_exp_command_buffer_handle_t CommandBuffer,
932
928
const std::vector<ur_exp_command_buffer_sync_point_t > &Dependencies) {
933
929
std::vector<Requirement *> &Reqs = CommandGroup->getRequirements ();
934
930
std::vector<detail::EventImplPtr> &Events = CommandGroup->getEvents ();
935
931
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));
939
935
940
936
if (!NewCmd)
941
937
throw exception (make_error_code (errc::memory_allocation),
@@ -958,9 +954,9 @@ Command *Scheduler::GraphBuilder::addCG(
958
954
bool isSameCtx = false ;
959
955
960
956
{
961
- const QueueImplPtr & QueueForAlloca =
957
+ queue_impl * QueueForAlloca =
962
958
isInteropTask
963
- ? static_cast <detail::CGHostTask &>(NewCmd->getCG ()).MQueue
959
+ ? static_cast <detail::CGHostTask &>(NewCmd->getCG ()).MQueue . get ()
964
960
: Queue;
965
961
966
962
Record = getOrInsertMemObjRecord (QueueForAlloca, Req);
@@ -990,15 +986,15 @@ Command *Scheduler::GraphBuilder::addCG(
990
986
// Cannot directly copy memory from OpenCL device to OpenCL device -
991
987
// create two copies: device->host and host->device.
992
988
bool NeedMemMoveToHost = false ;
993
- auto MemMoveTargetQueue = Queue;
989
+ queue_impl * MemMoveTargetQueue = Queue;
994
990
995
991
if (isInteropTask) {
996
992
const detail::CGHostTask &HT =
997
993
static_cast <detail::CGHostTask &>(NewCmd->getCG ());
998
994
999
- if (!isOnSameContext (Record->MCurContext , HT.MQueue )) {
995
+ if (!isOnSameContext (Record->MCurContext , HT.MQueue . get () )) {
1000
996
NeedMemMoveToHost = true ;
1001
- MemMoveTargetQueue = HT.MQueue ;
997
+ MemMoveTargetQueue = HT.MQueue . get () ;
1002
998
}
1003
999
} else if (Queue && Record->MCurContext )
1004
1000
NeedMemMoveToHost = true ;
@@ -1230,7 +1226,9 @@ Command *Scheduler::GraphBuilder::connectDepEvent(
1230
1226
try {
1231
1227
std::shared_ptr<detail::HostTask> HT (new detail::HostTask);
1232
1228
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 = */ {},
1234
1232
/* Args = */ {},
1235
1233
detail::CG::StorageInitHelper (
1236
1234
/* ArgsStorage = */ {}, /* AccStorage = */ {},
@@ -1281,11 +1279,11 @@ Command *Scheduler::GraphBuilder::addCommandGraphUpdate(
1281
1279
ext::oneapi::experimental::detail::exec_graph_impl *Graph,
1282
1280
std::vector<std::shared_ptr<ext::oneapi::experimental::detail::node_impl>>
1283
1281
Nodes,
1284
- const QueueImplPtr & Queue, std::vector<Requirement *> Requirements,
1282
+ queue_impl * Queue, std::vector<Requirement *> Requirements,
1285
1283
std::vector<detail::EventImplPtr> &Events,
1286
1284
std::vector<Command *> &ToEnqueue) {
1287
1285
auto NewCmd =
1288
- std::make_unique<UpdateCommandBufferCommand>(Queue. get () , Graph, Nodes);
1286
+ std::make_unique<UpdateCommandBufferCommand>(Queue, Graph, Nodes);
1289
1287
// If there are multiple requirements for the same memory object, its
1290
1288
// AllocaCommand creation will be dependent on the access mode of the first
1291
1289
// requirement. Combine these access modes to take all of them into account.
0 commit comments