Skip to content

[SYCL] Add empty task type of commands #725

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 15, 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
20 changes: 19 additions & 1 deletion sycl/include/CL/sycl/detail/scheduler/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class Command {
RELEASE,
MAP_MEM_OBJ,
UNMAP_MEM_OBJ,
UPDATE_REQUIREMENT
UPDATE_REQUIREMENT,
EMPTY_TASK
};

Command(CommandType Type, QueueImplPtr Queue, bool UseExclusiveQueue = false);
Expand Down Expand Up @@ -123,6 +124,23 @@ class Command {
std::atomic<bool> MEnqueued;
};

// The command does nothing during enqueue. The task can be used to implement
// lock in the graph, or to merge several nodes into one.
class EmptyCommand : public Command {
public:
EmptyCommand(QueueImplPtr Queue, Requirement *Req)
: Command(CommandType::EMPTY_TASK, std::move(Queue)),
MStoredRequirement(*Req) {}

Requirement *getStoredRequirement() { return &MStoredRequirement; }

private:
cl_int enqueueImp() override { return CL_SUCCESS; }
void printDot(std::ostream &Stream) const override;

Requirement MStoredRequirement;
};

// The command enqueues release instance of memory allocated on Host or
// underlying framework.
class ReleaseCommand : public Command {
Expand Down
17 changes: 17 additions & 0 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,23 @@ cl_int MemCpyCommandHost::enqueueImp() {
return CL_SUCCESS;
}

void EmptyCommand::printDot(std::ostream &Stream) const {
Stream << "\"" << this << "\" [style=filled, fillcolor=\"#8d8f29\", label=\"";

Stream << "ID = " << this << "\n";
Stream << "EMPTY NODE"
<< "\\n";

Stream << "\"];" << std::endl;

for (const auto &Dep : MDeps) {
Stream << " \"" << this << "\" -> \"" << Dep.MDepCommand << "\""
<< " [ label = \"Access mode: "
<< accessModeToString(Dep.MReq->MAccessMode) << "\\n"
<< "MemObj: " << Dep.MReq->MSYCLMemObj << " \" ]" << std::endl;
}
}

void MemCpyCommandHost::printDot(std::ostream &Stream) const {
Stream << "\"" << this << "\" [style=filled, fillcolor=\"#B6A2EB\", label=\"";

Expand Down