Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoduoza committed Nov 24, 2023
1 parent ef8043b commit 08172db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
22 changes: 12 additions & 10 deletions compiler/sam-outputs/onyx-dot/matmul_ikj.gv
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ digraph SAM {
6 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"]
12 [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"]
11 [comment="type=broadcast" shape=point style=invis type="broadcast"]
24 [comment="type=broadcast" shape=point style=invis type="broadcast"]
10 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"]
8 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"]
14 [comment="type=fiberlookup,index=k,tensor=B,mode=1,format=compressed,src=true,root=false" label="FiberLookup k: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="1" format="compressed" src="true" root="false"]
21 [comment="type=crddrop,outer=j,inner=val,mode=0" label="CrdDrop Compression j, val" color=orange style=filled type="crddrop" outer="j" inner="val" mode="0"]
21 [comment="type=crddrop,outer=k,inner=j" label="CrdDrop k,j" color=orange shape=box style=filled type="crddrop" outer="k" inner="j"]
22 [comment="type=crddrop,outer=k,inner=j" label="CrdDrop k,j" color=orange shape=box style=filled type="crddrop" outer="k" inner="j"]
23 [comment="type=crddrop,outer=i,inner=k" label="CrdDrop i,k" color=orange shape=box style=filled type="crddrop" outer="i" inner="k"]
19 -> 18 [label="crd" style=dashed type="crd" comment=""]
Expand All @@ -31,7 +32,6 @@ digraph SAM {
7 -> 6 [label="val" type="val"]
13 -> 12 [label="ref_out-C" style=bold type="ref" comment="out-C"]
12 -> 11 [label="crd" style=dashed type="crd" comment=""]
11 -> 20 [label="crd_j" style=dashed type="crd" comment="j" special="true"]
11 -> 10 [label="crd" style=dashed type="crd" comment=""]
10 -> 9 [label="repsig" style=dotted type="repsig"]
12 -> 8 [label="ref" style=bold type="ref" comment=""]
Expand All @@ -40,14 +40,16 @@ digraph SAM {
19 -> 14 [label="ref" style=bold type="ref" comment=""]
14 -> 13 [label="crd_in-B" style=dashed type="crd" comment="in-B"]
14 -> 13 [label="ref_in-B" style=bold type="ref" comment="in-B"]
6 -> 20 [label="mul_val_out" type="val"]
21 -> 0 [label="val" type="val" comment="inner-val"]
21 -> 22 [label="crd_inner-j" style=dashed type="crd" comment="outer-j"]
13 -> 22 [label="crd_outer-k" style=dashed type="crd" comment="outer-k"]
20 -> 21 [label="val" type="val" comment="inner-val"]
20 -> 21 [label="crd_inner-j" style=dashed type="crd" comment="outer-j"]
22 -> 1 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"]
22 -> 23 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"]
6 -> 21 [label="val_inner-j" type="val" comment="inner-j"]
21 -> 20 [label="val_inner-j" type="val"]
13 -> 24 [label="crd_outer-k" style=dashed type="crd" comment="outer-k"]
24 -> 22 [label="crd_outer-k" style=dashed type="crd" comment="outer-k" special="true"]
24 -> 21 [label="crd_outer-k" style=dashed type="crd" comment="outer-k" special="true"]
11 -> 22 [label="crd_inner-j" style=dashed type="crd" comment="inner-j" special="true"]
22 -> 20 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"]
19 -> 23 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"]
23 -> 2 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"]
20 -> 0 [label="final_vals" type="val"]
20 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"]
22 -> 23 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"]
}
19 changes: 14 additions & 5 deletions sam/onyx/hw_nodes/merge_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,22 @@ def connect(self, other, edge, kwargs=None):

return new_conns
elif other_type == IntersectNode:
e_attr = edge.get_attributes()
e_type = e_attr['type'].strip('"')
isect = other.get_name()
print("MERGE TO UNION FOR VECTOR REDUCE")
new_conns = {
f'merge_to_union_inner': [
([(merge, f"cmrg_coord_out_{0}"), (isect, f"coord_in_{0}")], 17),
]
}
if "crd" in e_type:
new_conns = {
f'merge_to_union_inner': [
([(merge, f"cmrg_coord_out_{0}"), (isect, f"coord_in_{0}")], 17),
]
}
elif "val" in e_type:
new_conns = {
f'merge_to_union_inner': [
([(merge, f"cmrg_coord_out_{0}"), (isect, f"pos_in_{0}")], 17),
]
}

return new_conns
# raise NotImplementedError(f'Cannot connect MergeNode to {other_type}')
Expand Down
5 changes: 3 additions & 2 deletions sam/onyx/parse_dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def rewrite_VectorReducer(self):

print(crd_edge_attr)
print(val_edge_attr)
del crd_edge_attr['comment']

# crd_rd_scan_to_glb = pydot.Edge(src=crd_rd_scanner, dst=dst_crd, **crd_edge_attr, use_alt_out_port="1")
# val_rd_scan_to_glb = pydot.Edge(src=vals_rd_scanner, dst=dst_vals, **val_edge_attr, use_alt_out_port="1")
Expand All @@ -365,13 +366,13 @@ def rewrite_VectorReducer(self):
src=crd_rd_scanner,
dst=dst_crd,
**crd_edge_attr,
#comment="final-crd",
comment="final-crd",
vector_reduce_mode=True)
val_rd_scan_to_ds = pydot.Edge(
src=vals_rd_scanner,
dst=dst_vals,
**val_edge_attr,
#comment="final-val",
comment="final-val",
vector_reduce_mode=True)

# self.graph.add_edge(input_to_rsg_edge)
Expand Down

0 comments on commit 08172db

Please sign in to comment.