Skip to content

Commit b4ab2f2

Browse files
author
Sergey Kanaev
committed
[SYCL] Eliminate for-loop whilst constructing deps of connect-cmd
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent 90f73c4 commit b4ab2f2

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

sycl/source/detail/scheduler/graph_builder.cpp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -944,30 +944,14 @@ void Scheduler::GraphBuilder::connectDepEvent(Command *const Cmd,
944944

945945
// make ConnectCmd depend on requirement
946946
{
947-
MemObjRecord *Record = getMemObjRecord(Req->MSYCLMemObj);
948-
Dep.MDepCommand->addUser(ConnectCmd);
949-
950-
AllocaCommandBase *AllocaCmd =
951-
findAllocaForReq(Record, Req, DepEventContext);
952-
assert(AllocaCmd && "There must be alloca for requirement!");
953-
954-
std::set<Command *> Deps = findDepsForReq(Record, Req, DepEventContext);
955-
assert(Deps.size() && "There must be some deps");
956-
957-
for (Command *ReqDepCmd : Deps) {
958-
// we don't want to depend on any host task as the only "entry point" to
959-
// host task is its empty cmd which is in Deps anyway
960-
if (ReqDepCmd->getType() == Command::CommandType::RUN_CG) {
961-
auto *Cmd = static_cast<ExecCGCommand *>(ReqDepCmd);
962-
if (Cmd->getCG().getType() == CG::CGTYPE::CODEPLAY_HOST_TASK)
963-
continue;
964-
}
947+
ConnectCmd->addDep(Dep);
948+
assert(reinterpret_cast<Command *>(DepEvent->getCommand()) ==
949+
Dep.MDepCommand);
950+
// add user to Dep.MDepCommand is already performed beyond this if branch
965951

966-
ConnectCmd->addDep(DepDesc{ReqDepCmd, Req, AllocaCmd});
967-
ReqDepCmd->addUser(ConnectCmd);
968-
}
952+
MemObjRecord *Record = getMemObjRecord(Req->MSYCLMemObj);
969953

970-
updateLeaves(Deps, Record, Req->MAccessMode);
954+
updateLeaves({ Dep.MDepCommand }, Record, Req->MAccessMode);
971955
addNodeToLeaves(Record, ConnectCmd, Req->MAccessMode);
972956
}
973957

0 commit comments

Comments
 (0)