Skip to content

Commit 383459c

Browse files
committed
Renaming variables
1 parent 4478390 commit 383459c

File tree

1 file changed

+61
-62
lines changed
  • sycl/include/sycl/ext/oneapi/experimental

1 file changed

+61
-62
lines changed

sycl/include/sycl/ext/oneapi/experimental/graph.hpp

Lines changed: 61 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <list>
1414
#include <set>
1515

16-
//__SYCL_INLINE_NAMESPACE(cl) {
1716
namespace sycl {
1817
namespace ext {
1918
namespace oneapi {
@@ -30,117 +29,117 @@ using graph_ptr = std::shared_ptr<graph_impl>;
3029

3130
class wrapper {
3231
using T = std::function<void(sycl::handler &)>;
33-
T my_func;
34-
std::vector<sycl::event> my_deps;
32+
T MFunc;
33+
std::vector<sycl::event> MDeps;
3534

3635
public:
3736
wrapper(T t, const std::vector<sycl::event> &deps)
38-
: my_func(t), my_deps(deps){};
37+
: MFunc(t), MDeps(deps){};
3938

4039
void operator()(sycl::handler &cgh) {
41-
cgh.depends_on(my_deps);
42-
std::invoke(my_func, cgh);
40+
cgh.depends_on(MDeps);
41+
std::invoke(MFunc, cgh);
4342
}
4443
};
4544

4645
struct node_impl {
47-
bool is_scheduled;
46+
bool MScheduled;
4847

49-
graph_ptr my_graph;
50-
sycl::event my_event;
48+
graph_ptr MGraph;
49+
sycl::event MEvent;
5150

52-
std::vector<node_ptr> my_successors;
53-
std::vector<node_ptr> my_predecessors;
51+
std::vector<node_ptr> MSuccessors;
52+
std::vector<node_ptr> MPredecessors;
5453

55-
std::function<void(sycl::handler &)> my_body;
54+
std::function<void(sycl::handler &)> MBody;
5655

5756
void exec(sycl::queue q) {
58-
std::vector<sycl::event> __deps;
59-
for (auto i : my_predecessors)
60-
__deps.push_back(i->get_event());
61-
my_event = q.submit(wrapper{my_body, __deps});
57+
std::vector<sycl::event> deps;
58+
for (auto i : MPredecessors)
59+
deps.push_back(i->get_event());
60+
MEvent = q.submit(wrapper{MBody, deps});
6261
}
6362

6463
void register_successor(node_ptr n) {
65-
my_successors.push_back(n);
64+
MSuccessors.push_back(n);
6665
n->register_predecessor(node_ptr(this));
6766
}
6867

69-
void register_predecessor(node_ptr n) { my_predecessors.push_back(n); }
68+
void register_predecessor(node_ptr n) { MPredecessors.push_back(n); }
7069

71-
sycl::event get_event(void) { return my_event; }
70+
sycl::event get_event(void) { return MEvent; }
7271

7372
template <typename T>
7473
node_impl(graph_ptr g, T cgf)
75-
: is_scheduled(false), my_graph(g), my_body(cgf) {}
74+
: MScheduled(false), MGraph(g), MBody(cgf) {}
7675

7776
// Recursively adding nodes to execution stack:
7877
void topology_sort(std::list<node_ptr> &schedule) {
79-
is_scheduled = true;
80-
for (auto i : my_successors) {
81-
if (!i->is_scheduled)
78+
MScheduled = true;
79+
for (auto i : MSuccessors) {
80+
if (!i->MScheduled)
8281
i->topology_sort(schedule);
8382
}
8483
schedule.push_front(node_ptr(this));
8584
}
8685
};
8786

8887
struct graph_impl {
89-
std::set<node_ptr> my_roots;
90-
std::list<node_ptr> my_schedule;
88+
std::set<node_ptr> MRoots;
89+
std::list<node_ptr> MSchedule;
9190
// TODO: Change one time initialization to per executable object
92-
bool first;
91+
bool MFirst;
9392

94-
graph_ptr parent;
93+
graph_ptr MParent;
9594

9695
void exec(sycl::queue q) {
97-
if (my_schedule.empty()) {
98-
for (auto n : my_roots) {
99-
n->topology_sort(my_schedule);
96+
if (MSchedule.empty()) {
97+
for (auto n : MRoots) {
98+
n->topology_sort(MSchedule);
10099
}
101100
}
102-
for (auto n : my_schedule)
101+
for (auto n : MSchedule)
103102
n->exec(q);
104103
}
105104

106105
void exec_and_wait(sycl::queue q) {
107-
if (first) {
106+
if (MFirst) {
108107
exec(q);
109-
first = false;
108+
MFirst = false;
110109
}
111110
q.wait();
112111
}
113112

114113
void add_root(node_ptr n) {
115-
my_roots.insert(n);
116-
for (auto n : my_schedule)
117-
n->is_scheduled = false;
118-
my_schedule.clear();
114+
MRoots.insert(n);
115+
for (auto n : MSchedule)
116+
n->MScheduled = false;
117+
MSchedule.clear();
119118
}
120119

121120
void remove_root(node_ptr n) {
122-
my_roots.erase(n);
123-
for (auto n : my_schedule)
124-
n->is_scheduled = false;
125-
my_schedule.clear();
121+
MRoots.erase(n);
122+
for (auto n : MSchedule)
123+
n->MScheduled = false;
124+
MSchedule.clear();
126125
}
127126

128-
graph_impl() : first(true) {}
127+
graph_impl() : MFirst(true) {}
129128
};
130129

131130
} // namespace detail
132131

133132
struct node {
134-
detail::node_ptr my_node;
135-
detail::graph_ptr my_graph;
133+
detail::node_ptr MNode;
134+
detail::graph_ptr MGraph;
136135

137136
template <typename T>
138137
node(detail::graph_ptr g, T cgf)
139-
: my_graph(g), my_node(new detail::node_impl(g, cgf)){};
140-
void register_successor(node n) { my_node->register_successor(n.my_node); }
141-
void exec(sycl::queue q, sycl::event = sycl::event()) { my_node->exec(q); }
138+
: MGraph(g), MNode(new detail::node_impl(g, cgf)){};
139+
void register_successor(node n) { MNode->register_successor(n.MNode); }
140+
void exec(sycl::queue q, sycl::event = sycl::event()) { MNode->exec(q); }
142141

143-
void set_root() { my_graph->add_root(my_node); }
142+
void set_root() { MGraph->add_root(MNode); }
144143
};
145144

146145
enum class graph_state { modifiable, executable };
@@ -162,63 +161,63 @@ template <graph_state State = graph_state::modifiable> class command_graph {
162161
command_graph<graph_state::executable>
163162
finalize(const sycl::context &syclContext) const;
164163

165-
command_graph() : my_graph(new detail::graph_impl()) {}
164+
command_graph() : MGraph(new detail::graph_impl()) {}
166165

167166
private:
168-
detail::graph_ptr my_graph;
167+
detail::graph_ptr MGraph;
169168
};
170169

171170
template <> class command_graph<graph_state::executable> {
172171
public:
173-
int my_tag;
174-
const sycl::context &my_ctx;
172+
int MTag;
173+
const sycl::context &MCtx;
175174

176175
void exec_and_wait(sycl::queue q);
177176

178177
command_graph() = delete;
179178

180179
command_graph(detail::graph_ptr g, const sycl::context &ctx)
181-
: my_graph(g), my_ctx(ctx), my_tag(rand()) {}
180+
: MGraph(g), MCtx(ctx), MTag(rand()) {}
182181

183182
private:
184-
detail::graph_ptr my_graph;
183+
detail::graph_ptr MGraph;
185184
};
186185

187186
template <>
188187
template <typename T>
189188
node command_graph<graph_state::modifiable>::add(T cgf,
190189
const std::vector<node> &dep) {
191-
node _node(my_graph, cgf);
190+
node ret_val(MGraph, cgf);
192191
if (!dep.empty()) {
193192
for (auto n : dep)
194-
this->make_edge(n, _node);
193+
this->make_edge(n, ret_val);
195194
} else {
196-
_node.set_root();
195+
ret_val.set_root();
197196
}
198-
return _node;
197+
return ret_val;
199198
}
200199

201200
template <>
202201
void command_graph<graph_state::modifiable>::make_edge(node sender,
203202
node receiver) {
204203
sender.register_successor(receiver); // register successor
205-
my_graph->remove_root(receiver.my_node); // remove receiver from root node
204+
MGraph->remove_root(receiver.MNode); // remove receiver from root node
206205
// list
207206
}
208207

209208
template <>
210209
command_graph<graph_state::executable>
211210
command_graph<graph_state::modifiable>::finalize(
212211
const sycl::context &ctx) const {
213-
return command_graph<graph_state::executable>{this->my_graph, ctx};
212+
return command_graph<graph_state::executable>{this->MGraph, ctx};
214213
}
215214

216215
void command_graph<graph_state::executable>::exec_and_wait(sycl::queue q) {
217-
my_graph->exec_and_wait(q);
216+
MGraph->exec_and_wait(q);
218217
};
219218

220219
} // namespace experimental
221220
} // namespace oneapi
222221
} // namespace ext
223222
} // namespace sycl
224-
//} // __SYCL_INLINE_NAMESPACE(cl)
223+

0 commit comments

Comments
 (0)