diff --git a/compiler/sam-outputs/onyx-dot/mat_elemadd_leakyrelu_exp.gv b/compiler/sam-outputs/onyx-dot/mat_elemadd_leakyrelu_exp.gv index e360afc4..093b5502 100644 --- a/compiler/sam-outputs/onyx-dot/mat_elemadd_leakyrelu_exp.gv +++ b/compiler/sam-outputs/onyx-dot/mat_elemadd_leakyrelu_exp.gv @@ -11,7 +11,7 @@ digraph SAM { 12 [comment="broadcast" shape=point style=invis type="broadcast"] 13 [comment="type=fp_mul,const0=0.2" label="FP_Mul * 0.2" color=brown shape=box style=filled type="fp_mul" const0="0.2"] 14 [comment="type=fp_max" label="FP_Max" color=brown shape=box style=filled type="fp_max"] - 15 [comment="type=exp" label="Exp" color=brown shape=box style=filled type="exp"] + 15 [comment="type=fp_exp" label="FP_Exp" color=brown shape=box style=filled type="fp_exp"] 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*B1_dim" sink="true"] 5 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] 8 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="compressed" src="true" root="false"] diff --git a/compiler/sam-outputs/onyx-dot/mat_elemdiv.gv b/compiler/sam-outputs/onyx-dot/mat_elemdiv.gv new file mode 100644 index 00000000..1e1529f5 --- /dev/null +++ b/compiler/sam-outputs/onyx-dot/mat_elemdiv.gv @@ -0,0 +1,35 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss01" + 11 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="true"] + 10 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] + 6 [comment="type=crddrop,outer=i,inner=j" label="CrdDrop i,j" color=orange shape=box style=filled type="crddrop" outer="i" inner="j"] + 2 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=2,crdsize=B0_dim,sink=true" label="FiberWrite i: X0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="X" mode="0" format="compressed" segsize="2" crdsize="B0_dim" sink="true"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*B1_dim,sink=true" label="FiberWrite j: X1\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="1" format="compressed" segsize="B0_dim+1" crdsize="B0_dim*B1_dim" sink="true"] + 8 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="compressed" src="true" root="false"] + 7 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] + 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 3 [comment="type=fp_div" label="FP_Div" color=brown shape=box style=filled type="fp_div"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*B1_dim" sink="true"] + 5 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 9 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="compressed" src="true" root="false"] + 12 [comment="type=fiberlookup,index=i,tensor=C,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="C" mode="0" format="compressed" src="true" root="true"] + 11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 10 -> 6 [label="crd_in-i" style=dashed type="crd" comment="in-i"] + 6 -> 2 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] + 6 -> 1 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] + 10 -> 8 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 8 -> 7 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 7 -> 6 [label="crd_in-j" style=dashed type="crd" comment="in-j"] + 7 -> 4 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 7 -> 5 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 5 -> 3 [label="val" type="val"] + 8 -> 7 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 10 -> 9 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 9 -> 7 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 9 -> 7 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 11 -> 10 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 12 -> 10 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 12 -> 10 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/sam/onyx/parse_dot.py b/sam/onyx/parse_dot.py index 76015ff3..7d7a9062 100644 --- a/sam/onyx/parse_dot.py +++ b/sam/onyx/parse_dot.py @@ -306,7 +306,7 @@ def rewrite_complex_ops(self): # as the rom in sparse flow will use fiber access if instance_name.split("_")[0] == "bit" and instance_name.split("_")[1] == "const": continue - # the last two string of the instance name is the stance id, we only want the op + # the last two string of the instance name is the instance id, we only want the op new_alu_node_op = '_'.join(instance_name.split("_")[0:-2]) new_alu_node = pydot.Node(f"{instance_name}_{self.get_next_seq()}", label=f"{complex_node_label}_{new_alu_node_op}", @@ -366,13 +366,14 @@ def rewrite_complex_ops(self): # if the src port is a node originally connects to the input of the complex op # inherit the edge properties of that edge if "self.in" in src_port: - # FIXME: only support a single input complex op for now - src_node = incoming_edges[0].get_source() + # input ports to the complex ops are of the name "self.in{idx}.0" + incoming_edge_idx = int(src_port.split(".")[1].strip("in")) + src_node = incoming_edges[incoming_edge_idx].get_source() # an edge connot be a incoming to and outgoing from the complex op simultaneously assert not edge_attr - edge_attr = incoming_edges[0].get_attributes() - # connecting to a new node, use the port specified by metamapper - self.graph.del_edge(incoming_edges[0].get_source(), incoming_edges[0].get_destination()) + edge_attr = incoming_edges[incoming_edge_idx].get_attributes() + self.graph.del_edge(incoming_edges[incoming_edge_idx].get_source(), + incoming_edges[incoming_edge_idx].get_destination()) # the srouce node is not a PE we just stamp out, skip the connection elif src_node_name not in instance_name_node_mappging: break @@ -1292,7 +1293,7 @@ def duplicate_graph(self, tensor, factor, output='x'): def annotate_IO_nodes(self): original_nodes = self.graph.get_nodes() output_nodes = ['x', 'X'] - input_nodes = ['c', 'C', 'b', 'B', 'd', 'D', 'e', 'E', 'f', 'F', 'exp'] + input_nodes = ['c', 'C', 'b', 'B', 'd', 'D', 'e', 'E', 'f', 'F', 'fp_exp', 'fp_div'] exclude_nodes = ['b', 'B'] for node in original_nodes: node_attrs = node.get_attributes()