Node Fusion x4

This commit is contained in:
Anton Reinhard 2023-05-27 15:38:10 +02:00
parent 572b0adf0f
commit 190a4252f8
2 changed files with 10 additions and 5 deletions

View File

@ -83,7 +83,7 @@ function main()
insert_edge(graph, make_edge(PB, d_PB_uB))
insert_edge(graph, make_edge(PA, d_PA_uA))
insert_edge(graph, make_edge(PBp, d_PBp_uBp))
insert_edge(graph, make_edge(PBp, d_PBp_uBp))
insert_edge(graph, make_edge(PAp, d_PAp_uAp))
insert_edge(graph, make_edge(d_PB_uB, uB))
@ -111,11 +111,16 @@ function main()
print(graph)
node_fusion(graph, PB, d_PB_uB, uB)
# fuse some things
fuse1 = node_fusion(graph, PB, d_PB_uB, uB)
fuse2 = node_fusion(graph, PA, d_PA_uA, uA)
fuse3 = node_fusion(graph, PBp, d_PBp_uBp, uBp)
fuse4 = node_fusion(graph, PAp, d_PAp_uAp, uAp)
# on this graph, nothing can be reduced
println("Same graph after node fusion")
print(graph)
end
main()

View File

@ -1,4 +1,4 @@
# Fuse nodes n1 -> n2 -> n3 together into one node, return the resulting new node
function node_fusion(graph::DAG, n1::ComputeTaskNode, n2::DataTaskNode, n3::ComputeTaskNode)
if !(n1 in graph) || !(n2 in graph) || !(n3 in graph)
error("[Node Fusion] The given nodes are not part of the given graph")
@ -34,7 +34,7 @@ function node_fusion(graph::DAG, n1::ComputeTaskNode, n2::DataTaskNode, n3::Comp
insert_edge(graph, make_edge(new_node, parent))
end
return nothing
return new_node
end
function node_reduction(graph::DAG, n1::Node, n2::Node)