15 inline namespace _V1 {
26 if (LHSStart < RHSStart) {
27 return (RHSStart < LHSEnd) && (LHSEnd <= RHSEnd);
29 return (LHSStart < RHSEnd) && (RHSEnd <= LHSEnd);
41 std::remove(MGenericCommands.
begin(), MGenericCommands.
end(), Cmd);
42 size_t RemovedCount = std::distance(NewEnd, MGenericCommands.
end());
43 MGenericCommands.
erase(NewEnd, MGenericCommands.
end());
49 return eraseHostAccessorCommand(
static_cast<EmptyCommand *
>(Cmd));
57 addHostAccessorCommand(
static_cast<EmptyCommand *
>(Cmd), ToEnqueue);
59 Result = addGenericCommand(Cmd, ToEnqueue);
65 std::vector<value_type> Result;
66 Result.reserve(MGenericCommands.
size() + MHostAccessorCommands.size());
68 Result.insert(Result.end(), MGenericCommands.
begin(), MGenericCommands.
end());
71 Result.push_back(Cmd);
76 bool LeavesCollection::addHostAccessorCommand(
EmptyCommand *Cmd,
77 EnqueueListT &ToEnqueue) {
80 HostAccessorCommandSingleXRefT OldCmdIt;
85 OldCmdIt = MHostAccessorCommands.end();
87 OldCmdIt = std::find_if(
88 MHostAccessorCommands.begin(), MHostAccessorCommands.end(),
90 return doOverlap(Test->getRequirement(), Cmd->getRequirement());
94 if (OldCmdIt != MHostAccessorCommands.end() && *OldCmdIt == Cmd)
100 if (OldCmdIt != MHostAccessorCommands.end()) {
102 MAllocateDependency(Cmd, *OldCmdIt, MRecord, ToEnqueue);
105 eraseHostAccessorCommand(
static_cast<EmptyCommand *
>(*OldCmdIt));
110 insertHostAccessorCommand(Cmd);
114 bool LeavesCollection::addGenericCommand(Command *Cmd,
115 EnqueueListT &ToEnqueue) {
116 if (MGenericCommands.
full()) {
117 Command *OldLeaf = MGenericCommands.
front();
123 MAllocateDependency(Cmd, OldLeaf, MRecord, ToEnqueue);
131 void LeavesCollection::insertHostAccessorCommand(EmptyCommand *Cmd) {
132 MHostAccessorCommandsXRef[Cmd] =
133 MHostAccessorCommands.insert(MHostAccessorCommands.end(), Cmd);
136 size_t LeavesCollection::eraseHostAccessorCommand(EmptyCommand *Cmd) {
137 auto XRefIt = MHostAccessorCommandsXRef.find(Cmd);
139 if (XRefIt == MHostAccessorCommandsXRef.end())
142 MHostAccessorCommands.erase(XRefIt->second);
143 MHostAccessorCommandsXRef.erase(XRefIt);
range< 3 > & MAccessRange
void erase(const_iterator Pos)
The Command class represents some action that needs to be performed on one or more memory objects.
CommandType getType() const
The empty command does nothing during enqueue.
const Requirement * getRequirement() const final
size_t remove(value_type Cmd)
Replacement for std::remove with subsequent call to erase(newEnd, end()).
bool push_back(value_type Cmd, EnqueueListT &ToEnqueue)
Returns true if insertion took place. Returns false otherwise.
std::vector< value_type > toVector() const
std::vector< Command * > EnqueueListT
static bool doOverlap(const Requirement *LHS, const Requirement *RHS)
Checks whether two requirements overlap or not.
static bool isHostAccessorCmd(Command *Cmd)