Skip to content

[SYCL] Get rid of ForceFullReq flag #722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions sycl/include/CL/sycl/detail/scheduler/scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ class Scheduler {
// If none found, creates new one.
AllocaCommandBase *getOrCreateAllocaForReq(MemObjRecord *Record,
Requirement *Req,
QueueImplPtr Queue,
bool ForceFullReq = false);
QueueImplPtr Queue);

void markModifiedIfWrite(MemObjRecord *Record,
Requirement *Req);
Expand Down
25 changes: 10 additions & 15 deletions sycl/source/detail/scheduler/graph_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,20 +581,13 @@ AllocaCommandBase *Scheduler::GraphBuilder::findAllocaForReq(
// The function searches for the alloca command matching context and
// requirement. If none exists, new command will be created.
AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
MemObjRecord *Record, Requirement *Req, QueueImplPtr Queue,
bool ForceFullReq) {

Requirement FullReq(/*Offset*/ {0, 0, 0}, Req->MMemoryRange,
Req->MMemoryRange, access::mode::read_write,
Req->MSYCLMemObj, Req->MDims, Req->MElemSize);

Requirement *SearchReq = ForceFullReq ? &FullReq : Req;
MemObjRecord *Record, Requirement *Req, QueueImplPtr Queue) {

AllocaCommandBase *AllocaCmd =
findAllocaForReq(Record, SearchReq, Queue->get_context_impl());
findAllocaForReq(Record, Req, Queue->get_context_impl());

if (!AllocaCmd) {
if (!ForceFullReq && IsSuitableSubReq(Req)) {
if (IsSuitableSubReq(Req)) {
// Get parent requirement. It's hard to get right parents' range
// so full parent requirement has range represented in bytes
range<3> ParentRange{Req->MSYCLMemObj->getSize(), 1, 1};
Expand All @@ -604,12 +597,16 @@ AllocaCommandBase *Scheduler::GraphBuilder::getOrCreateAllocaForReq(
/*Working with bytes*/ sizeof(char));

auto *ParentAlloca =
getOrCreateAllocaForReq(Record, &ParentRequirement, Queue, true);
getOrCreateAllocaForReq(Record, &ParentRequirement, Queue);
AllocaCmd = new AllocaSubBufCommand(Queue, *Req, ParentAlloca);
UpdateLeafs(findDepsForReq(Record, Req, Queue), Record,
access::mode::read_write);
} else
} else {
Requirement FullReq(/*Offset*/ {0, 0, 0}, Req->MMemoryRange,
Req->MMemoryRange, access::mode::read_write,
Req->MSYCLMemObj, Req->MDims, Req->MElemSize);
AllocaCmd = new AllocaCommand(Queue, FullReq);
}

Record->MAllocaCommands.push_back(AllocaCmd);
Record->MWriteLeafs.push_back(AllocaCmd);
Expand Down Expand Up @@ -647,7 +644,6 @@ Scheduler::GraphBuilder::addCG(std::unique_ptr<detail::CG> CommandGroup,

for (Requirement *Req : Reqs) {
MemObjRecord *Record = getOrInsertMemObjRecord(Queue, Req);
bool ForceFullReq = !IsSuitableSubReq(Req);
markModifiedIfWrite(Record, Req);

// If there is alloca command we need to check if the latest memory is in
Expand All @@ -662,8 +658,7 @@ Scheduler::GraphBuilder::addCG(std::unique_ptr<detail::CG> CommandGroup,
insertMemCpyCmd(Record, Req, Queue);
}
}
AllocaCommandBase *AllocaCmd =
getOrCreateAllocaForReq(Record, Req, Queue, ForceFullReq);
AllocaCommandBase *AllocaCmd = getOrCreateAllocaForReq(Record, Req, Queue);
std::set<Command *> Deps = findDepsForReq(Record, Req, Queue);

for (Command *Dep : Deps)
Expand Down