Skip to content
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

Demonstrate splitting struct into individual scalars #150

Draft
wants to merge 1 commit into
base: swarm_backend
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,27 @@ void swarm_main() {
}
in_frontier_3 = new bool [swarm_runtime::builtin_getVertices(edges)]();
swarm_frontier.for_each_prio([&round, &frontier_list](unsigned level, frontier_struct src_struct, auto push) {
auto src = src_struct.src;
auto frontier_insert_round_0 = src_struct.frontier_insert_round_0;
switch (level % 5) {
case 0: {
push(level + 1, frontier_struct{src_struct.src, src_struct.frontier_insert_round_0});
push(level + 1, frontier_struct{src, frontier_insert_round_0});
break;
}
case 1: {
int32_t edgeZero = edges.h_src_offsets[src_struct.src];
int32_t edgeLast = edges.h_src_offsets[src_struct.src+1];
int32_t edgeZero = edges.h_src_offsets[src];
int32_t edgeLast = edges.h_src_offsets[src+1];
for (int i = edgeZero; i < edgeLast; i++) {
int dst = edges.h_edge_dst[i];
int src = src_struct.src;
int src = src;
if (visited_vertex_filter(dst)) {
{
bool result_var4 = (bool)0;
result_var4 = swarm_runtime::sum_reduce(num_paths[dst], num_paths[src]);
if (result_var4) {
if (!in_frontier_3[dst]) {
in_frontier_3[dst] = true;
push(level + 1, frontier_struct{dst, src_struct.frontier_insert_round_0});
push(level + 1, frontier_struct{dst, frontier_insert_round_0});
}
}
}
Expand All @@ -101,23 +103,23 @@ void swarm_main() {
break;
}
case 2: {
int v = src_struct.src;
int v = src;
{
in_frontier_3[v] = (bool)0;
}
;
push(level + 1, frontier_struct{src_struct.src, src_struct.frontier_insert_round_0});
push(level + 1, frontier_struct{src, frontier_insert_round_0});
break;
}
case 3: {
mark_visited(src_struct.src);
mark_visited(src);
;
push(level + 1, frontier_struct{src_struct.src, src_struct.frontier_insert_round_0});
push(level + 1, frontier_struct{src, frontier_insert_round_0});
break;
}
case 4: {
swarm_runtime::builtin_insert(frontier_list, src_struct.src, src_struct.frontier_insert_round_0);
push(level + 1, frontier_struct{src_struct.src, src_struct.frontier_insert_round_0 + 1});
swarm_runtime::builtin_insert(frontier_list, src, frontier_insert_round_0);
push(level + 1, frontier_struct{src, frontier_insert_round_0 + 1});
break;
}
}
Expand Down