From 54c66b7cb45970c86aba61591938e5aa35b4bccf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Nov 2023 11:12:52 -0800 Subject: [PATCH 1/9] Add VR SAM updates --- sam/onyx/hw_nodes/buffet_node.py | 12 +- sam/onyx/hw_nodes/compute_node.py | 14 +- sam/onyx/hw_nodes/fiberaccess_node.py | 9 +- sam/onyx/hw_nodes/hw_node.py | 2 +- sam/onyx/hw_nodes/intersect_node.py | 14 +- sam/onyx/hw_nodes/merge_node.py | 11 +- sam/onyx/hw_nodes/read_scanner_node.py | 39 +- sam/onyx/hw_nodes/write_scanner_node.py | 31 +- sam/onyx/parse_dot.py | 191 ++-- sam/sim/src/accumulator.py | 1084 +++++++++-------------- 10 files changed, 637 insertions(+), 770 deletions(-) diff --git a/sam/onyx/hw_nodes/buffet_node.py b/sam/onyx/hw_nodes/buffet_node.py index e2473e9d..828f1337 100644 --- a/sam/onyx/hw_nodes/buffet_node.py +++ b/sam/onyx/hw_nodes/buffet_node.py @@ -124,8 +124,16 @@ def configure(self, attributes): cap0 = kratos.clog2(capacity_0) - fetch_width_log cap1 = kratos.clog2(capacity_1) - fetch_width_log + if 'vector_reduce_mode' in attributes: + is_in_vr_mode = attributes['vector_reduce_mode'].strip('"') + if is_in_vr_mode == "true": + vr_mode = 1 + else: + vr_mode = 0 + cfg_kwargs = { 'capacity_0': cap0, - 'capacity_1': cap1 + 'capacity_1': cap1, + 'vr_mode': vr_mode } - return (capacity_0, capacity_1), cfg_kwargs + return (capacity_0, capacity_1, vr_mode), cfg_kwargs diff --git a/sam/onyx/hw_nodes/compute_node.py b/sam/onyx/hw_nodes/compute_node.py index 2482f399..560aa4db 100644 --- a/sam/onyx/hw_nodes/compute_node.py +++ b/sam/onyx/hw_nodes/compute_node.py @@ -62,12 +62,16 @@ def connect(self, other, edge, kwargs=None): pe = self.get_name() # isect_conn = other.get_num_inputs() - if 'tensor' not in edge.get_attributes(): - # Taking some liberties here - but technically this is the combo val - # isect_conn = other.get_connection_from_tensor('B') - isect_conn = other.get_connection_from_tensor('C') + if 'vector_reduce_mode' in edge.get_attributes(): + if edge.get_attributes()['vector_reduce_mode'] == True: + isect_conn = 0 else: - isect_conn = other.get_connection_from_tensor(edge.get_tensor()) + if 'tensor' not in edge.get_attributes(): + # Taking some liberties here - but technically this is the combo val + # isect_conn = other.get_connection_from_tensor('B') + isect_conn = other.get_connection_from_tensor('C') + else: + isect_conn = other.get_connection_from_tensor(edge.get_tensor()) new_conns = { f'pe_to_isect_{in_str}_{isect_conn}': [ diff --git a/sam/onyx/hw_nodes/fiberaccess_node.py b/sam/onyx/hw_nodes/fiberaccess_node.py index 89b12e6e..63e7c85f 100644 --- a/sam/onyx/hw_nodes/fiberaccess_node.py +++ b/sam/onyx/hw_nodes/fiberaccess_node.py @@ -228,9 +228,12 @@ def configure(self, attributes, flavor): cfg_tuple, cfg_kwargs = self.get_flavor(flavor=flavor).configure(attributes) cfg_kwargs['flavor'] = flavor + print("THESE ARE MY CONFIG KWARGS") + print(cfg_kwargs) + #breakpoint() - vr_mode = 0 - cfg_tuple += (vr_mode,) - cfg_kwargs["vr_mode"] = vr_mode + #vr_mode = 0 + #cfg_tuple += (vr_mode,) + #cfg_kwargs["vr_mode"] = vr_mode return cfg_tuple, cfg_kwargs diff --git a/sam/onyx/hw_nodes/hw_node.py b/sam/onyx/hw_nodes/hw_node.py index 5991a225..9b7d8847 100644 --- a/sam/onyx/hw_nodes/hw_node.py +++ b/sam/onyx/hw_nodes/hw_node.py @@ -16,7 +16,7 @@ class HWNodeType(Enum): Broadcast = 12 RepSigGen = 13 CrdHold = 14 - SpAccumulator = 15 + VectorReducer = 15 FiberAccess = 16 diff --git a/sam/onyx/hw_nodes/intersect_node.py b/sam/onyx/hw_nodes/intersect_node.py index 18e20d9e..5f4617d4 100644 --- a/sam/onyx/hw_nodes/intersect_node.py +++ b/sam/onyx/hw_nodes/intersect_node.py @@ -180,6 +180,7 @@ def connect(self, other, edge, kwargs=None): print(edge.get_attributes()) edge_comment = edge.get_attributes()['comment'].strip('"') tensor = edge_comment.split('-')[1] + print(self.tensor_to_conn) out_conn = self.tensor_to_conn[tensor] compute_conn = compute.get_num_inputs() new_conns = { @@ -248,6 +249,15 @@ def configure(self, attributes): cmrg_enable = 0 cmrg_stop_lvl = 0 type_op = attributes['type'].strip('"') + + + if 'vector_reduce_mode' in attributes: + is_in_vr_mode = attributes['vector_reduce_mode'].strip('"') + if is_in_vr_mode == "true": + vr_mode = 1 + else: + vr_mode = 0 + if type_op == "intersect": op = JoinerOp.INTERSECT.value elif type_op == "union": @@ -258,6 +268,6 @@ def configure(self, attributes): 'cmrg_enable': cmrg_enable, 'cmrg_stop_lvl': cmrg_stop_lvl, 'op': op, - 'vr_mode': 0 + 'vr_mode': vr_mode } - return (cmrg_enable, cmrg_stop_lvl, op, 0), cfg_kwargs + return (cmrg_enable, cmrg_stop_lvl, op, vr_mode), cfg_kwargs diff --git a/sam/onyx/hw_nodes/merge_node.py b/sam/onyx/hw_nodes/merge_node.py index c0b3d158..5dccdb88 100644 --- a/sam/onyx/hw_nodes/merge_node.py +++ b/sam/onyx/hw_nodes/merge_node.py @@ -62,7 +62,16 @@ def connect(self, other, edge, kwargs=None): return new_conns elif other_type == IntersectNode: - raise NotImplementedError(f'Cannot connect MergeNode to {other_type}') + 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), + ] + } + + return new_conns + #raise NotImplementedError(f'Cannot connect MergeNode to {other_type}') elif other_type == ReduceNode: # raise NotImplementedError(f'Cannot connect MergeNode to {other_type}') other_red = other.get_name() diff --git a/sam/onyx/hw_nodes/read_scanner_node.py b/sam/onyx/hw_nodes/read_scanner_node.py index 63e8023f..64c4cad0 100644 --- a/sam/onyx/hw_nodes/read_scanner_node.py +++ b/sam/onyx/hw_nodes/read_scanner_node.py @@ -90,6 +90,9 @@ def connect(self, other, edge, kwargs=None): edge_attr = edge.get_attributes() if 'use_alt_out_port' in edge_attr: out_conn = 'block_rd_out' + elif ('vector_reduce_mode' in edge_attr): + if (edge_attr['vector_reduce_mode'] == True): + out_conn = 'pos_out' else: out_conn = 'coord_out' @@ -102,7 +105,13 @@ def connect(self, other, edge, kwargs=None): elif other_type == IntersectNode: # Send both.... isect = other.get_name() - isect_conn = other.get_connection_from_tensor(self.get_tensor()) + if 'vector_reduce_mode' in edge.get_attributes(): + if edge.get_attributes()['vector_reduce_mode'] == True: + isect_conn = 1 + elif 'special' in edge.get_attributes(): + isect_conn = 0 + else: + isect_conn = other.get_connection_from_tensor(self.get_tensor()) e_attr = edge.get_attributes() # isect_conn = 0 @@ -247,12 +256,12 @@ def configure(self, attributes): dim_size = 1 stop_lvl = 0 - if 'spacc' in attributes: - spacc_mode = 1 - assert 'stop_lvl' in attributes - stop_lvl = int(attributes['stop_lvl'].strip('"')) - else: - spacc_mode = 0 + #if 'spacc' in attributes: + # spacc_mode = 1 + # assert 'stop_lvl' in attributes + # stop_lvl = int(attributes['stop_lvl'].strip('"')) + #else: + # spacc_mode = 0 # This is a fiberwrite's opposing read scanner for comms with GLB if attributes['type'].strip('"') == 'fiberwrite': @@ -283,6 +292,15 @@ def configure(self, attributes): lookup = 0 block_mode = int(attributes['type'].strip('"') == 'fiberwrite') + + if 'vector_reduce_mode' in attributes: + is_in_vr_mode = attributes['vector_reduce_mode'].strip('"') + if is_in_vr_mode == "true": + vr_mode = 1 + else: + vr_mode = 0 + + cfg_kwargs = { 'dense': dense, 'dim_size': dim_size, @@ -294,11 +312,12 @@ def configure(self, attributes): 'do_repeat': do_repeat, 'repeat_outer': repeat_outer, 'repeat_factor': repeat_factor, - 'stop_lvl': stop_lvl, + #'stop_lvl': stop_lvl, 'block_mode': block_mode, 'lookup': lookup, - 'spacc_mode': spacc_mode + #'spacc_mode': spacc_mode + 'vr_mode': vr_mode } return (inner_offset, max_outer_dim, strides, ranges, is_root, do_repeat, - repeat_outer, repeat_factor, stop_lvl, block_mode, lookup, spacc_mode), cfg_kwargs + repeat_outer, repeat_factor, block_mode, lookup, vr_mode), cfg_kwargs diff --git a/sam/onyx/hw_nodes/write_scanner_node.py b/sam/onyx/hw_nodes/write_scanner_node.py index a61a2172..4ac63f81 100644 --- a/sam/onyx/hw_nodes/write_scanner_node.py +++ b/sam/onyx/hw_nodes/write_scanner_node.py @@ -79,6 +79,7 @@ def connect(self, other, edge, kwargs=None): def configure(self, attributes): stop_lvl = 0 + init_blank = 0 # compressed = int(attributes['format'] == 'compressed') if 'format' in attributes and 'vals' in attributes['format'].strip('"'): @@ -89,14 +90,14 @@ def configure(self, attributes): else: compressed = 1 - if 'spacc' in attributes: - spacc_mode = 1 - init_blank = 1 - assert 'stop_lvl' in attributes - stop_lvl = int(attributes['stop_lvl'].strip('"')) - else: - spacc_mode = 0 - init_blank = 0 + #if 'spacc' in attributes: + # spacc_mode = 1 + # init_blank = 1 + # assert 'stop_lvl' in attributes + # stop_lvl = int(attributes['stop_lvl'].strip('"')) + #else: + # spacc_mode = 0 + # init_blank = 0 # compressed = int(attributes['format'] == 'compressed') if attributes['type'].strip('"') == 'arrayvals': @@ -111,17 +112,25 @@ def configure(self, attributes): block_mode = 1 else: block_mode = 0 + + if 'vector_reduce_mode' in attributes: + is_in_vr_mode = attributes['vector_reduce_mode'].strip('"') + if is_in_vr_mode == "true": + vr_mode = 1 + else: + vr_mode = 0 # block_mode = int(attributes['type'].strip('"') == 'fiberlookup') # cfg_tuple = (inner_offset, compressed, lowest_level, stop_lvl, block_mode) - cfg_tuple = (compressed, lowest_level, stop_lvl, block_mode, init_blank, spacc_mode) + cfg_tuple = (compressed, lowest_level, stop_lvl, block_mode, vr_mode, init_blank) cfg_kwargs = { # 'inner_offset': inner_offset, 'compressed': compressed, 'lowest_level': lowest_level, 'stop_lvl': stop_lvl, 'block_mode': block_mode, - 'init_blank': init_blank, - 'spacc_mode': spacc_mode + 'vr_mode': vr_mode, + 'init_blank': init_blank + #'spacc_mode': spacc_mode } return cfg_tuple, cfg_kwargs diff --git a/sam/onyx/parse_dot.py b/sam/onyx/parse_dot.py index 7fae6744..b21f553d 100644 --- a/sam/onyx/parse_dot.py +++ b/sam/onyx/parse_dot.py @@ -37,7 +37,7 @@ def __init__(self, filename=None, local_mems=True, use_fork=False, # Rewrite each 3-input joiners to 3 2-input joiners self.rewrite_tri_to_binary() - self.rewrite_spacc_1() + self.rewrite_VectorReducer() # Passes to lower to CGRA self.rewrite_lookup() @@ -111,8 +111,8 @@ def map_nodes(self): hw_nt = f"HWNodeType.Merge" elif n_type == "crdhold": hw_nt = f"HWNodeType.CrdHold" - elif n_type == "spaccumulator": - hw_nt = f"HWNodeType.SpAccumulator" + elif n_type == "vectorreducer": + hw_nt = f"HWNodeType.VectorReducer " else: print(n_type) raise SAMDotGraphLoweringError(f"Node is of type {n_type}") @@ -130,32 +130,32 @@ def find_node_by_name(self, name): return node assert False - def rewrite_spacc_1(self): + def rewrite_VectorReducer(self): - # Get the spacc node and the resulting fiberwrites + # Get the vr node and the resulting fiberwrites nodes_to_proc = [] for node in self.graph.get_nodes(): node_type = node.get_attributes()['type'].strip('"') - if 'spaccumulator' in node_type and '1' in node.get_attributes()['order'].strip('"'): + if 'vectorreducer' in node_type: # nodes_to_proc.append(node.get_name()) nodes_to_proc.append(node) - for spacc_node in nodes_to_proc: + for vr_node in nodes_to_proc: - attrs = spacc_node.get_attributes() + attrs = vr_node.get_attributes() og_label = attrs['label'].strip('"') del attrs['label'] # TODO: Get redux crd - output_crd = attrs['in0'].strip('"') - input_crd = None + output_crd = attrs['accum_index'].strip('"') + #input_crd = None - incoming_edges = [edge for edge in self.graph.get_edges() if edge.get_destination() == spacc_node.get_name()] - outgoing_edges = [edge for edge in self.graph.get_edges() if edge.get_source() == spacc_node.get_name()] + incoming_edges = [edge for edge in self.graph.get_edges() if edge.get_destination() == vr_node.get_name()] + outgoing_edges = [edge for edge in self.graph.get_edges() if edge.get_source() == vr_node.get_name()] in_val_node = None - in_output_node = None - in_input_node = None + in_crd_node = None + #in_input_node = None # Keep these for the edges in_edge_attrs = {} @@ -167,14 +167,14 @@ def rewrite_spacc_1(self): in_val_node = incoming_edge_.get_source() in_edge_attrs[in_val_node] = edge_attr elif edge_attr['type'].strip('"') == 'crd': - edge_comment = edge_attr['comment'].strip('"') - if output_crd in edge_comment: - in_output_node = incoming_edge_.get_source() - in_edge_attrs[in_output_node] = edge_attr - else: - input_crd = edge_comment - in_input_node = incoming_edge_.get_source() - in_edge_attrs[in_input_node] = edge_attr + #edge_comment = edge_attr['comment'].strip('"') + #if output_crd in edge_comment: + in_crd_node = incoming_edge_.get_source() + in_edge_attrs[in_crd_node] = edge_attr + #else: + # input_crd = edge_comment + # in_input_node = incoming_edge_.get_source() + # in_edge_attrs[in_input_node] = edge_attr self.graph.del_edge(incoming_edge_.get_source(), incoming_edge_.get_destination()) # Delete the outgoing edges/attached nodes @@ -190,95 +190,99 @@ def rewrite_spacc_1(self): og_type = attrs['type'] del attrs['type'] - rsg = pydot.Node(f"spacc1_rsg_{self.get_next_seq()}", - **attrs, label=f"{og_label}_rsg", hwnode=f"{HWNodeType.RepSigGen}", - type=og_type) + #rsg = pydot.Node(f"vr_rsg_{self.get_next_seq()}", + # **attrs, label=f"{og_label}_rsg", hwnode=f"{HWNodeType.RepSigGen}", + # type=og_type) - repeat = pydot.Node(f"spacc1_repeat_{self.get_next_seq()}", - **attrs, label=f"{og_label}_repeat", hwnode=f"{HWNodeType.Repeat}", - root="true", type=og_type, spacc="true") + #repeat = pydot.Node(f"vr_repeat_{self.get_next_seq()}", + # **attrs, label=f"{og_label}_repeat", hwnode=f"{HWNodeType.Repeat}", + # root="true", type=og_type, spacc="true") - union = pydot.Node(f"spacc1_union_{self.get_next_seq()}", - **attrs, label=f"{og_label}_union", hwnode=f"{HWNodeType.Intersect}", - type="union") + union = pydot.Node(f"vr_union_{self.get_next_seq()}", label=f"{og_label}_union", hwnode=f"{HWNodeType.Intersect}", + type="union", vector_reduce_mode="true", comment=f"type=union,index={output_crd}", index=output_crd) - add = pydot.Node(f"spacc1_add_{self.get_next_seq()}", - **attrs, label=f"{og_label}_add", hwnode=f"{HWNodeType.Compute}", - type=og_type) + add = pydot.Node(f"vr_add_{self.get_next_seq()}", label=f"{og_label}_Add", hwnode=f"{HWNodeType.Compute}", + type="add", sub="0", comment="type=add,sub=0") - crd_buffet = pydot.Node(f"spacc1_crd_buffet_{self.get_next_seq()}", - **attrs, label=f"{og_label}_crd_buffet", hwnode=f"{HWNodeType.Buffet}", - type=og_type, fa_color=self.fa_color) + crd_buffet = pydot.Node(f"vr_crd_buffet_{self.get_next_seq()}", + label=f"{og_label}_crd_buffet", hwnode=f"{HWNodeType.Buffet}", + type="buffet", vector_reduce_mode="true", fa_color=self.fa_color, comment="crd_buffet") - crd_rd_scanner = pydot.Node(f"spacc1_crd_rd_scanner_{self.get_next_seq()}", - **attrs, label=f"{og_label}_crd_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", - tensor="x", type=og_type, root="false", format="compressed", - mode="0", index=f"{output_crd}", spacc="true", stop_lvl="0", - fa_color=self.fa_color) + crd_rd_scanner = pydot.Node(f"vr_crd_rd_scanner_{self.get_next_seq()}", + label=f"{og_label}_crd_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", + tensor="X", type="fiberlookup", root="false", format="compressed", + mode="0", index=f"{output_crd}", vector_reduce_mode="true", fa_color=self.fa_color, comment="crd_rd_scanner") - crd_wr_scanner = pydot.Node(f"spacc1_crd_wr_scanner_{self.get_next_seq()}", - **attrs, label=f"{og_label}_crd_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", - type=og_type, mode="0", format="compressed", spacc="true", stop_lvl="0", - fa_color=self.fa_color) + crd_wr_scanner = pydot.Node(f"vr_crd_wr_scanner_{self.get_next_seq()}", + label=f"{og_label}_crd_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", + type="fiberwrite", mode="0", format="compressed", vector_reduce_mode="true", fa_color=self.fa_color, comment="crd_wr_scanner") self.fa_color += 1 - # glb_crd = pydot.Node(f"spacc1_crd_glb_{self.get_next_seq()}", **attrs, + # glb_crd = pydot.Node(f"vr_crd_glb_{self.get_next_seq()}", **attrs, # label=f"{og_label}_glb_crd_read", hwnode=f"{HWNodeType.GLB}", # tensor="x", mode="0", format="compressed", type=og_type) - vals_buffet = pydot.Node(f"spacc1_vals_buffet_{self.get_next_seq()}", - **attrs, label=f"{og_label}_vals_buffet", hwnode=f"{HWNodeType.Buffet}", - type=og_type, fa_color=self.fa_color) - - vals_rd_scanner = pydot.Node(f"spacc1_vals_rd_scanner_{self.get_next_seq()}", - **attrs, label=f"{og_label}_vals_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", - tensor="x", type=og_type, root="false", format="vals", - mode="vals", spacc="true", stop_lvl="0", fa_color=self.fa_color) - - vals_wr_scanner = pydot.Node(f"spacc1_vals_wr_scanner_{self.get_next_seq()}", - **attrs, label=f"{og_label}_vals_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", - type=og_type, mode="vals", format="compressed", spacc="true", - stop_lvl="0", fa_color=self.fa_color) - - # glb_vals = pydot.Node(f"spacc1_crd_vals_{self.get_next_seq()}", **attrs, + vals_buffet = pydot.Node(f"vr_vals_buffet_{self.get_next_seq()}", + label=f"{og_label}_vals_buffet", hwnode=f"{HWNodeType.Buffet}", + type="buffet", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_buffet") + + #vals_rd_scanner = pydot.Node(f"vr_vals_rd_scanner_{self.get_next_seq()}", + # label=f"{og_label}_vals_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", + # tensor="X", type="arrayvals", root="false", format="vals", + # mode="vals", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_rd_scanner") + + vals_rd_scanner = pydot.Node(f"vr_vals_rd_scanner_{self.get_next_seq()}", + label=f"{og_label}_vals_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", + tensor="X", type="fiberlookup", root="false", format="compressed", + mode="1", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_rd_scanner") + + #vals_wr_scanner = pydot.Node(f"vr_vals_wr_scanner_{self.get_next_seq()}", + # label=f"{og_label}_vals_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", + # type="fiberwrite", mode="vals", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_wr_scanner") + + + vals_wr_scanner = pydot.Node(f"vr_vals_wr_scanner_{self.get_next_seq()}", + label=f"{og_label}_vals_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", + type="fiberwrite", mode="1", format="compressed", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_wr_scanner") + + + # glb_vals = pydot.Node(f"vr_crd_vals_{self.get_next_seq()}", **attrs, # label=f"{og_label}_glb_vals_read", hwnode=f"{HWNodeType.GLB}", # tensor="x", mode="vals", format="vals", type=og_type) self.fa_color += 1 - self.graph.add_node(rsg) - self.graph.add_node(repeat) + self.graph.add_node(union) self.graph.add_node(add) self.graph.add_node(crd_buffet) self.graph.add_node(crd_rd_scanner) self.graph.add_node(crd_wr_scanner) - # self.graph.add_node(glb_crd) self.graph.add_node(vals_buffet) self.graph.add_node(vals_rd_scanner) self.graph.add_node(vals_wr_scanner) - # self.graph.add_node(glb_vals) - print(in_edge_attrs[in_input_node]) - print(in_edge_attrs[in_output_node]) + #print(in_edge_attrs[in_input_node]) + print(in_edge_attrs[in_crd_node]) print(in_edge_attrs[in_val_node]) - del in_edge_attrs[in_output_node]['comment'] + del in_edge_attrs[in_crd_node]['comment'] del in_edge_attrs[in_val_node]['type'] + del in_edge_attrs[in_crd_node]['type'] # Edges - input_to_rsg_edge = pydot.Edge(src=in_input_node, dst=rsg, **in_edge_attrs[in_input_node]) - rsg_to_repeat = pydot.Edge(src=rsg, dst=repeat) - repeat_to_crd_rd_scan = pydot.Edge(src=repeat, dst=crd_rd_scanner) - crd_rd_scan_to_val_rd_scan = pydot.Edge(src=crd_rd_scanner, dst=vals_rd_scanner) - output_to_union_edge = pydot.Edge(src=in_output_node, dst=union, - **in_edge_attrs[in_output_node], comment=f"in-B") - val_to_union = pydot.Edge(src=in_val_node, dst=union, **in_edge_attrs[in_val_node], - type="ref", comment=f"in-B", val="true") + #input_to_rsg_edge = pydot.Edge(src=in_input_node, dst=rsg, **in_edge_attrs[in_input_node]) + #rsg_to_repeat = pydot.Edge(src=rsg, dst=repeat) + #repeat_to_crd_rd_scan = pydot.Edge(src=repeat, dst=crd_rd_scanner) + #crd_rd_scan_to_val_rd_scan = pydot.Edge(src=crd_rd_scanner, dst=vals_rd_scanner) + in_crd_to_union = pydot.Edge(src=in_crd_node, dst=union, + **in_edge_attrs[in_crd_node], type="crd", comment=f"in-B") + in_val_to_union = pydot.Edge(src=in_val_node, dst=union, **in_edge_attrs[in_val_node], + type="ref", comment=f"in-B", val="true", vector_reduce_mode=True) # type="ref", comment=f"in-C", val="true") - crd_rd_scan_to_union = pydot.Edge(src=crd_rd_scanner, dst=union, type="crd", comment="in-x") - val_rd_scan_to_union = pydot.Edge(src=vals_rd_scanner, dst=union, type="ref", comment="in-x", val="true") + crd_rd_scan_to_union = pydot.Edge(src=crd_rd_scanner, dst=union, type="crd", comment="in-x", vector_reduce_mode=True) + val_rd_scan_to_union = pydot.Edge(src=vals_rd_scanner, dst=union, type="ref", comment="in-x", val="true", vector_reduce_mode=True) union_crd_to_crd_wr_scan = pydot.Edge(src=union, dst=crd_wr_scanner, type="crd") union_val0_to_alu = pydot.Edge(src=union, dst=add, comment='out-B') # union_val0_to_alu = pydot.Edge(src=union, dst=add, comment='out-C') @@ -307,15 +311,22 @@ def rewrite_spacc_1(self): self.graph.del_edge(crd_edge.get_source(), crd_edge.get_destination()) self.graph.del_edge(val_edge.get_source(), val_edge.get_destination()) - 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") + 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") + + crd_rd_scan_to_ds = pydot.Edge(src=crd_rd_scanner, dst=dst_crd, **crd_edge_attr, 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", vector_reduce_mode=True) - self.graph.add_edge(input_to_rsg_edge) - self.graph.add_edge(rsg_to_repeat) - self.graph.add_edge(repeat_to_crd_rd_scan) - self.graph.add_edge(crd_rd_scan_to_val_rd_scan) - self.graph.add_edge(output_to_union_edge) - self.graph.add_edge(val_to_union) + #self.graph.add_edge(input_to_rsg_edge) + #self.graph.add_edge(rsg_to_repeat) + #self.graph.add_edge(repeat_to_crd_rd_scan) + #self.graph.add_edge(crd_rd_scan_to_val_rd_scan) + self.graph.add_edge(in_crd_to_union) + self.graph.add_edge(in_val_to_union) self.graph.add_edge(crd_rd_scan_to_union) self.graph.add_edge(val_rd_scan_to_union) self.graph.add_edge(union_crd_to_crd_wr_scan) @@ -326,10 +337,10 @@ def rewrite_spacc_1(self): self.graph.add_edge(val_wr_scan_to_buffet) self.graph.add_edge(crd_rd_scan_to_buffet) self.graph.add_edge(vals_rd_scan_to_buffet) - self.graph.add_edge(crd_rd_scan_to_glb) - self.graph.add_edge(val_rd_scan_to_glb) + self.graph.add_edge(crd_rd_scan_to_ds) + self.graph.add_edge(val_rd_scan_to_ds) - self.graph.del_node(spacc_node) + self.graph.del_node(vr_node) def rewrite_tri_to_binary(self): ''' diff --git a/sam/sim/src/accumulator.py b/sam/sim/src/accumulator.py index a3500369..3dd264b2 100644 --- a/sam/sim/src/accumulator.py +++ b/sam/sim/src/accumulator.py @@ -1,5 +1,6 @@ +import enum + from .base import * -from .crd_manager import CrdPtConverter class Reduce(Primitive): @@ -65,7 +66,7 @@ def update(self): if (self.backpressure_en and self.check_backpressure()) or not self.backpressure_en: if self.backpressure_en: self.data_valid = True - if (len(self.in_val) > 0): + if len(self.in_val) > 0: self.block_start = False curr_in_val = "" @@ -152,262 +153,33 @@ def return_statistics(self): return stats_dict -class SparseCrdPtAccumulator1(Primitive): - def __init__(self, maxdim=100, valtype=float, fifos=None, **kwargs): +# NEW VERSION: Accumulation into a vector +class SparseAccumulator1(Primitive): + def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, depth=1, **kwargs): super().__init__(**kwargs) - - self.outer_crdpt = [] - self.inner_crdpt = [] - self.in_val = [] - - self.curr_in_val = None - self.curr_in_inner_crdpt = None - self.curr_in_outer_crdpt = None - - self.emit_output = [] - self.curr_inner_crdpt = '' - self.curr_outer_crdpt = '' - self.curr_val = '' - - # Maximum possible dimension for this index level + self.kwargs = kwargs self.maxdim = maxdim - self.order = 1 - - self.seen_done = False - # Accumulation scratchpad storage - self.storage = dict() self.valtype = valtype + self.last_level = last_level + # Boolean flag for whether to output stop tokens on the output val stream + self.val_stkn = val_stkn - if fifos is not None and len(fifos) == 3: - self.outer_crdpt = fifos[0] - self.inner_crdpt = fifos[1] - self.in_val = fifos[2] - - if self.get_stats: - self.hits_tracker = {} - self.stop_token_out = 0 - self.drop_token_out = 0 - self.valid_token_out = 0 - self.zero_out = 0 - self.nonzero_out = 0 - self.out_crd_fifo = 0 - self.in_crd_fifo = 0 - self.in_val_fifo = 0 - - def return_fifo(self): - return self.outer_crdpt, self.inner_crdpt, self.in_val - - def update(self): - self.update_done() - if self.debug: - if self.seen_done or self.done: - print(self.seen_done, self.done) - print("@@@", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, - self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) - self.print_debug() - if len(self.in_val) > 0 and self.in_val[0] == "D": - print("val", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, - self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) - self.print_debug() - if len(self.inner_crdpt) > 0 and self.inner_crdpt[0] == "D": - print("innercrd", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, - self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) - self.print_debug() - if len(self.outer_crdpt) > 0 and self.outer_crdpt[0] == "D": - print("outercrd", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, - self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) - self.print_debug() - - if len(self.outer_crdpt) > 0 or len(self.inner_crdpt) > 0: - self.block_start = False - - if self.get_stats: - self.out_crd_fifo = max(self.out_crd_fifo, len(self.outer_crdpt)) - self.in_crd_fifo = max(self.in_crd_fifo, len(self.inner_crdpt)) - self.in_val_fifo = max(self.in_val_fifo, len(self.in_val)) - - if self.done: - self.curr_outer_crdpt = '' - self.curr_inner_crdpt = '' - self.curr_val = '' - if self.get_stats: - self.drop_token_out += 1 - return - - if len(self.in_val) > 0 and len(self.outer_crdpt) > 0 and len(self.inner_crdpt) > 0 and not self.seen_done: - self.curr_in_val = self.in_val.pop(0) - self.curr_in_inner_crdpt = self.inner_crdpt.pop(0) - - ocrd = self.outer_crdpt.pop(0) - # if self.curr_in_val == 'D': - # print(self.curr_in_val, self.curr_in_inner_crdpt, ocrd) - # assert self.curr_in_val == "D" and self.curr_in_inner_crdpt == "D" and ocrd == "D" - # print("######", ocrd, self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.emit_output) - # print(self.in_val, self.outer_crdpt, self.inner_crdpt, ocrd - # self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_in_val) - emit_output = ocrd != self.curr_in_outer_crdpt and self.curr_in_outer_crdpt is not None and \ - self.curr_in_outer_crdpt != "D" - if emit_output: - self.emit_output.append([self.curr_in_outer_crdpt, -1]) - # print("@@@@@", self.curr_in_outer_crdpt) - self.curr_in_outer_crdpt = ocrd - if self.curr_in_outer_crdpt in self.storage.keys(): - inner_dict = self.storage[self.curr_in_outer_crdpt] - if self.get_stats: - for k in inner_dict.keys(): - self.hits_tracker[k] = 1 - if self.curr_in_inner_crdpt in inner_dict.keys(): - if self.get_stats: - self.hits_tracker[self.curr_in_inner_crdpt] += 1 - inner_dict[self.curr_in_inner_crdpt] += self.valtype(self.curr_in_val) - else: - if self.get_stats: - self.hits_tracker[self.curr_in_inner_crdpt] = 1 - inner_dict[self.curr_in_inner_crdpt] = self.valtype(self.curr_in_val) - # If a done token is seen, cannot emit done until all coordinates have been written out - elif self.curr_in_outer_crdpt == 'D': - assert self.curr_in_inner_crdpt == 'D' and self.curr_in_val == 'D', \ - "If one item is a 'D' token, then all inputs must be" - self.seen_done = True - else: - self.storage[self.curr_in_outer_crdpt] = {self.curr_in_inner_crdpt: self.valtype(self.curr_in_val)} - # if self.curr_in_outer_crdpt == "D": - # print("__________", self.emit_output, self.seen_done) - - if len(self.emit_output) > 0: - fiber = self.emit_output[0] - - self.curr_outer_crdpt = fiber[0] - # print("===, ", self.storage) - # print(fiber) - # print(self.emit_output) - # print(self.storage[self.curr_outer_crdpt].keys(), fiber[1]) - self.curr_inner_crdpt = min( - [item for item in self.storage[self.curr_outer_crdpt].keys() if item > fiber[1]]) - self.curr_val = self.storage[self.curr_outer_crdpt][self.curr_inner_crdpt] - - if not [item for item in self.storage[self.curr_outer_crdpt].keys() if item > self.curr_inner_crdpt]: - self.emit_output.pop(0) - else: - self.emit_output[0][1] = self.curr_inner_crdpt - elif self.seen_done: - self.done = True - self.seen_done = False - self.curr_outer_crdpt = 'D' - self.curr_inner_crdpt = 'D' - self.curr_val = 'D' - else: - self.curr_outer_crdpt = '' - self.curr_inner_crdpt = '' - self.curr_val = '' - if self.get_stats: - if self.curr_val == "": - self.drop_token_out += 1 - elif is_stkn(self.curr_val): - self.stop_token_out += 1 - else: - if (isinstance(self.curr_val, float) or isinstance(self.curr_val, int)) and self.curr_val == 0: - self.zero_out += 1 - else: - self.nonzero_out += 1 - self.valid_token_out += 1 - - if self.debug: - print("Done ptaccum:", self.out_done(), self.done, - "\n Curr in ocrd: ", self.curr_in_outer_crdpt, "\t Curr in icrd", self.curr_in_inner_crdpt, - "\t Curr in val", self.curr_in_val, - "\n Curr out ocrd: ", self.curr_outer_crdpt, "\t Curr out icrd: ", self.curr_inner_crdpt, - "\t Curr out val: ", self.curr_val, - "\n Emit crds: ", self.emit_output, - "\n Storage: ", self.storage, - "\n f: ", self.outer_crdpt, self.inner_crdpt, self.in_val) - - def print_debug(self): - print("Crdptaccum_debug Done:", self.out_done(), self.done, - "\n Curr in ocrd: ", self.curr_in_outer_crdpt, "\t Curr in icrd", self.curr_in_inner_crdpt, - "\t Curr in val", self.curr_in_val, - "\n Curr out ocrd: ", self.curr_outer_crdpt, "\t Curr out icrd: ", self.curr_inner_crdpt, - "\t Curr out val: ", self.curr_val, - "\n Emit crds: ", self.emit_output, - "\n Storage: ", self.storage, - "\n Fifos: ", self.outer_crdpt, self.inner_crdpt, self.in_val) - - def set_inner_crdpt(self, crdpt): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.inner_crdpt.append(crdpt) - - def set_outer_crdpt(self, crdpt): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.outer_crdpt.append(crdpt) - - def set_val(self, val): - assert not is_stkn(val), 'Values associated with points should not have stop tokens' - if val != '' and val is not None: - self.in_val.append(val) - - def out_outer_crdpt(self): - return self.curr_outer_crdpt - - def out_inner_crdpt(self): - return self.curr_inner_crdpt - - def out_val(self): - return self.curr_val - - def return_statistics(self): - if self.get_stats: - stats_dict = {"stkn_outs": self.stop_token_out, - "drop_outs": self.drop_token_out, "valid_outs": self.valid_token_out, - "zero_outs": self.zero_out, "nonzero_outs": self.nonzero_out} - stats_dict.update(super().return_statistics()) - else: - stats_dict = {} - return stats_dict - - def return_hits(self): - i = 0 - cnt_gt_zero = 0 - cnt_total = 0 - total_sum = 0 - if self.get_stats: - for k in self.hits_tracker.keys(): - if self.hits_tracker[k] > i: - i = self.hits_tracker[k] - if self.hits_tracker[k] > 1: - cnt_gt_zero += 1 - total_sum += self.hits_tracker[k] - cnt_total += 1 - return i, cnt_gt_zero, cnt_total, total_sum - - -# Accumulation into a vector -class SparseAccumulator1(Primitive): - def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, depth=1, **kwargs): - super().__init__(**kwargs) - self.in_outer_crdpt = [] - self.in_inner_crdpt = [] + self.in_crd1 = [] + self.in_crd0 = [] self.in_val = [] - self.crdpt_spacc = SparseCrdPtAccumulator1(maxdim=maxdim, valtype=valtype, debug=self.debug, - statisics=self.get_stats, name="", back_en=False) - self.crdpt_converter = CrdPtConverter(last_level=last_level, debug=self.debug, - statisics=self.get_stats, name="", back_en=False) - self.crdpt_spacc_out_val = [] + self.storage = {} - self.curr_outer_crd = None - self.curr_inner_crd = None + self.curr_crd1 = None + self.curr_crd0 = None self.curr_val = None - self.outer_crdpt = [] - self.inner_crdpt = [] - - self.val_stkn = val_stkn + self.curr_in_crd0 = None + self.curr_in_val = None if self.get_stats: - self.in_outer_crd_pt_fifo = 0 - self.in_inner_crd_pt_fifo = 0 + self.in_crd0_fifo = 0 + self.in_crd1_fifo = 0 self.in_val_fifo = 0 if self.backpressure_en: @@ -418,9 +190,14 @@ def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, d self.fifo_avail_outer = True self.fifo_avail_val = True - self.temp_maxdim = maxdim - self.temp_valtype = valtype - self.temp_last_level = last_level + self.states = enum.Enum('States', ['READY', 'ACC', 'WR', 'DONE']) + self.curr_state = self.states.READY + self.next_state = self.states.READY + self.writeout = False + self.writeout_storage = [] + + self.seen_done = False + self.crd1_stkn = None def check_backpressure(self): if self.backpressure_en: @@ -455,169 +232,185 @@ def add_child(self, child=None, branch=""): def update_ready(self): if self.backpressure_en: - if len(self.in_inner_crdpt) > self.depth: - self.fifo_avail_inner = False + self.fifo_avail_outer = not (len(self.in_crd1) > self.depth) + self.fifo_avail_inner = not (len(self.in_crd0) > self.depth) + self.fifo_avail_val = not (len(self.in_val) > self.depth) + + def ACC_body(self): + self.curr_in_crd0 = self.in_crd0.pop(0) + self.curr_in_val = self.in_val.pop(0) + # In accumulation, accumulate into memory + if is_nc_tkn(self.curr_in_val, self.valtype): + assert is_nc_tkn(self.curr_in_crd0, int), "The inner coordinate must be a non-control token" + if self.curr_in_crd0 in self.storage.keys(): + # Coordinate is in storage, so accumulate + self.storage[self.curr_in_crd0] += self.curr_in_val else: - self.fifo_avail_inner = True - if len(self.in_outer_crdpt) > self.depth: - self.fifo_avail_outer = False - else: - self.fifo_avail_outer = True - if len(self.in_val) > self.depth: - self.fifo_avail_val = False - else: - self.fifo_avail_val = True + # Coordinate is not in storage, so add it in + self.storage[self.curr_in_crd0] = self.curr_in_val + self.next_state = self.states.ACC + # In accumulation, if you see a stop token in the inner level, go back to start + elif is_stkn(self.curr_in_crd0): + assert is_stkn(self.curr_in_val) and stkn_order(self.curr_in_crd0) == stkn_order(self.curr_in_val), \ + "Stop tokens must match for inner crd: " + str(self.curr_in_crd0) + " and val: " + str(self.curr_in_val) + self.next_state = self.states.READY + elif is_dtkn(self.curr_in_crd0): + assert False, "Shouldn't have done token for coordinates if in accumulate (ACC) state" + # Do nothing + else: + self.next_state = self.states.ACC def update(self): self.update_done() self.update_ready() + + # Print out debugging statements + if self.debug: + print("========== " + self.name + " SPACC1 (NEW) ==========") + print("Inputs: ", self.in_crd1, self.in_crd0, self.in_val) + print("Temps: ", self.curr_crd1, self.crd1_stkn, self.curr_in_crd0, self.curr_in_val) + print("Store/Wr: ", self.storage, self.writeout_storage, self.writeout) + print("Outputs: ", self.curr_crd0, self.curr_val) + print("State: ", self.curr_state) + if self.backpressure_en: self.data_valid = False if (self.backpressure_en and self.check_backpressure()) or not self.backpressure_en: - if self.backpressure_en: - self.data_valid = True - if self.debug: - print(self.in_outer_crdpt, self.in_inner_crdpt, self.in_val) - print(self.crdpt_spacc.print_debug()) - print(self.crdpt_converter.print_debug()) - if self.done: - f1, f2, f3 = self.crdpt_spacc.return_fifo() - f4, f5 = self.crdpt_converter.return_fifo() - self.crdpt_spacc = SparseCrdPtAccumulator1(maxdim=self.temp_maxdim, - valtype=self.temp_valtype, fifos=[f1, f2, f3]) - self.crdpt_converter = CrdPtConverter(last_level=self.temp_last_level, fifos=[f4, f5]) + # Update state of state machine to next state + self.curr_state = self.next_state # FIXME: (owhsu) self.data_ready not defined in init if self.backpressure_en: + self.data_valid = True self.data_ready = True - if len(self.in_outer_crdpt) > 0 or len(self.in_inner_crdpt) > 0: + + if self.done: + # Reset things + # fch1, fch2 = self.crdhold_01.return_fifo() + # fs1, fs2, fs3 = self.spacc1_no_crdhold.return_fifo() + # fsd1 = self.stkndrop_crd1.return_fifo() + # fsd2 = self.stkndrop_crd0.return_fifo() + # fsd3 = self.stkndrop_val.return_fifo() + # self.crdhold_01 = CrdHold(fifos=[fch1, fch2], **self.kwargs) + # + # self.spacc1_no_crdhold = SpAcc1NoCrdHold(maxdim=self.maxdim, valtype=self.valtype, + # name=self.name + "_no_crdhold", + # fifos=[fs1, fs2, fs3], **self.kwargs) + # self.stkndrop_crd1 = StknDrop(fifos=[fsd1], **self.kwargs) + # self.stkndrop_crd0 = StknDrop(fifos=[fsd2], **self.kwargs) + # self.stkndrop_val = StknDrop(fifos=[fsd3], **self.kwargs) + pass + + # Set when block counts should start + if len(self.in_crd1) > 0 or len(self.in_crd0) > 0 or len(self.in_val) > 0: self.block_start = False - # What to do for drop tokens? + # Store block statistics if asked to be reported if self.get_stats: - self.in_outer_crd_pt_fifo = max(self.in_outer_crd_pt_fifo, len(self.in_outer_crdpt)) - self.in_inner_crd_pt_fifo = max(self.in_inner_crd_pt_fifo, len(self.in_inner_crdpt)) - self.in_val_fifo = max(self.in_val_fifo, len(self.in_val)) - - if len(self.in_outer_crdpt) > 0: - self.crdpt_spacc.set_outer_crdpt(self.in_outer_crdpt.pop(0)) - - if len(self.in_inner_crdpt) > 0: - self.crdpt_spacc.set_inner_crdpt(self.in_inner_crdpt.pop(0)) - - if len(self.in_val) > 0: - self.crdpt_spacc.set_val(self.in_val.pop(0)) - - self.crdpt_spacc.update() - print(">>>>>>>>>>>>SPACC:", self.crdpt_spacc.out_outer_crdpt(), self.crdpt_spacc.out_inner_crdpt()) - self.crdpt_converter.set_outer_crdpt(self.crdpt_spacc.out_outer_crdpt()) - self.crdpt_converter.set_inner_crdpt(self.crdpt_spacc.out_inner_crdpt()) - - if self.crdpt_spacc.out_val() != '': - self.crdpt_spacc_out_val.append(self.crdpt_spacc.out_val()) - - self.crdpt_converter.update() - self.curr_outer_crd = self.crdpt_converter.out_crd_outer() - self.curr_inner_crd = self.crdpt_converter.out_crd_inner() - - if self.val_stkn: - self.curr_val = self.crdpt_spacc_out_val.pop(0) if isinstance(self.curr_inner_crd, int) and \ - len(self.crdpt_spacc_out_val) > 0 else self.curr_inner_crd + # What to do for drop tokens? + pass + + # Begin state machine computation + if self.curr_state == self.states.READY: + if len(self.in_crd1) > 0: + self.curr_crd1 = self.in_crd1.pop(0) + if is_nc_tkn(self.curr_crd1): + if len(self.in_crd0) > 0 and len(self.in_val) > 0: + self.ACC_body() + else: + self.next_state = self.states.ACC + elif is_stkn(self.curr_crd1): + # TODO: what to do when we want to writeout but writeout isn't done + + # Set writeout to be true, move over storage, and clear it. + self.crd1_stkn = self.curr_crd1 + self.writeout = True + self.writeout_storage = [item for item in sorted(self.storage.items())] + self.storage = {} + self.next_state = self.states.READY + elif is_dtkn(self.curr_crd1): + self.seen_done = True + if self.writeout: + self.next_state = self.states.WR + else: + self.next_state = self.states.DONE + else: + assert False, "Cannot have a coordinate token of this type: " + str(self.curr_crd1) + # Handle accumulation into storage + elif self.curr_state == self.states.ACC: + if len(self.in_crd0) > 0 and len(self.in_val) > 0: + self.ACC_body() + # Finish writeout and then be done. + elif self.curr_state == self.states.WR: + if not self.writeout: + self.next_state = self.states.DONE + else: + self.next_state = self.states.WR + # See a done signal AND writeout is done + # Stay done until reset + elif self.curr_state == self.states.DONE: + self.done = True + self.next_state = self.states.DONE + # Default to the current state else: - self.curr_val = self.crdpt_spacc_out_val.pop(0) if len(self.crdpt_spacc_out_val) > 0 else '' - - if self.debug: - print(self.in_val) + self.next_state = self.curr_state + + # Writeout is true, so writeout the current values for storage + if self.writeout: + # Writeout is done when there are no elements left + if len(self.writeout_storage) == 0: + self.writeout = False + assert self.crd1_stkn is not None, "The current writeout stop token should not be None" + self.curr_crd0 = self.crd1_stkn + self.curr_val = self.crd1_stkn + else: + curr_writeout_elem = self.writeout_storage.pop(0) + self.curr_val = curr_writeout_elem[1] + self.curr_crd0 = curr_writeout_elem[0] + elif self.done: + self.curr_val = 'D' + self.curr_crd0 = 'D' + else: + self.curr_val = "" + self.curr_crd0 = "" - self.done = self.crdpt_spacc.out_done() and self.crdpt_converter.out_done() + # Update the current state + self.curr_state = self.next_state if self.debug: - print("Vals: ", self.in_val, "\n Done:", self.done, - "\n SpCrdPt Accum Done:", self.crdpt_spacc.out_done(), - "\t CrdPtConverter Done:", self.crdpt_converter.out_done() - ) - - def set_inner_crdpt(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_inner_crdpt.append(crdpt) - if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_inner) - - def set_outer_crdpt(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_outer_crdpt.append(crdpt) - if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_outer) + print(self.in_crd1, self.in_crd0, self.in_val) + print(self.curr_crd1, self.curr_crd0, self.curr_val) - def crd_in_inner(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_inner_crdpt.append(crdpt) + def set_in_crd0(self, crd, parent=None): + if crd != '' and crd is not None: + self.in_crd0.append(crd) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_inner) - def crd_in_outer(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_outer_crdpt.append(crdpt) - if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_outer) - - def set_crd_inner(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_inner_crdpt.append(crdpt) - if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_inner) - - def set_crd_outer(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_outer_crdpt.append(crdpt) + def set_in_crd1(self, crd, parent=None): + if crd != '' and crd is not None: + self.in_crd1.append(crd) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_outer) def set_val(self, val, parent=None): - assert not is_stkn(val), 'Values associated with points should not have stop tokens' if val != '' and val is not None: self.in_val.append(val) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_val) - def out_outer_crd(self): + def out_crd0(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_outer_crd - - def out_inner_crd(self): - if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_inner_crd + return self.curr_crd0 def out_val(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: return self.curr_val - def out_crd_outer(self): - if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_outer_crd - - def out_crd_inner(self): - if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_inner_crd - def return_statistics(self): if self.get_stats: stats_dict = {} - stats_dict["in_outer_fifo"] = self.in_outer_crd_pt_fifo - stats_dict["in_inner_fifo"] = self.in_inner_crd_pt_fifo - stats_dict["in_val_fifo"] = self.in_val_fifo - hits_info = self.crdpt_spacc.return_hits() - stats_dict["max_hits"] = hits_info[0] - stats_dict["hits_gt_one"] = hits_info[1] - stats_dict["total_elems"] = hits_info[2] - stats_dict["rmw_ops"] = hits_info[3] - stats_dict.update(self.crdpt_spacc.return_statistics()) + # TODO: Finish adding in other statistics stats_dict.update(super().return_statistics()) else: stats_dict = {} @@ -627,221 +420,57 @@ def print_fifos(self): print("Spaccumulator: None available") -class SparseCrdPtAccumulator2(Primitive): - def __init__(self, maxdim=100, valtype=float, **kwargs): +# NEW VERSION: Accumulation into a matrix +class SparseAccumulator2(Primitive): + def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, depth=1, **kwargs): super().__init__(**kwargs) - self.in_crdpt0 = [] - self.in_crdpt1 = [] - self.in_val = [] - - self.curr_in_val = None - self.curr_in0_crdpt = None - self.curr_in1_crdpt = None - - self.emit_output = [] - self.curr_crdpt0 = '' - self.curr_crdpt1 = '' - self.curr_val = '' - - # Maximum possible dimension for this index level + self.kwargs = kwargs self.maxdim = maxdim - self.order = 1 - - self.seen_done = False - # Accumulation scratchpad storage - self.storage = dict() self.valtype = valtype + self.last_level = last_level + # Boolean flag for whether to output stop tokens on the output val stream + self.val_stkn = val_stkn - if self.get_stats: - self.hits_tracker = {} - self.stop_token_out = 0 - self.drop_token_out = 0 - self.valid_token_out = 0 - self.zero_out = 0 - self.nonzero_out = 0 - - def return_fifo(self): - return self.in_crdpt0, self.in_crdpt1, self.in_val - - def update(self): - self.update_done() - if len(self.in_crdpt0) > 0 or len(self.in_crdpt0) > 0 or len(self.in_val) > 0: - self.block_start = False - - if self.done: - self.curr_crdpt0 = '' - self.curr_crdpt1 = '' - self.curr_val = '' - if self.get_stats: - self.drop_token_out += 1 - return - - if len(self.in_val) > 0 and len(self.in_crdpt1) > 0 and len(self.in_crdpt0) > 0: - self.curr_in_val = self.in_val.pop(0) - self.curr_in0_crdpt = self.in_crdpt0.pop(0) - self.curr_in1_crdpt = self.in_crdpt1.pop(0) - - emit_output = self.curr_in1_crdpt == 'D' - if emit_output: - self.emit_output.append([-1, -1]) - assert self.curr_in1_crdpt == 'D' and self.curr_in0_crdpt == 'D' and self.curr_in_val == 'D', \ - "If one item is a 'D' token, then all inputs must be" - self.seen_done = True - else: - if self.curr_in1_crdpt in self.storage.keys(): - inner_dict = self.storage[self.curr_in1_crdpt] - if self.get_stats: - for k in inner_dict.keys(): - self.hits_tracker[k] = 1 - if self.curr_in0_crdpt in inner_dict.keys(): - if self.get_stats: - self.hits_tracker[self.curr_in0_crdpt] += 1 - inner_dict[self.curr_in0_crdpt] += self.valtype(self.curr_in_val) - else: - if self.get_stats: - self.hits_tracker[self.curr_in0_crdpt] = 1 - inner_dict[self.curr_in0_crdpt] = self.valtype(self.curr_in_val) - else: - self.storage[self.curr_in1_crdpt] = {self.curr_in0_crdpt: self.valtype(self.curr_in_val)} - - if len(self.emit_output) > 0: - fiber = self.emit_output.pop(0) - # - key1 = min( - [item for item in self.storage.keys() if item > fiber[0]]) - key0 = min( - [item for item in self.storage[key1].keys() if item > fiber[1]]) - - self.curr_crdpt1 = key1 - self.curr_crdpt0 = key0 - self.curr_val = self.storage[key1][key0] - - # Finished inner coordinates, increment outer coordinate - if not [item for item in self.storage[key1].keys() if item > key0]: - # Do not increment outer coordinate if it's the last one - if [item for item in self.storage.keys() if item > key1]: - self.emit_output.append([key1, -1]) - # Do inner coordinates - else: - self.emit_output.append([fiber[0], key0]) - - elif self.seen_done: - self.done = True - self.seen_done = False - self.curr_crdpt0 = 'D' - self.curr_crdpt1 = 'D' - self.curr_val = 'D' - else: - self.curr_crdpt0 = '' - self.curr_crdpt1 = '' - self.curr_val = '' - - if self.get_stats: - if self.curr_val == "": - self.drop_token_out += 1 - elif is_stkn(self.curr_val): - self.stop_token_out += 1 - else: - if (isinstance(self.curr_val, float) or isinstance(self.curr_val, int)) and self.curr_val == 0: - self.zero_out += 1 - else: - self.nonzero_out += 1 - self.valid_token_out += 1 - - if self.debug: - print("Done:", self.out_done(), - "\n Curr in crd1: ", self.curr_in1_crdpt, - "\t Curr in crd0", self.curr_in0_crdpt, - "\t Curr in val", self.curr_in_val, - "\n Curr out crd1: ", self.curr_crdpt1, - "\t Curr out crd0: ", self.curr_crdpt0, - "\t Curr out val: ", self.curr_val, - "\n Emit crds: ", self.emit_output, - "\n Storage: ", self.storage) - - def set_inner_crdpt(self, crdpt): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_crdpt0.append(crdpt) - - def set_outer_crdpt(self, crdpt): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in_crdpt1.append(crdpt) - - def set_val(self, val): - assert not is_stkn(val), 'Values associated with points should not have stop tokens' - if val != '' and val is not None: - self.in_val.append(val) - - def out_outer_crdpt(self): - return self.curr_crdpt1 - - def out_inner_crdpt(self): - return self.curr_crdpt0 - - def out_val(self): - return self.curr_val - - def return_hits(self): - i = 0 - cnt_gt_zero = 0 - cnt_total = 0 - for k in self.hits_tracker.keys(): - if self.hits_tracker[k] > i: - i = self.hits_tracker[k] - if self.hits_tracker[k] > 1: - cnt_gt_zero += 1 - cnt_total += 1 - return i, cnt_gt_zero, cnt_total - - def return_statistics(self): - if self.get_stats: - stats_dict = {"stkn_outs": self.stop_token_out, - "drop_outs": self.drop_token_out, "valid_outs": self.valid_token_out, - "zero_outs": self.zero_out, "nonzero_outs": self.nonzero_out} - stats_dict.update(super().return_statistics()) - else: - stats_dict = {} - return stats_dict - - -# Accumulation into a matrix (2D) -class SparseAccumulator2(Primitive): - def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, depth=1, **kwargs): - super().__init__(**kwargs) - self.in1_crdpt = [] - self.in0_crdpt = [] + self.in_crd2 = [] + self.in_crd1 = [] + self.in_crd0 = [] self.in_val = [] - self.crdpt_spacc = SparseCrdPtAccumulator2(maxdim=maxdim, valtype=valtype, **kwargs) - self.crdpt_converter = CrdPtConverter(last_level=True, **kwargs) - - self.crdpt_spacc_out_val = [] + self.storage = {} - self.curr_1_crd = None - self.curr_0_crd = None + self.curr_crd2 = None + self.curr_crd1 = None + self.curr_crd0 = None self.curr_val = None - self.outer_crdpt = [] - self.inner_crdpt = [] + self.curr_in_crd1 = None + self.curr_in_crd0 = None + self.curr_in_val = None + + self.states = enum.Enum('States', ['READY', 'ACC1', 'ACC0', 'WR', 'DONE']) + self.curr_state = self.states.READY + self.next_state = self.states.READY + self.writeout0 = False + self.writeout1 = False + self.writeout_storage1 = [] + self.writeout_storage0 = [] + + self.seen_done = False + self.crd2_stkn = None - self.val_stkn = val_stkn if self.get_stats: - self.in1_fifo = 0 - self.in0_fifo = 0 - self.inval_fifo = 0 + self.in_crd0_fifo = 0 + self.in_crd1_fifo = 0 + self.in_val_fifo = 0 if self.backpressure_en: self.ready_backpressure = True self.data_valid = True self.depth = depth - self.fifo_avail_inner = True - self.fifo_avail_outer = True + self.fifo_avail_2 = True + self.fifo_avail_1 = True + self.fifo_avail_0 = True self.fifo_avail_val = True - self.temp_maxdim = maxdim - self.temp_valtype = valtype - self.temp_last_level = last_level def check_backpressure(self): if self.backpressure_en: @@ -854,6 +483,20 @@ def set_backpressure(self, backpressure): if not backpressure: self.ready_backpressure = False + # FIXME: (owhsu) This code is unreachable + def fifo_available(self, br=""): + assert False + if self.backpressure_en: + if br == "inner": + # and len(self.in_inner_crdpt) > self.depth: + return self.fifo_avail_inner + if br == "outer": # and len(self.in_outer_crdpt) > self.depth: + return self.fifo_avail_outer # return False + if br == "val": # and len(self.in_val) > self.depth: + return self.fifo_avail_val # return False + # return True + return True + def add_child(self, child=None, branch=""): if self.backpressure_en: if child is not None: @@ -862,110 +505,261 @@ def add_child(self, child=None, branch=""): def update_ready(self): if self.backpressure_en: - if len(self.in0_crdpt) > self.depth: - self.fifo_avail_inner = False - else: - self.fifo_avail_inner = True - if len(self.in1_crdpt) > self.depth: - self.fifo_avail_outer = False + self.fifo_avail_outer = not (len(self.in_crd1) > self.depth) + self.fifo_avail_inner = not (len(self.in_crd0) > self.depth) + self.fifo_avail_val = not (len(self.in_val) > self.depth) + + def print_debug(self): + print("========== " + self.name + " SPACC2 (NEW) ==========") + print("Inputs: ", self.in_crd2, self.in_crd1, self.in_crd0, self.in_val) + print("Temps: ", self.curr_crd2, self.crd2_stkn, self.curr_in_crd1, self.curr_in_crd0, self.curr_in_val) + print("Store/Wr: ", self.storage, self.writeout_storage1, self.writeout_storage0, self.writeout1, + self.writeout0) + print("Outputs: ", self.curr_crd1, self.curr_crd0, self.curr_val) + print("State: ", self.curr_state, self.next_state) + + def get_writout(self): + return self.writeout0 or self.writeout1 + + def build_writeout(self): + result = [] + for crd1 in sorted(self.storage.keys()): + for crd0, val in self.storage[crd1].items(): + result.append((crd0, val)) + result.append(('S0', 'S0')) + # Remove last stop token + return result[:-1] + + def update_storage(self, crd1, crd0, val): + if crd1 not in self.storage.keys(): + self.storage[crd1] = {crd0: val} + else: + assert isinstance(self.storage[crd1], dict), "Storage must be a dictionary of dictionaries" + if crd0 not in self.storage[crd1].keys(): + self.storage[crd1][crd0] = val else: - self.fifo_avail_outer = True - if len(self.in_val) > self.depth: - self.fifo_avail_val = False + self.storage[crd1][crd0] += val + + def ACC1_body(self): + # In accumulation, accumulate into memory + self.curr_in_crd1 = self.in_crd1.pop(0) + + # All elements are ready + if is_nc_tkn(self.curr_in_crd1): + if len(self.in_crd0) > 0 and len(self.in_val) > 0: + self.ACC0_body() else: - self.fifo_avail_val = True + self.next_state = self.states.ACC0 + elif is_stkn(self.curr_in_crd1): + self.next_state = self.states.READY + elif is_dtkn(self.curr_in_crd1): + assert False, "Shouldn't have done token for coordinates if in accumulate (ACC) state" + else: + assert False, "Cannot have a coordinate token of this type: " + str(self.curr_in_crd1) + + def ACC0_body(self): + self.curr_in_crd0 = self.in_crd0.pop(0) + self.curr_in_val = self.in_val.pop(0) + + if is_nc_tkn(self.curr_in_val, self.valtype): + assert is_nc_tkn(self.curr_in_crd0, int), "The inner coordinate must be a non-control token" + self.update_storage(self.curr_in_crd1, self.curr_in_crd0, self.curr_in_val) + self.next_state = self.states.ACC0 + # In accumulation, if you see a stop token in the inner level, go back to start + elif is_stkn(self.curr_in_crd0): + assert is_stkn(self.curr_in_val) and stkn_order(self.curr_in_crd0) == stkn_order(self.curr_in_val), \ + "Stop tokens must match for inner crd: " + str(self.curr_in_crd0) + " and val: " + str(self.curr_in_val) + self.next_state = self.states.ACC1 + elif is_dtkn(self.curr_in_crd0): + assert False, "Shouldn't have done token for coordinates if in accumulate (ACC) state" + # Do nothing + else: + assert False, "Cannot have a coordinate token of this type: " + str(self.curr_in_crd0) def update(self): self.update_done() self.update_ready() + + # Print out debugging statements + if self.debug: + self.print_debug() + if self.backpressure_en: self.data_valid = False if (self.backpressure_en and self.check_backpressure()) or not self.backpressure_en: - if self.done: - f1, f2, f3 = self.crdpt_spacc.return_fifo() - f4, f5 = self.crdpt_converter.return_fifo() - self.crdpt_spacc = SparseCrdPtAccumulator2(maxdim=self.temp_maxdim, valtype=self.temp_valtype, - fifos=[f1, f2, f3]) - self.crdpt_converter = CrdPtConverter(last_level=self.temp_last_level, fifos=[f4, f5]) + # Update state of state machine to next state + self.curr_state = self.next_state + + # FIXME: (owhsu) self.data_ready not defined in init if self.backpressure_en: self.data_valid = True - if (len(self.in1_crdpt) > 0 or len(self.in0_crdpt) > 0 or len(self.in_val) > 0): + self.data_ready = True + + if self.done: + # Reset things + # fch1, fch2 = self.crdhold_01.return_fifo() + # fs1, fs2, fs3 = self.spacc1_no_crdhold.return_fifo() + # fsd1 = self.stkndrop_crd1.return_fifo() + # fsd2 = self.stkndrop_crd0.return_fifo() + # fsd3 = self.stkndrop_val.return_fifo() + # self.crdhold_01 = CrdHold(fifos=[fch1, fch2], **self.kwargs) + # + # self.spacc1_no_crdhold = SpAcc1NoCrdHold(maxdim=self.maxdim, valtype=self.valtype, + # name=self.name + "_no_crdhold", + # fifos=[fs1, fs2, fs3], **self.kwargs) + # self.stkndrop_crd1 = StknDrop(fifos=[fsd1], **self.kwargs) + # self.stkndrop_crd0 = StknDrop(fifos=[fsd2], **self.kwargs) + # self.stkndrop_val = StknDrop(fifos=[fsd3], **self.kwargs) + pass + + # Set when block counts should start + if len(self.in_crd1) > 0 or len(self.in_crd0) > 0 or len(self.in_val) > 0: self.block_start = False + # Store block statistics if asked to be reported if self.get_stats: - self.compute_fifo() - - if len(self.in1_crdpt) > 0: - self.crdpt_spacc.set_outer_crdpt(self.in1_crdpt.pop(0)) - - if len(self.in0_crdpt) > 0: - self.crdpt_spacc.set_inner_crdpt(self.in0_crdpt.pop(0)) - - if len(self.in_val) > 0: - self.crdpt_spacc.set_val(self.in_val.pop(0)) - - self.crdpt_spacc.update() - - self.crdpt_converter.set_inner_crdpt(self.crdpt_spacc.out_inner_crdpt()) - self.crdpt_converter.set_outer_crdpt(self.crdpt_spacc.out_outer_crdpt()) - self.crdpt_converter.update() - - if self.crdpt_spacc.out_val() != '': - self.crdpt_spacc_out_val.append(self.crdpt_spacc.out_val()) + # What to do for drop tokens? + pass + + # Begin state machine computation + # READY State + # Accepts crd2 token + if self.curr_state == self.states.READY: + if len(self.in_crd2) > 0: + self.curr_crd2 = self.in_crd2.pop(0) + if is_nc_tkn(self.curr_crd2): + if len(self.in_crd1) > 0: + self.ACC1_body() + else: + self.next_state = self.states.ACC1 + elif is_stkn(self.curr_crd2) and not self.get_writout(): + # Set writeout to be true, move over storage, and clear it. + self.crd2_stkn = self.curr_crd2 + self.writeout1 = True + self.writeout0 = True + self.writeout_storage1 = [k for k in sorted(self.storage.keys())] + self.writeout_storage0 = self.build_writeout() + self.storage = {} + self.next_state = self.states.READY + elif is_stkn(self.curr_crd2): + # Wait for previous writeout to be done + self.next_state = self.states.WR + elif is_dtkn(self.curr_crd2): + self.seen_done = True + if self.get_writout(): + self.next_state = self.states.WR + else: + self.next_state = self.states.DONE + else: + assert False, "Cannot have a coordinate token of this type: " + str(self.curr_crd2) + # Handle accumulation into storage + # Accepts crd1 token + elif self.curr_state == self.states.ACC1: + if len(self.in_crd1) > 0: + self.ACC1_body() + else: + self.next_state = self.states.ACC1 + elif self.curr_state == self.states.ACC0: + if len(self.in_crd0) > 0 and len(self.in_val) > 0: + self.ACC0_body() + else: + self.next_state = self.states.ACC0 + # Finish writeout and then be done or go back to ready state + elif self.curr_state == self.states.WR: + if not self.get_writout() and self.seen_done: + self.next_state = self.states.DONE + elif not self.get_writout(): + self.next_state = self.states.READY + else: + self.next_state = self.states.WR + # See a done signal AND writeout is done + # Stay done until reset + elif self.curr_state == self.states.DONE: + self.done = True + self.next_state = self.states.DONE + # Default to the current state + else: + self.next_state = self.curr_state + + # Writeout is true, so writeout the current values for storage + if self.get_writout(): + # Writeout is done when there are no elements left + # Writeout outer (crd1) level coordinates + if self.writeout1: + if len(self.writeout_storage1) == 0: + self.writeout1 = False + assert self.crd2_stkn is not None, "The current writeout stop token should not be None" + self.curr_crd1 = self.crd2_stkn + else: + curr_writeout_elem1 = self.writeout_storage1.pop(0) + self.curr_crd1 = curr_writeout_elem1 + else: + self.curr_crd1 = "" - self.curr_1_crd = self.crdpt_converter.out_crd_outer() - self.curr_0_crd = self.crdpt_converter.out_crd_inner() + # Writeout inner (crd0) level coordinates + if self.writeout0: + if len(self.writeout_storage0) == 0: + self.writeout0 = False + assert self.crd2_stkn is not None, "The current writeout stop token should not be None" + self.curr_crd0 = increment_stkn(self.crd2_stkn) - if self.val_stkn: - self.curr_val = self.crdpt_spacc_out_val.pop(0) if isinstance(self.curr_0_crd, int) and \ - len(self.crdpt_spacc_out_val) > 0 else self.curr_0_crd + self.curr_val = increment_stkn(self.crd2_stkn) + else: + curr_writeout_elem0 = self.writeout_storage0.pop(0) + self.curr_crd0 = curr_writeout_elem0[0] + self.curr_val = curr_writeout_elem0[1] else: - self.curr_val = self.crdpt_spacc_out_val.pop(0) if len(self.crdpt_spacc_out_val) > 0 else '' + self.curr_crd0 = "" + self.curr_val = "" - if self.debug: - print(self.in_val) + elif self.done: + self.curr_val = 'D' + self.curr_crd0 = 'D' + self.curr_crd1 = 'D' + else: + self.curr_val = "" + self.curr_crd0 = "" + self.curr_crd1 = "" - self.done = self.crdpt_spacc.out_done() and self.crdpt_converter.out_done() + # Update the current state + self.curr_state = self.next_state if self.debug: - print("Done:", self.done, - "\n SpCrdPt Accum Done:", self.crdpt_spacc.out_done(), - "\t CrdPtConv 01 Done:", self.crdpt_converter.out_done() - ) - - def compute_fifo(self): - self.in1_fifo = max(self.in1_fifo, len(self.in1_crdpt)) - self.in0_fifo = max(self.in0_fifo, len(self.in0_crdpt)) - self.inval_fifo = max(self.inval_fifo, len(self.in_val)) - - def set_crd_inner(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in0_crdpt.append(crdpt) + print(self.in_crd1, self.in_crd0, self.in_val) + print(self.curr_crd1, self.curr_crd0, self.curr_val) + print("====== SPACC2 END =======") + + def set_in_crd0(self, crd, parent=None): + if super().valid_token(crd, int): + self.in_crd0.append(crd) if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_inner) + parent.set_backpressure(self.fifo_avail_0) - def set_crd_outer(self, crdpt, parent=None): - assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' - if crdpt != '' and crdpt is not None: - self.in1_crdpt.append(crdpt) + def set_in_crd1(self, crd, parent=None): + if super().valid_token(crd, int): + self.in_crd1.append(crd) if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_outer) + parent.set_backpressure(self.fifo_avail_1) + + def set_in_crd2(self, crd, parent=None): + if super().valid_token(crd, int): + self.in_crd2.append(crd) + if self.backpressure_en: + parent.set_backpressure(self.fifo_avail_2) def set_val(self, val, parent=None): - assert not is_stkn(val), 'Values associated with points should not have stop tokens' if val != '' and val is not None: self.in_val.append(val) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_val) - def out_crd_outer(self): + def out_crd1(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_1_crd + return self.curr_crd1 - def out_crd_inner(self): + def out_crd0(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_0_crd + return self.curr_crd0 def out_val(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: @@ -973,12 +767,12 @@ def out_val(self): def return_statistics(self): if self.get_stats: - hits_info = self.crdpt_spacc.return_hits() - stats_dict = {"in1_fifo": self.in1_fifo, "in0_fifo": self.in0_fifo, - "inval_fifo": self.inval_fifo, "max_hits": hits_info[0], "gt_one": hits_info[1], - "total_elems": hits_info[2]} - stats_dict.update(self.crdpt_spacc.return_statistics()) + stats_dict = {} + # TODO: Finish adding in other statistics stats_dict.update(super().return_statistics()) else: stats_dict = {} return stats_dict + + def print_fifos(self): + print("Spaccumulator: None available") From d089dfb4d2ca2c439a733c3b28c69821b15555c7 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Nov 2023 11:23:10 -0800 Subject: [PATCH 2/9] Add missing primitives --- sam/sim/src/accumulator.py | 407 +++++++++++++++++++++++++++++++++++++ 1 file changed, 407 insertions(+) diff --git a/sam/sim/src/accumulator.py b/sam/sim/src/accumulator.py index 3dd264b2..83b3acef 100644 --- a/sam/sim/src/accumulator.py +++ b/sam/sim/src/accumulator.py @@ -152,6 +152,235 @@ def return_statistics(self): stats_dict = {} return stats_dict +class SparseCrdPtAccumulator1(Primitive): + def __init__(self, maxdim=100, valtype=float, fifos=None, **kwargs): + super().__init__(**kwargs) + + self.outer_crdpt = [] + self.inner_crdpt = [] + self.in_val = [] + + self.curr_in_val = None + self.curr_in_inner_crdpt = None + self.curr_in_outer_crdpt = None + + self.emit_output = [] + self.curr_inner_crdpt = '' + self.curr_outer_crdpt = '' + self.curr_val = '' + + # Maximum possible dimension for this index level + self.maxdim = maxdim + self.order = 1 + + self.seen_done = False + # Accumulation scratchpad storage + self.storage = dict() + self.valtype = valtype + + if fifos is not None and len(fifos) == 3: + self.outer_crdpt = fifos[0] + self.inner_crdpt = fifos[1] + self.in_val = fifos[2] + + if self.get_stats: + self.hits_tracker = {} + self.stop_token_out = 0 + self.drop_token_out = 0 + self.valid_token_out = 0 + self.zero_out = 0 + self.nonzero_out = 0 + self.out_crd_fifo = 0 + self.in_crd_fifo = 0 + self.in_val_fifo = 0 + + def return_fifo(self): + return self.outer_crdpt, self.inner_crdpt, self.in_val + + def update(self): + self.update_done() + if self.debug: + if self.seen_done or self.done: + print(self.seen_done, self.done) + print("@@@", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, + self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) + self.print_debug() + if len(self.in_val) > 0 and self.in_val[0] == "D": + print("val", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, + self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) + self.print_debug() + if len(self.inner_crdpt) > 0 and self.inner_crdpt[0] == "D": + print("innercrd", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, + self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) + self.print_debug() + if len(self.outer_crdpt) > 0 and self.outer_crdpt[0] == "D": + print("outercrd", self.outer_crdpt, self.inner_crdpt, self.in_val, self.emit_output, + self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_val) + self.print_debug() + + if len(self.outer_crdpt) > 0 or len(self.inner_crdpt) > 0: + self.block_start = False + + if self.get_stats: + self.out_crd_fifo = max(self.out_crd_fifo, len(self.outer_crdpt)) + self.in_crd_fifo = max(self.in_crd_fifo, len(self.inner_crdpt)) + self.in_val_fifo = max(self.in_val_fifo, len(self.in_val)) + + if self.done: + self.curr_outer_crdpt = '' + self.curr_inner_crdpt = '' + self.curr_val = '' + if self.get_stats: + self.drop_token_out += 1 + return + + if len(self.in_val) > 0 and len(self.outer_crdpt) > 0 and len(self.inner_crdpt) > 0 and not self.seen_done: + self.curr_in_val = self.in_val.pop(0) + self.curr_in_inner_crdpt = self.inner_crdpt.pop(0) + + ocrd = self.outer_crdpt.pop(0) + # if self.curr_in_val == 'D': + # print(self.curr_in_val, self.curr_in_inner_crdpt, ocrd) + # assert self.curr_in_val == "D" and self.curr_in_inner_crdpt == "D" and ocrd == "D" + # print("######", ocrd, self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.emit_output) + # print(self.in_val, self.outer_crdpt, self.inner_crdpt, ocrd + # self.curr_in_outer_crdpt, self.curr_in_inner_crdpt, self.curr_in_val) + emit_output = ocrd != self.curr_in_outer_crdpt and self.curr_in_outer_crdpt is not None and \ + self.curr_in_outer_crdpt != "D" + if emit_output: + self.emit_output.append([self.curr_in_outer_crdpt, -1]) + # print("@@@@@", self.curr_in_outer_crdpt) + self.curr_in_outer_crdpt = ocrd + if self.curr_in_outer_crdpt in self.storage.keys(): + inner_dict = self.storage[self.curr_in_outer_crdpt] + if self.get_stats: + for k in inner_dict.keys(): + self.hits_tracker[k] = 1 + if self.curr_in_inner_crdpt in inner_dict.keys(): + if self.get_stats: + self.hits_tracker[self.curr_in_inner_crdpt] += 1 + inner_dict[self.curr_in_inner_crdpt] += self.valtype(self.curr_in_val) + else: + if self.get_stats: + self.hits_tracker[self.curr_in_inner_crdpt] = 1 + inner_dict[self.curr_in_inner_crdpt] = self.valtype(self.curr_in_val) + # If a done token is seen, cannot emit done until all coordinates have been written out + elif self.curr_in_outer_crdpt == 'D': + assert self.curr_in_inner_crdpt == 'D' and self.curr_in_val == 'D', \ + "If one item is a 'D' token, then all inputs must be" + self.seen_done = True + else: + self.storage[self.curr_in_outer_crdpt] = {self.curr_in_inner_crdpt: self.valtype(self.curr_in_val)} + # if self.curr_in_outer_crdpt == "D": + # print("__________", self.emit_output, self.seen_done) + + if len(self.emit_output) > 0: + fiber = self.emit_output[0] + + self.curr_outer_crdpt = fiber[0] + # print("===, ", self.storage) + # print(fiber) + # print(self.emit_output) + # print(self.storage[self.curr_outer_crdpt].keys(), fiber[1]) + self.curr_inner_crdpt = min( + [item for item in self.storage[self.curr_outer_crdpt].keys() if item > fiber[1]]) + self.curr_val = self.storage[self.curr_outer_crdpt][self.curr_inner_crdpt] + + if not [item for item in self.storage[self.curr_outer_crdpt].keys() if item > self.curr_inner_crdpt]: + self.emit_output.pop(0) + else: + self.emit_output[0][1] = self.curr_inner_crdpt + elif self.seen_done: + self.done = True + self.seen_done = False + self.curr_outer_crdpt = 'D' + self.curr_inner_crdpt = 'D' + self.curr_val = 'D' + else: + self.curr_outer_crdpt = '' + self.curr_inner_crdpt = '' + self.curr_val = '' + if self.get_stats: + if self.curr_val == "": + self.drop_token_out += 1 + elif is_stkn(self.curr_val): + self.stop_token_out += 1 + else: + if (isinstance(self.curr_val, float) or isinstance(self.curr_val, int)) and self.curr_val == 0: + self.zero_out += 1 + else: + self.nonzero_out += 1 + self.valid_token_out += 1 + + if self.debug: + print("Done ptaccum:", self.out_done(), self.done, + "\n Curr in ocrd: ", self.curr_in_outer_crdpt, "\t Curr in icrd", self.curr_in_inner_crdpt, + "\t Curr in val", self.curr_in_val, + "\n Curr out ocrd: ", self.curr_outer_crdpt, "\t Curr out icrd: ", self.curr_inner_crdpt, + "\t Curr out val: ", self.curr_val, + "\n Emit crds: ", self.emit_output, + "\n Storage: ", self.storage, + "\n f: ", self.outer_crdpt, self.inner_crdpt, self.in_val) + + def print_debug(self): + print("Crdptaccum_debug Done:", self.out_done(), self.done, + "\n Curr in ocrd: ", self.curr_in_outer_crdpt, "\t Curr in icrd", self.curr_in_inner_crdpt, + "\t Curr in val", self.curr_in_val, + "\n Curr out ocrd: ", self.curr_outer_crdpt, "\t Curr out icrd: ", self.curr_inner_crdpt, + "\t Curr out val: ", self.curr_val, + "\n Emit crds: ", self.emit_output, + "\n Storage: ", self.storage, + "\n Fifos: ", self.outer_crdpt, self.inner_crdpt, self.in_val) + + def set_inner_crdpt(self, crdpt): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.inner_crdpt.append(crdpt) + + def set_outer_crdpt(self, crdpt): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.outer_crdpt.append(crdpt) + + def set_val(self, val): + assert not is_stkn(val), 'Values associated with points should not have stop tokens' + if val != '' and val is not None: + self.in_val.append(val) + + def out_outer_crdpt(self): + return self.curr_outer_crdpt + + def out_inner_crdpt(self): + return self.curr_inner_crdpt + + def out_val(self): + return self.curr_val + + def return_statistics(self): + if self.get_stats: + stats_dict = {"stkn_outs": self.stop_token_out, + "drop_outs": self.drop_token_out, "valid_outs": self.valid_token_out, + "zero_outs": self.zero_out, "nonzero_outs": self.nonzero_out} + stats_dict.update(super().return_statistics()) + else: + stats_dict = {} + return stats_dict + + def return_hits(self): + i = 0 + cnt_gt_zero = 0 + cnt_total = 0 + total_sum = 0 + if self.get_stats: + for k in self.hits_tracker.keys(): + if self.hits_tracker[k] > i: + i = self.hits_tracker[k] + if self.hits_tracker[k] > 1: + cnt_gt_zero += 1 + total_sum += self.hits_tracker[k] + cnt_total += 1 + return i, cnt_gt_zero, cnt_total, total_sum + # NEW VERSION: Accumulation into a vector class SparseAccumulator1(Primitive): @@ -419,6 +648,184 @@ def return_statistics(self): def print_fifos(self): print("Spaccumulator: None available") +class SparseCrdPtAccumulator2(Primitive): + def __init__(self, maxdim=100, valtype=float, **kwargs): + super().__init__(**kwargs) + self.in_crdpt0 = [] + self.in_crdpt1 = [] + self.in_val = [] + + self.curr_in_val = None + self.curr_in0_crdpt = None + self.curr_in1_crdpt = None + + self.emit_output = [] + self.curr_crdpt0 = '' + self.curr_crdpt1 = '' + self.curr_val = '' + + # Maximum possible dimension for this index level + self.maxdim = maxdim + self.order = 1 + + self.seen_done = False + # Accumulation scratchpad storage + self.storage = dict() + self.valtype = valtype + + if self.get_stats: + self.hits_tracker = {} + self.stop_token_out = 0 + self.drop_token_out = 0 + self.valid_token_out = 0 + self.zero_out = 0 + self.nonzero_out = 0 + + def return_fifo(self): + return self.in_crdpt0, self.in_crdpt1, self.in_val + + def update(self): + self.update_done() + if len(self.in_crdpt0) > 0 or len(self.in_crdpt0) > 0 or len(self.in_val) > 0: + self.block_start = False + + if self.done: + self.curr_crdpt0 = '' + self.curr_crdpt1 = '' + self.curr_val = '' + if self.get_stats: + self.drop_token_out += 1 + return + + if len(self.in_val) > 0 and len(self.in_crdpt1) > 0 and len(self.in_crdpt0) > 0: + self.curr_in_val = self.in_val.pop(0) + self.curr_in0_crdpt = self.in_crdpt0.pop(0) + self.curr_in1_crdpt = self.in_crdpt1.pop(0) + + emit_output = self.curr_in1_crdpt == 'D' + if emit_output: + self.emit_output.append([-1, -1]) + assert self.curr_in1_crdpt == 'D' and self.curr_in0_crdpt == 'D' and self.curr_in_val == 'D', \ + "If one item is a 'D' token, then all inputs must be" + self.seen_done = True + else: + if self.curr_in1_crdpt in self.storage.keys(): + inner_dict = self.storage[self.curr_in1_crdpt] + if self.get_stats: + for k in inner_dict.keys(): + self.hits_tracker[k] = 1 + if self.curr_in0_crdpt in inner_dict.keys(): + if self.get_stats: + self.hits_tracker[self.curr_in0_crdpt] += 1 + inner_dict[self.curr_in0_crdpt] += self.valtype(self.curr_in_val) + else: + if self.get_stats: + self.hits_tracker[self.curr_in0_crdpt] = 1 + inner_dict[self.curr_in0_crdpt] = self.valtype(self.curr_in_val) + else: + self.storage[self.curr_in1_crdpt] = {self.curr_in0_crdpt: self.valtype(self.curr_in_val)} + + if len(self.emit_output) > 0: + fiber = self.emit_output.pop(0) + # + key1 = min( + [item for item in self.storage.keys() if item > fiber[0]]) + key0 = min( + [item for item in self.storage[key1].keys() if item > fiber[1]]) + + self.curr_crdpt1 = key1 + self.curr_crdpt0 = key0 + self.curr_val = self.storage[key1][key0] + + # Finished inner coordinates, increment outer coordinate + if not [item for item in self.storage[key1].keys() if item > key0]: + # Do not increment outer coordinate if it's the last one + if [item for item in self.storage.keys() if item > key1]: + self.emit_output.append([key1, -1]) + # Do inner coordinates + else: + self.emit_output.append([fiber[0], key0]) + + elif self.seen_done: + self.done = True + self.seen_done = False + self.curr_crdpt0 = 'D' + self.curr_crdpt1 = 'D' + self.curr_val = 'D' + else: + self.curr_crdpt0 = '' + self.curr_crdpt1 = '' + self.curr_val = '' + + if self.get_stats: + if self.curr_val == "": + self.drop_token_out += 1 + elif is_stkn(self.curr_val): + self.stop_token_out += 1 + else: + if (isinstance(self.curr_val, float) or isinstance(self.curr_val, int)) and self.curr_val == 0: + self.zero_out += 1 + else: + self.nonzero_out += 1 + self.valid_token_out += 1 + + if self.debug: + print("Done:", self.out_done(), + "\n Curr in crd1: ", self.curr_in1_crdpt, + "\t Curr in crd0", self.curr_in0_crdpt, + "\t Curr in val", self.curr_in_val, + "\n Curr out crd1: ", self.curr_crdpt1, + "\t Curr out crd0: ", self.curr_crdpt0, + "\t Curr out val: ", self.curr_val, + "\n Emit crds: ", self.emit_output, + "\n Storage: ", self.storage) + + def set_inner_crdpt(self, crdpt): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_crdpt0.append(crdpt) + + def set_outer_crdpt(self, crdpt): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_crdpt1.append(crdpt) + + def set_val(self, val): + assert not is_stkn(val), 'Values associated with points should not have stop tokens' + if val != '' and val is not None: + self.in_val.append(val) + + def out_outer_crdpt(self): + return self.curr_crdpt1 + + def out_inner_crdpt(self): + return self.curr_crdpt0 + + def out_val(self): + return self.curr_val + + def return_hits(self): + i = 0 + cnt_gt_zero = 0 + cnt_total = 0 + for k in self.hits_tracker.keys(): + if self.hits_tracker[k] > i: + i = self.hits_tracker[k] + if self.hits_tracker[k] > 1: + cnt_gt_zero += 1 + cnt_total += 1 + return i, cnt_gt_zero, cnt_total + + def return_statistics(self): + if self.get_stats: + stats_dict = {"stkn_outs": self.stop_token_out, + "drop_outs": self.drop_token_out, "valid_outs": self.valid_token_out, + "zero_outs": self.zero_out, "nonzero_outs": self.nonzero_out} + stats_dict.update(super().return_statistics()) + else: + stats_dict = {} + return stats_dict + # NEW VERSION: Accumulation into a matrix class SparseAccumulator2(Primitive): From f28f02a7a86049e5b71d20d498f87f5e35b63445 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Nov 2023 11:33:05 -0800 Subject: [PATCH 3/9] Update spacc tests --- sam/sim/test/primitives/test_spacc.py | 421 +++++++++++++++++++++++--- 1 file changed, 384 insertions(+), 37 deletions(-) diff --git a/sam/sim/test/primitives/test_spacc.py b/sam/sim/test/primitives/test_spacc.py index 39b08960..57a71814 100644 --- a/sam/sim/test/primitives/test_spacc.py +++ b/sam/sim/test/primitives/test_spacc.py @@ -1,47 +1,50 @@ import copy import pytest +import random +import numpy as np from sam.sim.src.accumulator import SparseAccumulator1, SparseAccumulator2 +from sam.sim.src.rd_scanner import CompressedCrdRdScan +from sam.sim.src.array import Array +from sam.sim.src.wr_scanner import ValsWrScan, CompressWrScan from sam.sim.src.base import remove_emptystr -from sam.sim.test.test import TIMEOUT +from sam.sim.test.test import TIMEOUT, gen_n_comp_arrs, gen_val_arr, get_point_list, \ + convert_point_tuple, convert_ndarr_point_tuple, convert_point_tuple_ndarr, check_point_tuple, remove_zeros -arrs_dict1 = {'ocrd_in': [0, 0, 0, 2, 2, 2, 2, 2, 2, 'D'], - 'icrd_in': [0, 2, 3, 0, 2, 3, 0, 2, 3, 'D'], - 'val_in': [50, 5, 10, 40, 4, 8, -40, 33, 36, 'D'], - 'ocrd_gold': [0, 2, 'S0', 'D'], +arrs_dict1 = {'ocrd_in': [0, 2, 'S0', 2, 'S1', 'D'], + 'icrd_in': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 0, 2, 3, 'S2', 'D'], + 'val_in': [50, 5, 10, 'S0', 40, 4, 8, 'S1', -40, 33, 36, 'S2', 'D'], 'icrd_gold': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 'D'], - 'val_gold': [50, 5, 10, 'S0', 0, 37, 44, 'S1', 'D']} + 'val_gold': [90, 9, 18, 'S0', -40, 33, 36, 'S1', 'D']} +# New sparse accumulator @pytest.mark.parametrize("arrs", [arrs_dict1]) -def test_spacc1_direct(arrs, debug_sim): +def test_SparseAccumulator1new_direct(arrs, debug_sim): icrd = copy.deepcopy(arrs['icrd_in']) ocrd = copy.deepcopy(arrs['ocrd_in']) val = copy.deepcopy(arrs['val_in']) - gold_ocrd = copy.deepcopy(arrs['ocrd_gold']) gold_icrd = copy.deepcopy(arrs['icrd_gold']) gold_val = copy.deepcopy(arrs['val_gold']) - sa = SparseAccumulator1(val_stkn=True, debug=debug_sim) + sa = SparseAccumulator1(valtype=int, val_stkn=True, debug=debug_sim) done = False time = 0 - out_ocrd = [] out_icrd = [] out_val = [] while not done and time < TIMEOUT: if len(icrd) > 0: - sa.set_inner_crdpt(icrd.pop(0)) + sa.set_in_crd0(icrd.pop(0)) if len(ocrd) > 0: - sa.set_outer_crdpt(ocrd.pop(0)) + sa.set_in_crd1(ocrd.pop(0)) if len(val) > 0: sa.set_val(val.pop(0)) sa.update() - out_ocrd.append(sa.out_outer_crd()) - out_icrd.append(sa.out_inner_crd()) + out_icrd.append(sa.out_crd0()) out_val.append(sa.out_val()) print("Timestep", time, "\t Done:", sa.out_done()) @@ -49,37 +52,139 @@ def test_spacc1_direct(arrs, debug_sim): done = sa.out_done() time += 1 - out_ocrd = remove_emptystr(out_ocrd) out_icrd = remove_emptystr(out_icrd) out_val = remove_emptystr(out_val) if debug_sim: - print("Outer Crd: ", out_ocrd) print("Inner Crd: ", out_icrd) print("Vals: ", out_val) - assert (out_ocrd == gold_ocrd) assert (out_icrd == gold_icrd) assert (out_val == gold_val) -arrs_dict1 = {'crd1_in': [0, 2, 3, 0, 0, 2, 2, 2, 3, 3, 3, 3, 3, 0, 'D'], - 'crd0_in': [0, 2, 3, 0, 2, 0, 0, 3, 0, 2, 3, 0, 2, 0, 'D'], - 'val_in': [50, 5, 10, 40, 4, 8, -40, 33, 36, 1, 2, 3, 4, 5, 'D'], - 'crd1_gold': [0, 2, 3, 'S0', 'D'], - 'crd0_gold': [0, 2, 'S0', 0, 2, 3, 'S0', 0, 2, 3, 'S1', 'D'], - 'val_gold': [95.0, 4.0, 'S0', -32.0, 5.0, 33.0, 'S0', 39.0, 5.0, 12.0, 'S1', 'D']} +@pytest.mark.parametrize("dim", [2 ** x for x in range(2, 11, 2)]) +def test_SparseAccumulator1new_rand(dim, debug_sim, max_val=1000, fill=0): + in_mat_crds1, in_mat_segs1 = gen_n_comp_arrs(2, dim) + in_mat_vals1 = gen_val_arr(len(in_mat_crds1[-1]), max_val, -max_val) + + in1_tup = convert_point_tuple(get_point_list(in_mat_crds1, in_mat_segs1, in_mat_vals1)) + + nd1 = convert_point_tuple_ndarr(in1_tup, dim) + gold_nd = np.sum(nd1, 0) + gold_tup = convert_ndarr_point_tuple(gold_nd) + + rdscan_B1 = CompressedCrdRdScan(crd_arr=in_mat_crds1[0], seg_arr=in_mat_segs1[0], debug=debug_sim) + rdscan_B2 = CompressedCrdRdScan(crd_arr=in_mat_crds1[1], seg_arr=in_mat_segs1[1], debug=debug_sim) + + val_B = Array(init_arr=in_mat_vals1, debug=debug_sim) + sa = SparseAccumulator1(valtype=int, val_stkn=True, debug=debug_sim) + + vals_X = ValsWrScan(size=dim * dim, fill=fill, debug=debug_sim) + wrscan_X1 = CompressWrScan(seg_size=2, size=dim, fill=fill, debug=debug_sim) + + done = False + time = 0 + in_ref_B = [0, 'D'] + out_rdscan_B1 = [] + out_rdscan_B2 = [] + out_val_B = [] + while not done and time < TIMEOUT: + if len(in_ref_B) > 0: + rdscan_B1.set_in_ref(in_ref_B.pop(0)) + + rdscan_B2.set_in_ref(rdscan_B1.out_ref()) + val_B.set_load(rdscan_B2.out_ref()) -arrs_dict2 = {'crd1_in': [0, 0, 0, 1, 1, 1, 1, 0, 0, 'D'], - 'crd0_in': [0, 2, 3, 0, 2, 3, 4, 2, 3, 'D'], - 'val_in': [50, 5, 10, 40, 4, 8, -40, 33, 36, 'D'], - 'crd1_gold': [0, 1, 'S0', 'D'], - 'crd0_gold': [0, 2, 3, 'S0', 0, 2, 3, 4, 'S1', 'D'], - 'val_gold': [50, 38, 46, 'S0', 40, 4, 8, -40, 'S1', 'D']} + # Inject random empty strings + out_rdscan_B1.append(rdscan_B1.out_crd()) + out_rdscan_B2.append(rdscan_B2.out_crd()) + out_val_B.append(val_B.out_load()) + if random.random() < 0.2: + out_rdscan_B1.append("") + if random.random() < 0.2: + out_rdscan_B2.append("") + if random.random() < 0.2: + out_val_B.append("") + + sa.set_in_crd1(out_rdscan_B1.pop(0)) + sa.set_in_crd0(out_rdscan_B2.pop(0)) + sa.set_val(out_val_B.pop(0)) + vals_X.set_input(sa.out_val()) + wrscan_X1.set_input(sa.out_crd0()) + + rdscan_B1.update() + rdscan_B2.update() + val_B.update() + sa.update() + vals_X.update() + wrscan_X1.update() + + print("Timestep", time, "\t Done --", + "\tRdScan B1:", rdscan_B1.out_done(), + "\tSparseAccumulator1New:", sa.out_done(), + "\tArr:", val_B.out_done(), + "\tWrScan:", vals_X.out_done(), + "\tWrScan X1:", wrscan_X1.out_done(), + ) + + done = wrscan_X1.out_done() + time += 1 + + wrscan_X1.autosize() + vals_X.autosize() + + out_crds = [wrscan_X1.get_arr()] + out_segs = [wrscan_X1.get_seg_arr()] + out_val = vals_X.get_arr() + + if debug_sim: + print("Input", in_mat_segs1, in_mat_crds1, in_mat_vals1) + print("X seg", out_segs) + print("X crd", out_crds) + print("X val", out_val) + print("Gold np", gold_nd) + print("Gold Tuple", gold_tup) + if not out_val: + assert out_val == gold_tup + else: + out_tup = convert_point_tuple(get_point_list(out_crds, out_segs, out_val)) + out_tup = remove_zeros(out_tup) + assert (check_point_tuple(out_tup, gold_tup)) -@pytest.mark.parametrize("arrs", [arrs_dict1, arrs_dict2]) -def test_spacc2_direct(arrs, debug_sim): + +arrs_dict1 = {'crd2_in': [0, 1, 'S0', 'D'], + 'crd1_in': [0, 2, 'S0', 2, 'S1', 'D'], + 'crd0_in': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 0, 2, 3, 'S2', 'D'], + 'val_in': [50, 5, 10, 'S0', 40, 4, 8, 'S1', -40, 33, 36, 'S2', 'D'], + 'crd1_gold': [0, 2, 'S0', 'D'], + 'crd0_gold': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 'D'], + 'val_gold': [50, 5, 10, 'S0', 0, 37, 44, 'S1', 'D']} + +# [[0, 1], [0, 4], [0, 2, 3, 4, 5]] [[0], [0, 1, 2, 3], [0, 2, 3, 1, 3]] [-60, 85, 314, 241, -887] +arrs_dict2 = {'crd2_in': [0, 'S0', 'D'], + 'crd1_in': [0, 1, 2, 3, 'S1', 'D'], + 'crd0_in': [0, 2, 'S0', 3, 'S0', 1, 'S0', 3, 'S2', 'D'], + 'val_in': [-60, 85, 'S0', 314, 'S0', 241, 'S0', -887, 'S2', 'D'], + 'crd1_gold': [0, 1, 2, 3, 'S0', 'D'], + 'crd0_gold': [0, 2, 'S0', 3, 'S0', 1, 'S0', 3, 'S1', 'D'], + 'val_gold': [-60, 85, 'S0', 314, 'S0', 241, 'S0', -887, 'S1', 'D']} + +# [[0, 1], [0, 3], [0, 4, 6, 8]] [[1], [0, 1, 2], [0, 1, 2, 3, 1, 3, 0, 2]] [637, 210, -847, 358, 162, 687, 95, -91] +arrs_dict3 = {'crd2_in': [1, 'S0', 'D'], + 'crd1_in': [0, 1, 2, 'S1', 'D'], + 'crd0_in': [0, 1, 2, 3, 'S0', 1, 3, 'S0', 0, 2, 'S2', 'D'], + 'val_in': [637, 210, -847, 358, 'S0', 162, 687, 'S0', 95, -91, 'S2', 'D'], + 'crd1_gold': [0, 1, 2, 'S0', 'D'], + 'crd0_gold': [0, 1, 2, 3, 'S0', 1, 3, 'S0', 0, 2, 'S1', 'D'], + 'val_gold': [637, 210, -847, 358, 'S0', 162, 687, 'S0', 95, -91, 'S1', 'D']} + + +# New sparse accumulator +@pytest.mark.parametrize("arrs", [arrs_dict1, arrs_dict2, arrs_dict3]) +def test_SparseAccumulator2new_stream_direct(arrs, debug_sim): + crd2 = copy.deepcopy(arrs['crd2_in']) crd1 = copy.deepcopy(arrs['crd1_in']) crd0 = copy.deepcopy(arrs['crd0_in']) val = copy.deepcopy(arrs['val_in']) @@ -88,7 +193,7 @@ def test_spacc2_direct(arrs, debug_sim): gold_crd0 = copy.deepcopy(arrs['crd0_gold']) gold_val = copy.deepcopy(arrs['val_gold']) - sa = SparseAccumulator2(val_stkn=True, debug=debug_sim) + sa = SparseAccumulator2(valtype=int, val_stkn=True, debug=debug_sim) done = False time = 0 @@ -96,17 +201,19 @@ def test_spacc2_direct(arrs, debug_sim): out_crd0 = [] out_val = [] while not done and time < TIMEOUT: - if len(crd0) > 0: - sa.set_crd_inner(crd0.pop(0)) + if len(crd2) > 0: + sa.set_in_crd2(crd2.pop(0)) if len(crd1) > 0: - sa.set_crd_outer(crd1.pop(0)) + sa.set_in_crd1(crd1.pop(0)) + if len(crd0) > 0: + sa.set_in_crd0(crd0.pop(0)) if len(val) > 0: sa.set_val(val.pop(0)) sa.update() - out_crd1.append(sa.out_crd_outer()) - out_crd0.append(sa.out_crd_inner()) + out_crd1.append(sa.out_crd1()) + out_crd0.append(sa.out_crd0()) out_val.append(sa.out_val()) print("Timestep", time, "\t Done:", sa.out_done()) @@ -126,3 +233,243 @@ def test_spacc2_direct(arrs, debug_sim): assert (out_crd1 == gold_crd1) assert (out_crd0 == gold_crd0) assert (out_val == gold_val) + + +# Segs: [[0, 11], [0, 8, 18, 25, 31, 36, 44, 50, 61, 68, 78, 86], [0, 10, 18, 26, 35, 45, 53, 61, 69, 76, 84, 93, 99, 107, 114, 124, 134, 145, 154, 160, 168, 176, 188, 198, 208, 214, 223, 232, 242, 251, 261, 271, 280, 288, 294, 301, 308, 315, 323, 328, 339, 348, 357, 367, 378, 385, 391, 399, 408, 417, 425, 435, 440, 446, 453, 463, 467, 477, 489, 494, 502, 508, 516, 523, 531, 537, 541, 550, 557, 569, 576, 586, 593, 600, 608, 614, 623, 631, 640, 647, 656, 665, 675, 681, 689, 699, 703]] +# Crds: [[0, 2, 3, 4, 5, 8, 9, 10, 11, 14, 15], [0, 1, 2, 5, 6, 7, 9, 14, 3, 4, 5, 6, 7, 8, 10, 11, 13, 15, 4, 7, 8, 11, 12, 13, 14, 1, 5, 8, 10, 13, 14, 0, 3, 4, 7, 15, 1, 7, 9, 10, 12, 13, 14, 15, 1, 4, 8, 10, 11, 12, 1, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 0, 2, 4, 5, 8, 14, 15, 0, 1, 3, 4, 6, 8, 9, 10, 11, 13, 1, 2, 3, 6, 7, 8, 10, 12], [1, 2, 3, 8, 9, 10, 11, 13, 14, 15, 2, 3, 5, 8, 9, 10, 11, 14, 1, 4, 6, 7, 9, 10, 11, 12, 0, 1, 4, 9, 10, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 9, 13, 0, 1, 2, 6, 7, 9, 10, 15, 0, 1, 2, 8, 9, 12, 13, 15, 0, 1, 4, 6, 8, 9, 13, 15, 2, 4, 5, 7, 10, 13, 15, 2, 5, 7, 10, 11, 13, 14, 15, 0, 1, 2, 3, 9, 10, 12, 13, 15, 0, 5, 6, 11, 13, 15, 0, 5, 6, 9, 11, 12, 13, 14, 2, 3, 5, 6, 8, 10, 15, 0, 1, 2, 3, 5, 9, 11, 12, 13, 15, 1, 2, 4, 6, 8, 9, 10, 11, 14, 15, 0, 2, 3, 4, 7, 8, 9, 10, 11, 13, 15, 0, 3, 4, 5, 9, 10, 12, 14, 15, 1, 5, 6, 9, 12, 14, 0, 1, 4, 7, 10, 11, 12, 14, 1, 2, 6, 8, 10, 12, 13, 15, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 14, 15, 0, 2, 3, 4, 6, 9, 10, 11, 13, 15, 1, 3, 4, 5, 6, 7, 8, 11, 13, 14, 0, 3, 6, 8, 11, 12, 0, 2, 5, 6, 7, 8, 9, 14, 15, 1, 3, 6, 9, 11, 12, 13, 14, 15, 0, 3, 4, 5, 6, 9, 10, 12, 13, 14, 2, 4, 5, 6, 7, 9, 10, 13, 15, 0, 4, 6, 7, 8, 9, 12, 13, 14, 15, 0, 1, 2, 3, 5, 7, 8, 10, 13, 15, 2, 3, 4, 5, 6, 10, 12, 13, 15, 2, 3, 6, 7, 8, 12, 14, 15, 0, 4, 5, 10, 12, 15, 4, 5, 6, 7, 9, 10, 15, 0, 1, 5, 8, 10, 12, 14, 1, 5, 8, 9, 11, 12, 15, 0, 1, 4, 5, 6, 7, 8, 12, 0, 2, 5, 9, 11, 0, 2, 3, 4, 5, 6, 9, 10, 12, 13, 14, 1, 2, 4, 7, 10, 12, 13, 14, 15, 0, 3, 4, 5, 7, 11, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 15, 0, 1, 3, 4, 7, 8, 15, 1, 4, 6, 9, 10, 11, 0, 2, 3, 4, 7, 9, 12, 14, 0, 2, 4, 5, 8, 10, 12, 14, 15, 0, 3, 4, 6, 9, 10, 11, 12, 13, 1, 2, 6, 8, 9, 10, 12, 13, 4, 5, 6, 8, 9, 10, 11, 12, 14, 15, 1, 2, 3, 10, 15, 2, 5, 7, 9, 13, 15, 0, 2, 5, 6, 10, 11, 13, 0, 3, 4, 5, 6, 7, 10, 13, 14, 15, 2, 8, 10, 15, 0, 1, 2, 4, 6, 9, 10, 11, 12, 15, 0, 1, 2, 3, 5, 6, 7, 9, 10, 13, 14, 15, 0, 1, 7, 11, 12, 1, 2, 3, 4, 9, 11, 12, 14, 0, 2, 5, 6, 8, 10, 1, 3, 5, 7, 9, 12, 13, 14, 2, 4, 5, 7, 9, 11, 14, 0, 4, 5, 6, 7, 8, 11, 14, 0, 3, 4, 5, 7, 12, 5, 9, 12, 13, 0, 3, 4, 6, 7, 8, 9, 11, 13, 2, 3, 5, 6, 7, 9, 14, 0, 1, 2, 3, 5, 6, 7, 8, 9, 12, 13, 15, 2, 5, 6, 8, 12, 13, 15, 0, 2, 4, 5, 6, 7, 8, 12, 14, 15, 1, 2, 3, 5, 9, 12, 15, 0, 1, 5, 8, 12, 13, 14, 1, 3, 6, 8, 9, 11, 12, 13, 3, 4, 5, 9, 11, 13, 1, 2, 4, 6, 7, 8, 9, 12, 15, 1, 4, 5, 7, 12, 13, 14, 15, 0, 2, 3, 5, 7, 8, 9, 11, 12, 3, 6, 7, 9, 11, 13, 15, 1, 2, 3, 6, 8, 9, 11, 13, 14, 0, 2, 3, 4, 5, 7, 8, 11, 14, 0, 1, 2, 4, 5, 9, 12, 13, 14, 15, 5, 7, 11, 12, 13, 15, 0, 2, 3, 4, 7, 8, 10, 13, 1, 2, 3, 4, 5, 6, 7, 9, 12, 13, 4, 8, 11, 14]] +# Vals: [-275, 130, -863, 147, 180, 534, 563, 41, -124, -359, -481, -40, 158, 413, -110, 421, -441, 978, 443, 295, 743, 955, -57, 765, -901, -143, -471, -476, -820, -405, 7, -413, 566, 477, -92, -791, -672, -733, 958, -773, 265, -42, -895, 139, -262, 337, 602, -5, 424, 478, 489, 614, -744, 854, -604, 393, -693, 769, 605, -357, -970, -304, -87, 363, -919, 166, 179, -313, 151, -734, 992, -158, -603, -453, 260, -731, -135, -945, 885, -649, -917, -371, -483, -874, -761, 918, -704, 401, 985, 5, 902, -946, -218, -504, 857, 943, 273, 622, 692, 364, 61, -109, 540, -733, -826, 43, -303, 185, -938, -269, -951, -117, -279, -388, -57, 288, 562, -34, 562, -856, 481, 307, -584, 153, 600, -527, 50, 374, 887, 705, 742, -482, -52, -280, 14, -582, 387, -910, -11, -823, -974, 765, 569, -106, 754, 27, -678, 297, -248, 642, -383, -984, 119, 276, -635, -843, 558, -833, 831, 910, 148, -222, -878, -881, 576, -3, -772, 660, 718, -266, 24, -96, 125, -94, 144, -490, 14, 713, 765, -527, -925, 109, 542, -567, -368, 951, -610, -594, -482, -740, 995, 993, -487, -178, -51, 91, -517, 102, 68, -291, -558, 201, -465, -673, 112, 484, 327, 931, -988, -786, -942, 935, 961, -891, -143, 255, -823, 628, 775, -290, -163, -183, 354, -342, -465, 137, 902, 870, -466, -324, 207, 896, -308, 637, 717, -537, 395, -746, 351, 523, -960, -458, 505, 869, -580, -502, 664, 171, 320, 877, 497, 461, -226, 130, -743, 98, 826, 427, 92, -223, -822, 952, -565, 920, 569, 539, 372, -248, 592, 405, -832, -692, 673, 22, 978, -327, 935, -10, 191, -558, -430, -874, -147, -133, -850, 268, 380, 828, -519, 414, 289, -11, -407, -844, -54, 660, -9, 537, -25, -614, -985, 238, -52, -437, 763, 792, 212, -892, -527, 658, 944, 416, -910, -82, -262, 634, -380, 672, -667, 662, 331, 928, -893, 141, 715, -590, -762, 124, -116, -736, -652, 812, -919, 952, 5, -801, -189, 315, 778, 762, 269, -594, -215, 492, 650, 938, 203, 443, 546, -976, 404, 917, 377, 729, 194, -759, -12, -253, 395, -152, -142, 136, -768, 525, -20, -761, 171, -793, 174, 845, 377, 354, -424, 941, 213, -732, 836, 191, 314, -275, -390, 520, 595, -466, -639, -888, 775, 672, 299, 762, 735, -329, -566, 137, 423, -774, -548, 307, -297, -332, -497, -633, -242, -297, -648, 239, -828, -2, -577, -643, 236, 849, -792, -513, -521, -470, -212, 148, -897, 497, 627, 834, -720, -914, 245, 550, 99, -410, 550, 537, 784, -716, 646, 213, -387, 914, 976, 388, 534, -543, 588, -453, -54, -819, -792, 885, 89, -834, 832, -427, -906, -630, -79, -354, 605, 651, -96, 261, 96, -726, -832, 550, -327, 519, -561, -928, -47, -352, 186, -103, 3, -563, 247, -416, 289, -54, 815, -216, 859, 909, -540, 38, -759, 541, -132, -466, 685, -354, -746, -956, -826, 431, -343, 67, 823, -732, 946, -611, 592, 541, 198, -28, 518, 433, 348, 264, -620, 935, 700, 594, -144, -14, 15, -101, -730, 706, -200, 713, 951, 348, -62, -935, 419, 511, -358, -734, 561, -329, 685, 948, 554, 256, -615, -666, -473, 295, -688, 508, 917, -269, 363, 484, 775, 807, 408, -519, 388, -205, 443, -959, 344, 107, -600, -403, 254, 778, 518, 320, 415, -976, 339, -36, -723, -980, 846, 66, -405, 956, 932, 747, -111, -804, -495, -821, 538, 366, -866, 614, -349, -145, 426, 256, 662, 533, -549, -381, -668, 531, 954, -343, -645, 823, -611, -382, -846, 474, 503, -673, 841, -549, 263, 966, 632, 574, 719, -219, -396, -98, 374, 700, -567, 84, 951, 294, -260, 334, -532, -828, -867, -399, 575, -9, 342, 913, 736, -882, -993, 232, -627, -655, -451, 606, 571, 289, -690, -161, 864, 608, -695, 806, -620, -844, 719, 353, 834, -915, 371, -151, -239, 355, 379, 405, -48, -565, 592, -531, -850, -800, 424, -384, -663, -982, 225, 294, -557, -97, 883, -674, -42, -436, -100, 548, 466, -54, -337, -222, -11, 112, 893, 372, -950, 418, 80, -24, 391, 659, 741, 25, -321, 367, -488, 106, 361, 41, 301, 650, -672, 105, -715, 401, -989, 804, 858] +arrs_dict1 = { "segs": [[0, 11], [0, 8, 18, 25, 31, 36, 44, 50, 61, 68, 78, 86], [0, 10, 18, 26, 35, 45, 53, 61, 69, 76, + 84, 93, 99, 107, 114, 124, 134, 145, + 154, 160, 168, 176, 188, 198, 208, + 214, 223, 232, 242, 251, 261, 271, + 280, 288, 294, 301, 308, 315, 323, 328, 339, 348, 357, 367, 378, 385, 391, 399, 408, 417, 425, 435, 440, 446, 453, 463, 467, 477, 489, 494, 502, 508, 516, 523, 531, 537, 541, 550, 557, 569, 576, 586, 593, 600, 608, 614, 623, 631, 640, 647, 656, 665, 675, 681, 689, 699, 703]], + "crds": [[0, 2, 3, 4, 5, 8, 9, 10, 11, 14, 15], [0, 1, 2, 5, 6, 7, 9, 14, 3, 4, 5, 6, 7, 8, 10, 11, 13, + 15, 4, 7, 8, 11, 12, 13, 14, 1, 5, 8, 10, 13, 14, 0, 3, 4, 7, 15, 1, 7, 9, 10, 12, 13, 14, 15, 1, 4, 8, 10, 11, 12, 1, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 0, 2, 4, 5, 8, 14, 15, 0, 1, 3, 4, 6, 8, 9, 10, 11, 13, 1, 2, 3, 6, 7, 8, 10, 12], [1, 2, 3, 8, 9, 10, 11, 13, 14, 15, 2, 3, 5, 8, 9, 10, 11, 14, 1, 4, 6, 7, 9, 10, 11, 12, 0, 1, 4, 9, 10, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 9, 13, 0, 1, 2, 6, 7, 9, 10, 15, 0, 1, 2, 8, 9, 12, 13, 15, 0, 1, 4, 6, 8, 9, 13, 15, 2, 4, 5, 7, 10, 13, 15, 2, 5, 7, 10, 11, 13, 14, 15, 0, 1, 2, 3, 9, 10, 12, 13, 15, 0, 5, 6, 11, 13, 15, 0, 5, 6, 9, 11, 12, 13, 14, 2, 3, 5, 6, 8, 10, 15, 0, 1, 2, 3, 5, 9, 11, 12, 13, 15, 1, 2, 4, 6, 8, 9, 10, 11, 14, 15, 0, 2, 3, 4, 7, 8, 9, 10, 11, 13, 15, 0, 3, 4, 5, 9, 10, 12, 14, 15, 1, 5, 6, 9, 12, 14, 0, 1, 4, 7, 10, 11, 12, 14, 1, 2, 6, 8, 10, 12, 13, 15, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 14, 15, 0, 2, 3, 4, 6, 9, 10, 11, 13, 15, 1, 3, 4, 5, 6, 7, 8, 11, 13, 14, 0, 3, 6, 8, 11, 12, 0, 2, 5, 6, 7, 8, 9, 14, 15, 1, 3, 6, 9, 11, 12, 13, 14, 15, 0, 3, 4, 5, 6, 9, 10, 12, 13, 14, 2, 4, 5, 6, 7, 9, 10, 13, 15, 0, 4, 6, 7, 8, 9, 12, 13, 14, 15, 0, 1, 2, 3, 5, 7, 8, 10, 13, 15, 2, 3, 4, 5, 6, 10, 12, 13, 15, 2, 3, 6, 7, 8, 12, 14, 15, 0, 4, 5, 10, 12, 15, 4, 5, 6, 7, 9, 10, 15, 0, 1, 5, 8, 10, 12, 14, 1, 5, 8, 9, 11, 12, 15, 0, 1, 4, 5, 6, 7, 8, 12, 0, 2, 5, 9, 11, 0, 2, 3, 4, 5, 6, 9, 10, 12, 13, 14, 1, 2, 4, 7, 10, 12, 13, 14, 15, 0, 3, 4, 5, 7, 11, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 15, 0, 1, 3, 4, 7, 8, 15, 1, 4, 6, 9, 10, 11, 0, 2, 3, 4, 7, 9, 12, 14, 0, 2, 4, 5, 8, 10, 12, 14, 15, 0, 3, 4, 6, 9, 10, 11, 12, 13, 1, 2, 6, 8, 9, 10, 12, 13, 4, 5, 6, 8, 9, 10, 11, 12, 14, 15, 1, 2, 3, 10, 15, 2, 5, 7, 9, 13, 15, 0, 2, 5, 6, 10, 11, 13, 0, 3, 4, 5, 6, 7, 10, 13, 14, 15, 2, 8, 10, 15, 0, 1, 2, 4, 6, 9, 10, 11, 12, 15, 0, 1, 2, 3, 5, 6, 7, 9, 10, 13, 14, 15, 0, 1, 7, 11, 12, 1, 2, 3, 4, 9, 11, 12, 14, 0, 2, 5, 6, 8, 10, 1, 3, 5, 7, 9, 12, 13, 14, 2, 4, 5, 7, 9, 11, 14, 0, 4, 5, 6, 7, 8, 11, 14, 0, 3, 4, 5, 7, 12, 5, 9, 12, 13, 0, 3, 4, 6, 7, 8, 9, 11, 13, 2, 3, 5, 6, 7, 9, 14, 0, 1, 2, 3, 5, 6, 7, 8, 9, 12, 13, 15, 2, 5, 6, 8, 12, 13, 15, 0, 2, 4, 5, 6, 7, 8, 12, 14, 15, 1, 2, 3, 5, 9, 12, 15, 0, 1, 5, 8, 12, 13, 14, 1, 3, 6, 8, 9, 11, 12, 13, 3, 4, 5, 9, 11, 13, 1, 2, 4, 6, 7, 8, 9, 12, 15, 1, 4, 5, 7, 12, 13, 14, 15, 0, 2, 3, 5, 7, 8, 9, 11, 12, 3, 6, 7, 9, 11, 13, 15, 1, 2, 3, 6, 8, 9, 11, 13, 14, 0, 2, 3, 4, 5, 7, 8, 11, 14, 0, 1, 2, 4, 5, 9, 12, 13, 14, 15, 5, 7, 11, 12, 13, 15, 0, 2, 3, 4, 7, 8, 10, 13, 1, 2, 3, 4, 5, 6, 7, 9, 12, 13, 4, 8, 11, 14]], + "vals": [-275, 130, -863, 147, 180, 534, 563, 41, -124, -359, -481, -40, 158, 413, -110, 421, -441, 978, + 443, 295, 743, 955, -57, 765, -901, -143, -471, -476, -820, -405, 7, -413, 566, 477, -92, -791, -672, -733, 958, -773, 265, -42, -895, 139, -262, 337, 602, -5, 424, 478, 489, 614, -744, 854, -604, 393, -693, 769, 605, -357, -970, -304, -87, 363, -919, 166, 179, -313, 151, -734, 992, -158, -603, -453, 260, -731, -135, -945, 885, -649, -917, -371, -483, -874, -761, 918, -704, 401, 985, 5, 902, -946, -218, -504, 857, 943, 273, 622, 692, 364, 61, -109, 540, -733, -826, 43, -303, 185, -938, -269, -951, -117, -279, -388, -57, 288, 562, -34, 562, -856, 481, 307, -584, 153, 600, -527, 50, 374, 887, 705, 742, -482, -52, -280, 14, -582, 387, -910, -11, -823, -974, 765, 569, -106, 754, 27, -678, 297, -248, 642, -383, -984, 119, 276, -635, -843, 558, -833, 831, 910, 148, -222, -878, -881, 576, -3, -772, 660, 718, -266, 24, -96, 125, -94, 144, -490, 14, 713, 765, -527, -925, 109, 542, -567, -368, 951, -610, -594, -482, -740, 995, 993, -487, -178, -51, 91, -517, 102, 68, -291, -558, 201, -465, -673, 112, 484, 327, 931, -988, -786, -942, 935, 961, -891, -143, 255, -823, 628, 775, -290, -163, -183, 354, -342, -465, 137, 902, 870, -466, -324, 207, 896, -308, 637, 717, -537, 395, -746, 351, 523, -960, -458, 505, 869, -580, -502, 664, 171, 320, 877, 497, 461, -226, 130, -743, 98, 826, 427, 92, -223, -822, 952, -565, 920, 569, 539, 372, -248, 592, 405, -832, -692, 673, 22, 978, -327, 935, -10, 191, -558, -430, -874, -147, -133, -850, 268, 380, 828, -519, 414, 289, -11, -407, -844, -54, 660, -9, 537, -25, -614, -985, 238, -52, -437, 763, 792, 212, -892, -527, 658, 944, 416, -910, -82, -262, 634, -380, 672, -667, 662, 331, 928, -893, 141, 715, -590, -762, 124, -116, -736, -652, 812, -919, 952, 5, -801, -189, 315, 778, 762, 269, -594, -215, 492, 650, 938, 203, 443, 546, -976, 404, 917, 377, 729, 194, -759, -12, -253, 395, -152, -142, 136, -768, 525, -20, -761, 171, -793, 174, 845, 377, 354, -424, 941, 213, -732, 836, 191, 314, -275, -390, 520, 595, -466, -639, -888, 775, 672, 299, 762, 735, -329, -566, 137, 423, -774, -548, 307, -297, -332, -497, -633, -242, -297, -648, 239, -828, -2, -577, -643, 236, 849, -792, -513, -521, -470, -212, 148, -897, 497, 627, 834, -720, -914, 245, 550, 99, -410, 550, 537, 784, -716, 646, 213, -387, 914, 976, 388, 534, -543, 588, -453, -54, -819, -792, 885, 89, -834, 832, -427, -906, -630, -79, -354, 605, 651, -96, 261, 96, -726, -832, 550, -327, 519, -561, -928, -47, -352, 186, -103, 3, -563, 247, -416, 289, -54, 815, -216, 859, 909, -540, 38, -759, 541, -132, -466, 685, -354, -746, -956, -826, 431, -343, 67, 823, -732, 946, -611, 592, 541, 198, -28, 518, 433, 348, 264, -620, 935, 700, 594, -144, -14, 15, -101, -730, 706, -200, 713, 951, 348, -62, -935, 419, 511, -358, -734, 561, -329, 685, 948, 554, 256, -615, -666, -473, 295, -688, 508, 917, -269, 363, 484, 775, 807, 408, -519, 388, -205, 443, -959, 344, 107, -600, -403, 254, 778, 518, 320, 415, -976, 339, -36, -723, -980, 846, 66, -405, 956, 932, 747, -111, -804, -495, -821, 538, 366, -866, 614, -349, -145, 426, 256, 662, 533, -549, -381, -668, 531, 954, -343, -645, 823, -611, -382, -846, 474, 503, -673, 841, -549, 263, 966, 632, 574, 719, -219, -396, -98, 374, 700, -567, 84, 951, 294, -260, 334, -532, -828, -867, -399, 575, -9, 342, 913, 736, -882, -993, 232, -627, -655, -451, 606, 571, 289, -690, -161, 864, 608, -695, 806, -620, -844, 719, 353, 834, -915, 371, -151, -239, 355, 379, 405, -48, -565, 592, -531, -850, -800, 424, -384, -663, -982, 225, 294, -557, -97, 883, -674, -42, -436, -100, 548, 466, -54, -337, -222, -11, 112, 893, 372, -950, 418, 80, -24, 391, 659, 741, 25, -321, 367, -488, 106, 361, 41, 301, 650, -672, 105, -715, 401, -989, 804, 858], + "dim": 16 +} + +# Segs: [[0, 8], [0, 10, 21, 30, 40, 52, 61, 68, 76], [0, 8, 18, 28, 35, 48, 57, 62, 73, 83, 94, 99, 111, 121, 129, 137, 144, 152, 159, 166, 176, 184, 191, 197, 204, 214, 221, 233, 240, 246, 255, 264, 268, 275, 282, 291, 300, 308, 313, 320, 328, 338, 346, 356, 365, 376, 383, 391, 401, 407, 419, 426, 430, 439, 448, 457, 462, 468, 473, 480, 486, 494, 501, 508, 517, 526, 533, 543, 551, 559, 567, 577, 586, 592, 598, 608, 614]] +# Crds: [[0, 1, 2, 4, 7, 10, 12, 13], [0, 2, 5, 7, 8, 10, 11, 13, 14, 15, 0, 1, 2, 3, 4, 5, 7, 10, 12, 14, 15, 0, 1, 2, 3, 4, 5, 9, 14, 15, 0, 1, 2, 3, 6, 8, 9, 10, 11, 14, 0, 1, 2, 3, 4, 6, 7, 8, 11, 12, 14, 15, 0, 2, 3, 4, 7, 8, 11, 13, 14, 5, 6, 9, 10, 11, 14, 15, 2, 3, 5, 6, 10, 11, 12, 15], [0, 1, 3, 5, 7, 8, 11, 12, 0, 1, 2, 3, 6, 7, 9, 11, 14, 15, 0, 1, 2, 4, 6, 7, 11, 13, 14, 15, 2, 3, 4, 6, 10, 14, 15, 0, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 1, 2, 4, 5, 6, 9, 10, 11, 15, 4, 5, 6, 8, 13, 0, 1, 2, 4, 6, 9, 10, 11, 13, 14, 15, 1, 4, 6, 7, 8, 9, 12, 13, 14, 15, 1, 3, 4, 6, 8, 9, 10, 11, 12, 13, 15, 4, 6, 8, 9, 15, 0, 1, 2, 5, 6, 7, 8, 11, 12, 13, 14, 15, 1, 2, 5, 6, 8, 9, 11, 12, 13, 15, 3, 5, 6, 9, 10, 11, 12, 15, 0, 1, 2, 6, 7, 12, 14, 15, 2, 6, 7, 9, 10, 11, 15, 0, 4, 6, 7, 8, 10, 11, 13, 0, 5, 6, 8, 13, 14, 15, 3, 7, 9, 10, 11, 13, 15, 0, 3, 4, 6, 7, 8, 9, 11, 14, 15, 1, 2, 3, 4, 5, 9, 10, 14, 2, 3, 5, 8, 10, 12, 15, 0, 2, 8, 9, 11, 12, 0, 1, 3, 4, 10, 13, 15, 0, 1, 4, 5, 6, 7, 8, 11, 12, 13, 1, 2, 3, 6, 10, 11, 13, 1, 2, 3, 4, 5, 8, 9, 11, 12, 13, 14, 15, 2, 4, 5, 6, 9, 13, 14, 0, 5, 6, 9, 11, 15, 0, 1, 2, 4, 6, 8, 12, 13, 15, 0, 1, 2, 4, 5, 6, 8, 9, 11, 4, 6, 8, 13, 1, 2, 3, 6, 10, 13, 15, 0, 1, 2, 8, 13, 14, 15, 0, 2, 3, 4, 7, 9, 10, 12, 15, 0, 2, 4, 5, 7, 8, 10, 11, 15, 2, 4, 5, 7, 8, 10, 12, 15, 2, 8, 10, 13, 14, 0, 6, 9, 10, 12, 14, 15, 3, 4, 6, 7, 9, 10, 11, 14, 0, 3, 6, 7, 10, 11, 12, 13, 14, 15, 0, 2, 7, 8, 9, 11, 14, 15, 0, 1, 3, 5, 7, 8, 9, 12, 14, 15, 0, 3, 4, 5, 7, 8, 10, 11, 12, 0, 1, 2, 5, 6, 8, 9, 10, 11, 12, 14, 1, 2, 4, 5, 7, 8, 15, 1, 5, 8, 9, 10, 12, 13, 14, 0, 1, 2, 7, 8, 9, 10, 11, 12, 15, 0, 1, 6, 7, 10, 15, 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 13, 15, 0, 1, 2, 3, 9, 11, 14, 0, 4, 8, 10, 0, 1, 2, 4, 8, 11, 12, 14, 15, 0, 1, 2, 5, 8, 9, 12, 13, 14, 1, 3, 4, 5, 8, 9, 11, 12, 15, 1, 5, 10, 11, 14, 0, 5, 6, 9, 14, 15, 1, 2, 13, 14, 15, 4, 5, 6, 7, 8, 11, 12, 0, 2, 6, 10, 12, 15, 1, 3, 5, 6, 8, 9, 12, 15, 0, 3, 4, 7, 11, 12, 15, 1, 2, 4, 7, 9, 10, 11, 0, 3, 5, 7, 8, 9, 11, 12, 14, 0, 2, 3, 5, 6, 10, 11, 13, 14, 0, 2, 4, 7, 10, 12, 13, 0, 3, 4, 5, 6, 7, 9, 10, 13, 14, 1, 4, 6, 7, 8, 9, 11, 15, 0, 1, 2, 4, 7, 8, 13, 14, 0, 2, 4, 5, 10, 11, 12, 13, 0, 2, 3, 6, 8, 9, 10, 11, 12, 15, 0, 1, 2, 4, 5, 6, 9, 11, 12, 0, 1, 5, 13, 14, 15, 0, 2, 3, 7, 11, 12, 0, 1, 2, 3, 6, 8, 9, 10, 12, 13, 1, 5, 7, 9, 14, 15]] +# Vals: [-250, 363, -637, 105, -364, -874, 861, -490, -222, 321, -667, -537, -151, -746, -36, 71, -32, -998, 438, 604, 436, -383, 27, -107, -106, -109, -707, 226, 953, 707, -210, -155, 377, -780, 102, -186, -798, 171, -467, 982, -397, 387, -395, 456, -864, -836, -271, -27, -99, -159, -815, 885, -662, -14, -951, 462, 617, -442, 433, 395, 82, 819, -938, 877, -57, -349, -993, -812, -541, -269, -284, -60, -242, -744, 62, -829, -976, 403, 621, -87, -548, 731, -643, -137, -264, -38, 613, 643, 882, 410, -124, -688, 86, 365, 632, 657, -955, 279, -80, -409, 357, 181, 527, 537, 340, -683, -434, 203, 68, 480, 452, 981, 890, 700, -559, 792, 241, -528, 275, 45, 211, -765, 511, 931, -560, -897, 836, -816, -881, 44, 726, -858, -322, 847, 247, -336, -276, -835, 732, 961, -30, -570, 924, -605, -399, 80, 952, 747, 546, 25, -743, -687, -981, 454, 579, -634, 924, 156, -708, 716, -447, -234, -370, -746, -864, -87, 633, -176, 839, -868, -26, 32, 896, 593, 298, -668, -225, -213, 516, -300, -98, 417, -549, 168, 978, -902, -79, -192, 789, 488, 188, 814, -1000, 205, 186, 494, -319, 613, -460, -645, -723, -692, -333, -953, -211, -291, -957, 797, 607, -30, 611, 931, -725, -809, 583, 672, 262, 620, 711, 774, 563, 157, 395, 60, -456, -130, 268, 999, 705, 989, -812, 223, 501, 920, -495, -371, 816, 671, -183, 205, 910, -553, 465, -316, 712, 410, -804, -744, -369, -665, 619, -617, 256, -823, 640, 75, -758, -710, -697, -659, 990, -858, -235, 476, -236, 248, -47, 259, 271, -163, -889, -216, 692, -418, -14, 614, -829, -670, 381, -385, 928, -797, 670, 246, 395, 474, 917, -717, 700, -214, 162, -517, 389, 437, 278, -45, 219, -805, 617, 533, -772, 255, -25, 978, -46, -873, 262, -978, -13, -289, 812, -988, 626, -442, 223, -272, 933, 180, 182, 35, -176, -770, -86, 547, 590, -551, -627, -463, -361, 267, 859, -147, 979, -437, 735, -112, -348, -395, -745, -328, -974, -602, -820, -4, -600, -273, 458, 634, 591, 975, -116, -432, -689, -916, 523, -227, -203, 719, 527, 992, -475, -103, 28, -229, 680, -62, -83, -105, -394, 606, 15, 919, -546, 803, 5, -52, -817, 647, -436, 858, -51, -987, -923, 835, -2, 88, 873, -444, -509, -185, -988, -951, -863, -523, -969, -373, -817, -629, -999, 467, 148, -168, 512, -446, -386, -582, 810, 326, 505, -707, -339, 155, -27, -104, -603, -207, -740, -138, -107, 998, -252, 160, 689, -585, -140, 396, 453, 42, -325, 782, -638, 973, -343, 942, 968, 979, 879, -745, 245, 917, -532, -278, -194, 912, -299, 248, -849, -565, -100, -779, -658, -110, -257, -39, -766, 885, -704, -4, 533, 77, -27, -704, 497, -934, 299, 528, 149, 583, -697, -107, -48, 299, 759, 377, -798, -825, -893, -299, -178, 183, 39, -367, -862, -660, -157, -93, -89, 36, 563, 547, 392, -977, -864, 376, 4, 19, -416, 485, -637, 156, -20, -714, 116, -383, -182, -771, -851, -973, -282, 716, -243, -899, -267, 792, 668, -921, 10, -612, 96, 354, -23, 415, 233, 934, -193, 619, 5, 281, -660, -299, 50, 105, -469, -141, 347, 440, 758, -620, 620, -460, 673, 16, -905, -468, 565, -416, -3, -248, 57, 870, -895, 890, 847, -127, -490, -881, -901, 455, 235, 260, -703, -255, -541, -238, -215, 886, 429, -350, -357, 828, 646, 448, -860, -894, -934, -314, 922, -640, 506, 117, 525, -606, -701, -582, 356, 172, -218, -780, -540, 272, -768, 397, -41, -795, -619, -568, 268, 691, 669, -452, -851, -218, -432, -767, -300, 178, 769, -191, -272, 349, 573, -291, 429, -236] +@pytest.mark.parametrize("arrs", [arrs_dict1]) +def test_SparseAccumulator2new_tensor_direct(arrs, debug_sim, fill=0): + in_mat_crds1 = arrs["crds"] + in_mat_segs1 = arrs["segs"] + in_mat_vals1 = arrs["vals"] + dim = arrs["dim"] + + in1_tup = convert_point_tuple(get_point_list(in_mat_crds1, in_mat_segs1, in_mat_vals1)) + + nd1 = convert_point_tuple_ndarr(in1_tup, dim) + gold_nd = np.sum(nd1, 0) + gold_tup = convert_ndarr_point_tuple(gold_nd) + + rdscan_B1 = CompressedCrdRdScan(crd_arr=in_mat_crds1[0], seg_arr=in_mat_segs1[0], debug=debug_sim) + rdscan_B2 = CompressedCrdRdScan(crd_arr=in_mat_crds1[1], seg_arr=in_mat_segs1[1], debug=debug_sim) + rdscan_B3 = CompressedCrdRdScan(crd_arr=in_mat_crds1[2], seg_arr=in_mat_segs1[2], debug=debug_sim) + + val_B = Array(init_arr=in_mat_vals1, debug=debug_sim) + sa = SparseAccumulator2(valtype=int, val_stkn=True, debug=debug_sim) + + vals_X = ValsWrScan(size=dim * dim, fill=fill, debug=debug_sim) + wrscan_X1 = CompressWrScan(seg_size=2, size=dim, fill=fill, debug=debug_sim) + wrscan_X2 = CompressWrScan(seg_size=dim + 1, size=dim * dim, fill=fill, debug=debug_sim) + + done = False + time = 0 + in_ref_B = [0, 'D'] + out_rdscan_B1 = [] + out_rdscan_B2 = [] + out_rdscan_B3 = [] + out_val_B = [] + while not done and time < TIMEOUT: + if len(in_ref_B) > 0: + rdscan_B1.set_in_ref(in_ref_B.pop(0)) + + rdscan_B2.set_in_ref(rdscan_B1.out_ref()) + rdscan_B3.set_in_ref(rdscan_B2.out_ref()) + val_B.set_load(rdscan_B3.out_ref()) + + # Inject random empty strings + out_rdscan_B1.append(rdscan_B1.out_crd()) + out_rdscan_B2.append(rdscan_B2.out_crd()) + out_rdscan_B3.append(rdscan_B3.out_crd()) + out_val_B.append(val_B.out_load()) + + # Inject random delay + if random.random() < 0.2: + out_rdscan_B1.append("") + if random.random() < 0.2: + out_rdscan_B2.append("") + if random.random() < 0.2: + out_val_B.append("") + + sa.set_in_crd2(out_rdscan_B1.pop(0)) + sa.set_in_crd1(out_rdscan_B2.pop(0)) + sa.set_in_crd0(out_rdscan_B3.pop(0)) + sa.set_val(out_val_B.pop(0)) + + vals_X.set_input(sa.out_val()) + wrscan_X1.set_input(sa.out_crd1()) + wrscan_X2.set_input(sa.out_crd0()) + + rdscan_B1.update() + rdscan_B2.update() + rdscan_B3.update() + val_B.update() + sa.update() + vals_X.update() + wrscan_X1.update() + wrscan_X2.update() + + if time % 100 == 0: + print("Timestep", time, "\t Done --", + "\tRdScan B1:", rdscan_B1.out_done(), + "\tRdScan B2:", rdscan_B2.out_done(), + "\tRdScan B3:", rdscan_B3.out_done(), + "\tSparseAccumulator1New:", sa.out_done(), + "\tArr:", val_B.out_done(), + "\tWrScan:", vals_X.out_done(), + "\tWrScan X1:", wrscan_X1.out_done(), + "\tWrScan X2:", wrscan_X2.out_done(), + ) + + done = wrscan_X2.out_done() and wrscan_X1.out_done() and vals_X.out_done() + time += 1 + + wrscan_X1.autosize() + wrscan_X2.autosize() + vals_X.autosize() + + out_crds = [wrscan_X1.get_arr(), wrscan_X2.get_arr()] + out_segs = [wrscan_X1.get_seg_arr(), wrscan_X2.get_seg_arr()] + out_val = vals_X.get_arr() + + if debug_sim: + print("Input", in_mat_segs1, in_mat_crds1, in_mat_vals1) + print(nd1) + print("X seg", out_segs) + print("X crd", out_crds) + print("X val", out_val) + print("Gold np", gold_nd) + print("Gold Tuple", gold_tup) + + if not out_val: + assert out_val == gold_tup + else: + out_tup = convert_point_tuple(get_point_list(out_crds, out_segs, out_val)) + out_tup = remove_zeros(out_tup) + print("\nSegs: " + str(in_mat_segs1) + "\nCrds: " + str(in_mat_crds1) + \ + "\nVals: " + str(in_mat_vals1)) + assert check_point_tuple(out_tup, gold_tup) + +@pytest.mark.parametrize("dim", [2 ** x for x in range(1, 5, 1)]) +def test_SparseAccumulator2new_tensor_rand(dim, debug_sim, max_val=1000, fill=0): + in_mat_crds1, in_mat_segs1 = gen_n_comp_arrs(3, dim) + in_mat_vals1 = gen_val_arr(len(in_mat_crds1[-1]), max_val, -max_val) + + in1_tup = convert_point_tuple(get_point_list(in_mat_crds1, in_mat_segs1, in_mat_vals1)) + + nd1 = convert_point_tuple_ndarr(in1_tup, dim) + gold_nd = np.sum(nd1, 0) + gold_tup = convert_ndarr_point_tuple(gold_nd) + + rdscan_B1 = CompressedCrdRdScan(crd_arr=in_mat_crds1[0], seg_arr=in_mat_segs1[0], debug=debug_sim) + rdscan_B2 = CompressedCrdRdScan(crd_arr=in_mat_crds1[1], seg_arr=in_mat_segs1[1], debug=debug_sim) + rdscan_B3 = CompressedCrdRdScan(crd_arr=in_mat_crds1[2], seg_arr=in_mat_segs1[2], debug=debug_sim) + + val_B = Array(init_arr=in_mat_vals1, debug=debug_sim) + sa = SparseAccumulator2(valtype=int, val_stkn=True, debug=debug_sim) + + vals_X = ValsWrScan(size=dim * dim, fill=fill, debug=debug_sim) + wrscan_X1 = CompressWrScan(seg_size=2, size=dim, fill=fill, debug=debug_sim) + wrscan_X2 = CompressWrScan(seg_size=dim + 1, size=dim * dim, fill=fill, debug=debug_sim) + + done = False + time = 0 + in_ref_B = [0, 'D'] + out_rdscan_B1 = [] + out_rdscan_B2 = [] + out_rdscan_B3 = [] + out_val_B = [] + while not done and time < TIMEOUT: + if len(in_ref_B) > 0: + rdscan_B1.set_in_ref(in_ref_B.pop(0)) + + rdscan_B2.set_in_ref(rdscan_B1.out_ref()) + rdscan_B3.set_in_ref(rdscan_B2.out_ref()) + val_B.set_load(rdscan_B3.out_ref()) + + # Inject random empty strings + out_rdscan_B1.append(rdscan_B1.out_crd()) + out_rdscan_B2.append(rdscan_B2.out_crd()) + out_rdscan_B3.append(rdscan_B3.out_crd()) + out_val_B.append(val_B.out_load()) + + # Inject random delay + if random.random() < 0.2: + out_rdscan_B1.append("") + if random.random() < 0.2: + out_rdscan_B2.append("") + if random.random() < 0.2: + out_val_B.append("") + + sa.set_in_crd2(out_rdscan_B1.pop(0)) + sa.set_in_crd1(out_rdscan_B2.pop(0)) + sa.set_in_crd0(out_rdscan_B3.pop(0)) + sa.set_val(out_val_B.pop(0)) + + vals_X.set_input(sa.out_val()) + wrscan_X1.set_input(sa.out_crd1()) + wrscan_X2.set_input(sa.out_crd0()) + + rdscan_B1.update() + rdscan_B2.update() + rdscan_B3.update() + val_B.update() + sa.update() + vals_X.update() + wrscan_X1.update() + wrscan_X2.update() + + if time % 100 == 0: + print("Timestep", time, "\t Done --", + "\tRdScan B1:", rdscan_B1.out_done(), + "\tRdScan B2:", rdscan_B2.out_done(), + "\tRdScan B3:", rdscan_B3.out_done(), + "\tSparseAccumulator1New:", sa.out_done(), + "\tArr:", val_B.out_done(), + "\tWrScan:", vals_X.out_done(), + "\tWrScan X1:", wrscan_X1.out_done(), + "\tWrScan X2:", wrscan_X2.out_done(), + ) + + done = wrscan_X2.out_done() and wrscan_X1.out_done() and vals_X.out_done() + time += 1 + + wrscan_X1.autosize() + wrscan_X2.autosize() + vals_X.autosize() + + out_crds = [wrscan_X1.get_arr(), wrscan_X2.get_arr()] + out_segs = [wrscan_X1.get_seg_arr(), wrscan_X2.get_seg_arr()] + out_val = vals_X.get_arr() + + if debug_sim: + print("Input", in_mat_segs1, in_mat_crds1, in_mat_vals1) + print(nd1) + print("X seg", out_segs) + print("X crd", out_crds) + print("X val", out_val) + print("Gold np", gold_nd) + print("Gold Tuple", gold_tup) + + if not out_val: + assert out_val == gold_tup + else: + out_tup = convert_point_tuple(get_point_list(out_crds, out_segs, out_val)) + print("\nSegs: " + str(in_mat_segs1) + "\nCrds: " + str(in_mat_crds1) + \ + "\nVals: " + str(in_mat_vals1)) + assert check_point_tuple(out_tup, gold_tup) \ No newline at end of file From e84a882fb333dae23b96a9bacde37f4e0f4023ee Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Nov 2023 20:11:15 -0800 Subject: [PATCH 4/9] New graphs --- compiler/sam-outputs/dot/mat_elemadd.gv | 32 ++++++++ compiler/sam-outputs/dot/mat_elemadd3.gv | 44 ++++++++++ compiler/sam-outputs/dot/mat_elemmul.gv | 35 ++++++++ compiler/sam-outputs/dot/mat_identity.gv | 14 ++++ .../sam-outputs/dot/mat_identity_dense.gv | 14 ++++ compiler/sam-outputs/dot/mat_sddmm.gv | 69 ++++++++++++++++ compiler/sam-outputs/dot/mat_spacc_simple.gv | 26 ++++++ compiler/sam-outputs/dot/mat_vecmul_ij.gv | 32 ++++++++ compiler/sam-outputs/dot/mat_vecmul_ji.gv | 35 ++++++++ compiler/sam-outputs/dot/matmul_ijk.gv | 43 ++++++++++ compiler/sam-outputs/dot/matmul_ikj.gv | 55 +++++++++++++ .../matmul_ikj_hand_BLACKBOX_with_crddrop.gv | 47 +++++++++++ compiler/sam-outputs/dot/matmul_jik.gv | 43 ++++++++++ compiler/sam-outputs/dot/matmul_jki.gv | 55 +++++++++++++ compiler/sam-outputs/dot/matmul_kij.gv | 51 ++++++++++++ compiler/sam-outputs/dot/matmul_kji.gv | 51 ++++++++++++ compiler/sam-outputs/dot/tensor3_elemadd.gv | 43 ++++++++++ compiler/sam-outputs/dot/tensor3_elemmul.gv | 49 ++++++++++++ compiler/sam-outputs/dot/tensor3_identity.gv | 18 +++++ .../sam-outputs/dot/tensor3_identity_dense.gv | 18 +++++ compiler/sam-outputs/dot/tensor3_innerprod.gv | 43 ++++++++++ compiler/sam-outputs/dot/tensor3_mttkrp.gv | 80 +++++++++++++++++++ compiler/sam-outputs/dot/tensor3_ttm.gv | 54 +++++++++++++ compiler/sam-outputs/dot/tensor3_ttv.gv | 43 ++++++++++ .../dot/vec_ds_compression_WRONG.gv | 10 +++ compiler/sam-outputs/dot/vec_elemadd.gv | 21 +++++ compiler/sam-outputs/dot/vec_elemmul.gv | 21 +++++ compiler/sam-outputs/dot/vec_identity.gv | 10 +++ compiler/sam-outputs/dot/vec_scalar_mul.gv | 21 +++++ .../dot/vec_sd_compression_WRONG.gv | 10 +++ compiler/sam-outputs/dot/vec_spacc_simple.gv | 17 ++++ compiler/sam-outputs/onyx-dot/matmul_ikj.gv | 44 ++++++++++ 32 files changed, 1148 insertions(+) create mode 100644 compiler/sam-outputs/dot/mat_elemadd.gv create mode 100644 compiler/sam-outputs/dot/mat_elemadd3.gv create mode 100644 compiler/sam-outputs/dot/mat_elemmul.gv create mode 100644 compiler/sam-outputs/dot/mat_identity.gv create mode 100644 compiler/sam-outputs/dot/mat_identity_dense.gv create mode 100644 compiler/sam-outputs/dot/mat_sddmm.gv create mode 100644 compiler/sam-outputs/dot/mat_spacc_simple.gv create mode 100644 compiler/sam-outputs/dot/mat_vecmul_ij.gv create mode 100644 compiler/sam-outputs/dot/mat_vecmul_ji.gv create mode 100644 compiler/sam-outputs/dot/matmul_ijk.gv create mode 100644 compiler/sam-outputs/dot/matmul_ikj.gv create mode 100644 compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv create mode 100644 compiler/sam-outputs/dot/matmul_jik.gv create mode 100644 compiler/sam-outputs/dot/matmul_jki.gv create mode 100644 compiler/sam-outputs/dot/matmul_kij.gv create mode 100644 compiler/sam-outputs/dot/matmul_kji.gv create mode 100644 compiler/sam-outputs/dot/tensor3_elemadd.gv create mode 100644 compiler/sam-outputs/dot/tensor3_elemmul.gv create mode 100644 compiler/sam-outputs/dot/tensor3_identity.gv create mode 100644 compiler/sam-outputs/dot/tensor3_identity_dense.gv create mode 100644 compiler/sam-outputs/dot/tensor3_innerprod.gv create mode 100644 compiler/sam-outputs/dot/tensor3_mttkrp.gv create mode 100644 compiler/sam-outputs/dot/tensor3_ttm.gv create mode 100644 compiler/sam-outputs/dot/tensor3_ttv.gv create mode 100644 compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv create mode 100644 compiler/sam-outputs/dot/vec_elemadd.gv create mode 100644 compiler/sam-outputs/dot/vec_elemmul.gv create mode 100644 compiler/sam-outputs/dot/vec_identity.gv create mode 100644 compiler/sam-outputs/dot/vec_scalar_mul.gv create mode 100644 compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv create mode 100644 compiler/sam-outputs/dot/vec_spacc_simple.gv create mode 100644 compiler/sam-outputs/onyx-dot/matmul_ikj.gv diff --git a/compiler/sam-outputs/dot/mat_elemadd.gv b/compiler/sam-outputs/dot/mat_elemadd.gv new file mode 100644 index 00000000..e3f2e6a3 --- /dev/null +++ b/compiler/sam-outputs/dot/mat_elemadd.gv @@ -0,0 +1,32 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss01" + 10 [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"] + 9 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] + 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"] + 7 [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"] + 6 [comment="type=union,index=j" label="union j" color=purple shape=box style=filled type="union" index="j"] + 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"] + 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 3 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] + 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"] + 11 [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"] + 10 -> 9 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 9 -> 2 [label="crd" style=dashed type="crd"] + 9 -> 7 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 7 -> 6 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 6 -> 1 [label="crd" style=dashed type="crd"] + 6 -> 4 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 6 -> 5 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 5 -> 3 [label="val" type="val"] + 7 -> 6 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 9 -> 8 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 8 -> 6 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 8 -> 6 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 10 -> 9 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 11 -> 9 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 11 -> 9 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/mat_elemadd3.gv b/compiler/sam-outputs/dot/mat_elemadd3.gv new file mode 100644 index 00000000..eb3cc154 --- /dev/null +++ b/compiler/sam-outputs/dot/mat_elemadd3.gv @@ -0,0 +1,44 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss01,D=ss01" + 13 [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"] + 12 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] + 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"] + 9 [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"] + 8 [comment="type=union,index=j" label="union j" color=purple shape=box style=filled type="union" index="j"] + 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"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 4 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] + 3 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] + 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"] + 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 7 [comment="type=arrayvals,tensor=D" label="Array Vals: D" color=green2 shape=box style=filled type="arrayvals" tensor="D"] + 10 [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=fiberlookup,index=j,tensor=D,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: D1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="D" mode="1" format="compressed" src="true" root="false"] + 14 [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"] + 15 [comment="type=fiberlookup,index=i,tensor=D,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: D0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="D" mode="0" format="compressed" src="true" root="true"] + 13 -> 12 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 12 -> 2 [label="crd" style=dashed type="crd"] + 12 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 9 -> 8 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 8 -> 1 [label="crd" style=dashed type="crd"] + 8 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 5 -> 4 [label="val" type="val"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 8 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 6 -> 4 [label="val" type="val"] + 8 -> 7 [label="ref_out-D" style=bold type="ref" comment="out-D"] + 7 -> 3 [label="val" type="val"] + 9 -> 8 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 12 -> 10 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 10 -> 8 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 10 -> 8 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 12 -> 11 [label="ref_out-D" style=bold type="ref" comment="out-D"] + 11 -> 8 [label="crd_in-D" style=dashed type="crd" comment="in-D"] + 11 -> 8 [label="ref_in-D" style=bold type="ref" comment="in-D"] + 13 -> 12 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 14 -> 12 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 14 -> 12 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 15 -> 12 [label="crd_in-D" style=dashed type="crd" comment="in-D"] + 15 -> 12 [label="ref_in-D" style=bold type="ref" comment="in-D"] +} diff --git a/compiler/sam-outputs/dot/mat_elemmul.gv b/compiler/sam-outputs/dot/mat_elemmul.gv new file mode 100644 index 00000000..fa8e23d5 --- /dev/null +++ b/compiler/sam-outputs/dot/mat_elemmul.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=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 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/compiler/sam-outputs/dot/mat_identity.gv b/compiler/sam-outputs/dot/mat_identity.gv new file mode 100644 index 00000000..1b152c36 --- /dev/null +++ b/compiler/sam-outputs/dot/mat_identity.gv @@ -0,0 +1,14 @@ +digraph SAM { + comment="X=ss01,B=ss01" + 5 [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"] + 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"] + 4 [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"] + 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"] + 3 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 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 -> 2 [label="crd" style=dashed type="crd" comment=""] + 5 -> 4 [label="ref" style=bold type="ref" comment=""] + 4 -> 1 [label="crd" style=dashed type="crd" comment=""] + 4 -> 3 [label="ref" style=bold type="ref" comment=""] + 3 -> 0 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/mat_identity_dense.gv b/compiler/sam-outputs/dot/mat_identity_dense.gv new file mode 100644 index 00000000..0f5eb309 --- /dev/null +++ b/compiler/sam-outputs/dot/mat_identity_dense.gv @@ -0,0 +1,14 @@ +digraph SAM { + comment="X=dd01,B=dd01" + 5 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=dense,src=true,root=true" label="FiberLookup i: B0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="dense" src="true" root="true"] + 2 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=dense,sink=true" label="FiberWrite i: X0\ndense" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="X" mode="0" format="dense" sink="true"] + 4 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=dense,src=true,root=false" label="FiberLookup j: B1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="dense" src="true" root="false"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=dense,sink=true" label="FiberWrite j: X1\ndense" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="1" format="dense" sink="true"] + 3 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 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 -> 2 [label="crd" style=dashed type="crd" comment=""] + 5 -> 4 [label="ref" style=bold type="ref" comment=""] + 4 -> 1 [label="crd" style=dashed type="crd" comment=""] + 4 -> 3 [label="ref" style=bold type="ref" comment=""] + 3 -> 0 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/mat_sddmm.gv b/compiler/sam-outputs/dot/mat_sddmm.gv new file mode 100644 index 00000000..685371a9 --- /dev/null +++ b/compiler/sam-outputs/dot/mat_sddmm.gv @@ -0,0 +1,69 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=dd01,D=dd10" + 25 [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"] + 24 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] + 23 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 9 [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"] + 22 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 21 [comment="type=repeat,index=i,tensor=D,root=true" label="Repeat i: D" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="D" root="true"] + 20 [comment="type=fiberlookup,index=j,tensor=D,mode=1,format=dense,src=true,root=false" label="FiberLookup j: D1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="D" mode="1" format="dense" src="true" root="false"] + 18 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] + 17 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 16 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 15 [comment="type=repeat,index=j,tensor=C,root=false" label="Repeat j: C" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="C" root="false"] + 13 [comment="type=fiberlookup,index=k,tensor=C,mode=1,format=dense,src=true,root=false" label="FiberLookup k: C1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="1" format="dense" src="true" root="false"] + 12 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 11 [comment="type=repsiggen,index=k" label="RepeatSignalGenerator k" color=cyan3 shape=box style=filled type="repsiggen" index="k"] + 10 [comment="type=repeat,index=k,tensor=B,root=false" label="Repeat k: B" color=cyan2 shape=box style=filled type="repeat" index="k" tensor="B" root="false"] + 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 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"] + 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 8 [comment="type=arrayvals,tensor=D" label="Array Vals: D" color=green2 shape=box style=filled type="arrayvals" tensor="D"] + 14 [comment="type=fiberlookup,index=k,tensor=D,mode=0,format=dense,src=true,root=false" label="FiberLookup k: D0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="D" mode="0" format="dense" src="true" root="false"] + 19 [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"] + 26 [comment="type=fiberlookup,index=i,tensor=C,mode=0,format=dense,src=true,root=true" label="FiberLookup i: C0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="C" mode="0" format="dense" src="true" root="true"] + 25 -> 24 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 24 -> 23 [label="crd_i" style=dashed type="crd" comment="i"] + 23 -> 9 [label="crd_i" style=dashed type="crd" comment="i"] + 9 -> 2 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] + 9 -> 1 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] + 23 -> 22 [label="crd" style=dashed type="crd" comment=""] + 22 -> 21 [label="repsig" style=dotted type="repsig"] + 21 -> 20 [label="ref" style=bold type="ref"] + 20 -> 18 [label="crd_in-D" style=dashed type="crd" comment="in-D"] + 18 -> 17 [label="crd_j" style=dashed type="crd" comment="j"] + 17 -> 9 [label="crd_j" style=dashed type="crd" comment="j"] + 17 -> 16 [label="crd" style=dashed type="crd" comment=""] + 16 -> 15 [label="repsig" style=dotted type="repsig"] + 15 -> 13 [label="ref" style=bold type="ref"] + 13 -> 12 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 12 -> 11 [label="crd" style=dashed type="crd"] + 11 -> 10 [label="repsig" style=dotted type="repsig"] + 10 -> 6 [label="ref" style=bold type="ref"] + 6 -> 5 [label="val" type="val"] + 5 -> 4 [label="val" type="val"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 12 -> 7 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 7 -> 5 [label="val" type="val"] + 12 -> 8 [label="ref_out-D" style=bold type="ref" comment="out-D"] + 8 -> 4 [label="val" type="val"] + 13 -> 12 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 18 -> 10 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 18 -> 14 [label="ref_out-D" style=bold type="ref" comment="out-D"] + 14 -> 12 [label="crd_in-D" style=dashed type="crd" comment="in-D"] + 14 -> 12 [label="ref_in-D" style=bold type="ref" comment="in-D"] + 20 -> 18 [label="ref_in-D" style=bold type="ref" comment="in-D"] + 24 -> 19 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 19 -> 18 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 19 -> 18 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 24 -> 15 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 25 -> 24 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 26 -> 24 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 26 -> 24 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/mat_spacc_simple.gv b/compiler/sam-outputs/dot/mat_spacc_simple.gv new file mode 100644 index 00000000..acc21feb --- /dev/null +++ b/compiler/sam-outputs/dot/mat_spacc_simple.gv @@ -0,0 +1,26 @@ +digraph SAM { + comment="X=ss01,B=sss012" + 8 [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"] + 3 [comment="type=spaccumulator,order=2,in0=k,in1=j" label="SparseAccumulator 2 +0=k 1=j " color=brown shape=box style=filled type="spaccumulator" order="2" in0="k" in1="j"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B1_dim*B2_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B1_dim*B2_dim" sink="true"] + 1 [comment="type=fiberwrite,index=k,tensor=X,mode=1,format=compressed,segsize=B1_dim+1,crdsize=B1_dim*B2_dim,sink=true" label="FiberWrite k: X1\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="1" format="compressed" segsize="B1_dim+1" crdsize="B1_dim*B2_dim" sink="true"] + 2 [comment="type=fiberwrite,index=j,tensor=X,mode=0,format=compressed,segsize=2,crdsize=B1_dim,sink=true" label="FiberWrite j: X0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="0" format="compressed" segsize="2" crdsize="B1_dim" sink="true"] + 7 [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"] + 4 [comment="type=crdhold,outer=j,inner=k" label="CrdHold j,k +outer=j,inner=k" color=orange shape=box style=filled type="crdhold" outer="j" inner="k"] + 6 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 8 -> 3 [label="crd_i" style=dashed type="crd" comment="i"] + 3 -> 0 [label="val" type="val"] + 3 -> 1 [label="crd_out-k" style=dashed type="crd" comment="out-k"] + 3 -> 2 [label="crd_out-j" style=dashed type="crd" comment="out-j"] + 8 -> 7 [label="ref" style=bold type="ref" comment=""] + 7 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] + 4 -> 3 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] + 4 -> 3 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] + 7 -> 6 [label="ref" style=bold type="ref" comment=""] + 6 -> 4 [label="crd_k" style=dashed type="crd" comment="k"] + 6 -> 5 [label="ref" style=bold type="ref" comment=""] + 5 -> 3 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/mat_vecmul_ij.gv b/compiler/sam-outputs/dot/mat_vecmul_ij.gv new file mode 100644 index 00000000..7ff0e0f7 --- /dev/null +++ b/compiler/sam-outputs/dot/mat_vecmul_ij.gv @@ -0,0 +1,32 @@ +digraph SAM { + comment="x=s0,B=ss01,c=s0" + 12 [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"] + 11 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 1 [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"] + 10 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 9 [comment="type=repeat,index=i,tensor=c,root=true" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="true"] + 8 [comment="type=fiberlookup,index=j,tensor=c,mode=0,format=compressed,src=true,root=false" label="FiberLookup j: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="c" mode="0" format="compressed" src="true" root="false"] + 6 [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=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 2 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B0_dim" sink="true"] + 5 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] + 7 [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"] + 12 -> 11 [label="crd" style=dashed type="crd" comment=""] + 11 -> 1 [label="crd" style=dashed type="crd"] + 11 -> 10 [label="crd" style=dashed type="crd"] + 10 -> 9 [label="repsig" style=dotted type="repsig"] + 9 -> 8 [label="ref" style=bold type="ref"] + 8 -> 6 [label="crd_in-c" style=dashed type="crd" comment="in-c"] + 6 -> 4 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 4 -> 3 [label="val" type="val"] + 3 -> 2 [label="val" type="val"] + 2 -> 0 [label="val" type="val"] + 6 -> 5 [label="ref_out-c" style=bold type="ref" comment="out-c"] + 5 -> 3 [label="val" type="val"] + 8 -> 6 [label="ref_in-c" style=bold type="ref" comment="in-c"] + 12 -> 7 [label="ref" style=bold type="ref" comment=""] + 7 -> 6 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 7 -> 6 [label="ref_in-B" style=bold type="ref" comment="in-B"] +} diff --git a/compiler/sam-outputs/dot/mat_vecmul_ji.gv b/compiler/sam-outputs/dot/mat_vecmul_ji.gv new file mode 100644 index 00000000..545dc82d --- /dev/null +++ b/compiler/sam-outputs/dot/mat_vecmul_ji.gv @@ -0,0 +1,35 @@ +digraph SAM { + comment="x=s0,B=ss10,c=s0" + 11 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=compressed,src=true,root=true" label="FiberLookup j: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="compressed" src="true" root="true"] + 10 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] + 2 [comment="type=spaccumulator,order=1,in0=i" label="SparseAccumulator 1 +0=i " color=brown shape=box style=filled type="spaccumulator" order="1" in0="i"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B0_dim" sink="true"] + 1 [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"] + 9 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] + 8 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 7 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 6 [comment="type=repeat,index=i,tensor=c,root=false" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="false"] + 5 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] + 3 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 12 [comment="type=fiberlookup,index=j,tensor=c,mode=0,format=compressed,src=true,root=true" label="FiberLookup j: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="c" mode="0" format="compressed" src="true" root="true"] + 11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 10 -> 2 [label="crd_j" style=dashed type="crd" comment="j"] + 2 -> 0 [label="val" type="val"] + 2 -> 1 [label="crd_out-i" style=dashed type="crd" comment="out-i"] + 10 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 9 -> 8 [label="crd" style=dashed type="crd" comment=""] + 8 -> 2 [label="crd_i" style=dashed type="crd" comment="i"] + 8 -> 7 [label="crd" style=dashed type="crd" comment=""] + 7 -> 6 [label="repsig" style=dotted type="repsig"] + 6 -> 5 [label="ref" style=bold type="ref"] + 5 -> 3 [label="val" type="val"] + 3 -> 2 [label="val" type="val"] + 9 -> 4 [label="ref" style=bold type="ref" comment=""] + 4 -> 3 [label="val" type="val"] + 10 -> 6 [label="ref_out-c" style=bold type="ref" comment="out-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/compiler/sam-outputs/dot/matmul_ijk.gv b/compiler/sam-outputs/dot/matmul_ijk.gv new file mode 100644 index 00000000..d491fe04 --- /dev/null +++ b/compiler/sam-outputs/dot/matmul_ijk.gv @@ -0,0 +1,43 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss10" + 17 [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"] + 16 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 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"] + 15 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 14 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] + 13 [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=broadcast" shape=point style=invis type="broadcast"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] + 11 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 10 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 8 [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"] + 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] + 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 9 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 17 -> 16 [label="crd" style=dashed type="crd" comment=""] + 16 -> 2 [label="crd" style=dashed type="crd"] + 16 -> 15 [label="crd" style=dashed type="crd"] + 15 -> 14 [label="repsig" style=dotted type="repsig"] + 14 -> 13 [label="ref" style=bold type="ref"] + 13 -> 12 [label="crd" style=dashed type="crd" comment=""] + 12 -> 1 [label="crd" style=dashed type="crd"] + 12 -> 11 [label="crd" style=dashed type="crd"] + 11 -> 10 [label="repsig" style=dotted type="repsig"] + 10 -> 8 [label="ref" style=bold type="ref"] + 8 -> 7 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 5 -> 4 [label="val" type="val"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 6 -> 4 [label="val" type="val"] + 8 -> 7 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 13 -> 9 [label="ref" style=bold type="ref" comment=""] + 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"] + 17 -> 10 [label="ref" style=bold type="ref" comment=""] +} diff --git a/compiler/sam-outputs/dot/matmul_ikj.gv b/compiler/sam-outputs/dot/matmul_ikj.gv new file mode 100644 index 00000000..6b3f557a --- /dev/null +++ b/compiler/sam-outputs/dot/matmul_ikj.gv @@ -0,0 +1,55 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss01" + 19 [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"] + 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 5 [comment="type=crdhold,outer=i,inner=k" label="CrdHold i,k +outer=i,inner=k" color=orange shape=box style=filled type="crdhold" outer="i" inner="k"] + 4 [comment="type=crdhold,outer=i,inner=j" label="CrdHold i,j +outer=i,inner=j" color=orange shape=box style=filled type="crdhold" outer="i" inner="j"] + 3 [comment="type=spaccumulator,order=1,in0=j,in1=i" label="SparseAccumulator 1 +0=j 1=i " color=brown shape=box style=filled type="spaccumulator" order="1" in0="j" in1="i"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] + 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"] + 17 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 16 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] + 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 9 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 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"] + 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"] + 19 -> 18 [label="crd" style=dashed type="crd" comment=""] + 18 -> 5 [label="crd_i" style=dashed type="crd" comment="i"] + 5 -> 4 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] + 4 -> 3 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] + 3 -> 0 [label="val" type="val"] + 3 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] + 3 -> 2 [label="crd_out-i" style=dashed type="crd" comment="out-i"] + 4 -> 3 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] + 5 -> 3 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] + 18 -> 17 [label="crd" style=dashed type="crd" comment=""] + 17 -> 16 [label="repsig" style=dotted type="repsig"] + 16 -> 15 [label="ref" style=bold type="ref"] + 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 13 -> 5 [label="crd_k" style=dashed type="crd" comment="k"] + 13 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 9 -> 7 [label="ref" style=bold type="ref"] + 7 -> 6 [label="val" type="val"] + 6 -> 3 [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 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] + 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=""] + 8 -> 6 [label="val" type="val"] + 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 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"] +} diff --git a/compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv b/compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv new file mode 100644 index 00000000..637156d1 --- /dev/null +++ b/compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv @@ -0,0 +1,47 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss01" + 20 [comment="type=vectorreducer,index=j" label="VectorReducer j" color=brown shape=box style=filled type="vectorreducer" accum_index="j"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] + 19 [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"] + 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 4 [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"] + 17 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 16 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] + 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 9 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 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"] + 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"] + 19 -> 18 [label="crd" style=dashed type="crd" comment=""] + 4 -> 2 [label="crd_out-i" style=dashed type="crd" comment="out-i"] + 18 -> 17 [label="crd" style=dashed type="crd" comment=""] + 17 -> 16 [label="repsig" style=dotted type="repsig"] + 16 -> 15 [label="ref" style=bold type="ref"] + 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 13 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 9 -> 7 [label="ref" style=bold type="ref"] + 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=""] + 19 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] + 11 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] + 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=""] + 8 -> 6 [label="val" type="val"] + 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 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"] + 4 -> 20 [label="crddrp-crd-j-out" style=dashed type="crd" comment="crddrp-crd-j-out"] + 6 -> 20 [label="mul_val_out" type="val"] + 20 -> 0 [label="final_vals" type="val"] + 20 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] +} diff --git a/compiler/sam-outputs/dot/matmul_jik.gv b/compiler/sam-outputs/dot/matmul_jik.gv new file mode 100644 index 00000000..1878bca2 --- /dev/null +++ b/compiler/sam-outputs/dot/matmul_jik.gv @@ -0,0 +1,43 @@ +digraph SAM { + comment="X=ss10,B=ss01,C=ss10" + 17 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=compressed,src=true,root=true" label="FiberLookup j: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="compressed" src="true" root="true"] + 16 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=2,crdsize=C1_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="2" crdsize="C1_dim" sink="true"] + 15 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 14 [comment="type=repeat,index=j,tensor=B,root=true" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="true"] + 13 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] + 12 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 1 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=C1_dim+1,crdsize=C1_dim*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="C1_dim+1" crdsize="C1_dim*B0_dim" sink="true"] + 11 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 10 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] + 9 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*C1_dim*B0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*C1_dim*B0_dim" sink="true"] + 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 8 [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"] + 17 -> 16 [label="crd" style=dashed type="crd" comment=""] + 16 -> 2 [label="crd" style=dashed type="crd"] + 16 -> 15 [label="crd" style=dashed type="crd"] + 15 -> 14 [label="repsig" style=dotted type="repsig"] + 14 -> 13 [label="ref" style=bold type="ref"] + 13 -> 12 [label="crd" style=dashed type="crd" comment=""] + 12 -> 1 [label="crd" style=dashed type="crd"] + 12 -> 11 [label="crd" style=dashed type="crd"] + 11 -> 10 [label="repsig" style=dotted type="repsig"] + 10 -> 9 [label="ref" style=bold type="ref"] + 9 -> 7 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 5 -> 4 [label="val" type="val"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 6 -> 4 [label="val" type="val"] + 9 -> 7 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 13 -> 8 [label="ref" style=bold type="ref" comment=""] + 8 -> 7 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 8 -> 7 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 17 -> 10 [label="ref" style=bold type="ref" comment=""] +} diff --git a/compiler/sam-outputs/dot/matmul_jki.gv b/compiler/sam-outputs/dot/matmul_jki.gv new file mode 100644 index 00000000..fb3fe514 --- /dev/null +++ b/compiler/sam-outputs/dot/matmul_jki.gv @@ -0,0 +1,55 @@ +digraph SAM { + comment="X=ss10,B=ss10,C=ss10" + 19 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=compressed,src=true,root=true" label="FiberLookup j: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="compressed" src="true" root="true"] + 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 5 [comment="type=crdhold,outer=j,inner=k" label="CrdHold j,k +outer=j,inner=k" color=orange shape=box style=filled type="crdhold" outer="j" inner="k"] + 4 [comment="type=crdhold,outer=j,inner=i" label="CrdHold j,i +outer=j,inner=i" color=orange shape=box style=filled type="crdhold" outer="j" inner="i"] + 3 [comment="type=spaccumulator,order=1,in0=i,in1=j" label="SparseAccumulator 1 +0=i 1=j " color=brown shape=box style=filled type="spaccumulator" order="1" in0="i" in1="j"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*C1_dim*B0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*C1_dim*B0_dim" sink="true"] + 1 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=C1_dim+1,crdsize=C1_dim*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="C1_dim+1" crdsize="C1_dim*B0_dim" sink="true"] + 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=2,crdsize=C1_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="2" crdsize="C1_dim" sink="true"] + 17 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 16 [comment="type=repeat,index=j,tensor=B,root=true" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="true"] + 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"] + 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 12 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] + 11 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 10 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 9 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] + 8 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 6 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 19 -> 18 [label="crd" style=dashed type="crd" comment=""] + 18 -> 5 [label="crd_j" style=dashed type="crd" comment="j"] + 5 -> 4 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] + 4 -> 3 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] + 3 -> 0 [label="val" type="val"] + 3 -> 1 [label="crd_out-i" style=dashed type="crd" comment="out-i"] + 3 -> 2 [label="crd_out-j" style=dashed type="crd" comment="out-j"] + 4 -> 3 [label="crd_inner-i" style=dashed type="crd" comment="inner-i"] + 5 -> 3 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] + 18 -> 17 [label="crd" style=dashed type="crd" comment=""] + 17 -> 16 [label="repsig" style=dotted type="repsig"] + 16 -> 14 [label="ref" style=bold type="ref"] + 14 -> 13 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 13 -> 5 [label="crd_k" style=dashed type="crd" comment="k"] + 13 -> 12 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 12 -> 11 [label="crd" style=dashed type="crd" comment=""] + 11 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] + 11 -> 10 [label="crd" style=dashed type="crd" comment=""] + 10 -> 9 [label="repsig" style=dotted type="repsig"] + 9 -> 8 [label="ref" style=bold type="ref"] + 8 -> 6 [label="val" type="val"] + 6 -> 3 [label="val" type="val"] + 12 -> 7 [label="ref" style=bold type="ref" comment=""] + 7 -> 6 [label="val" type="val"] + 13 -> 9 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 14 -> 13 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 19 -> 15 [label="ref" style=bold type="ref" comment=""] + 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/matmul_kij.gv b/compiler/sam-outputs/dot/matmul_kij.gv new file mode 100644 index 00000000..4271bd23 --- /dev/null +++ b/compiler/sam-outputs/dot/matmul_kij.gv @@ -0,0 +1,51 @@ +digraph SAM { + comment="X=ss01,B=ss10,C=ss01" + 17 [comment="type=fiberlookup,index=k,tensor=B,mode=1,format=compressed,src=true,root=true" label="FiberLookup k: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="1" format="compressed" src="true" root="true"] + 16 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 3 [comment="type=spaccumulator,order=2,in0=j,in1=i" label="SparseAccumulator 2 +0=j 1=i " color=brown shape=box style=filled type="spaccumulator" order="2" in0="j" in1="i"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] + 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"] + 15 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] + 14 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 4 [comment="type=crdhold,outer=i,inner=j" label="CrdHold i,j +outer=i,inner=j" color=orange shape=box style=filled type="crdhold" outer="i" inner="j"] + 13 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 12 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] + 11 [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"] + 10 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 9 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 8 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 18 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=true" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="true"] + 17 -> 16 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 16 -> 3 [label="crd_k" style=dashed type="crd" comment="k"] + 3 -> 0 [label="val" type="val"] + 3 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] + 3 -> 2 [label="crd_out-i" style=dashed type="crd" comment="out-i"] + 16 -> 15 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 15 -> 14 [label="crd" style=dashed type="crd" comment=""] + 14 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] + 4 -> 3 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] + 4 -> 3 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] + 14 -> 13 [label="crd" style=dashed type="crd" comment=""] + 13 -> 12 [label="repsig" style=dotted type="repsig"] + 12 -> 11 [label="ref" style=bold type="ref"] + 11 -> 10 [label="crd" style=dashed type="crd" comment=""] + 10 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] + 10 -> 9 [label="crd" style=dashed type="crd" comment=""] + 9 -> 8 [label="repsig" style=dotted type="repsig"] + 8 -> 6 [label="ref" style=bold type="ref"] + 6 -> 5 [label="val" type="val"] + 5 -> 3 [label="val" type="val"] + 11 -> 7 [label="ref" style=bold type="ref" comment=""] + 7 -> 5 [label="val" type="val"] + 15 -> 8 [label="ref" style=bold type="ref" comment=""] + 16 -> 12 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 17 -> 16 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 18 -> 16 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 18 -> 16 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/matmul_kji.gv b/compiler/sam-outputs/dot/matmul_kji.gv new file mode 100644 index 00000000..9951a3c1 --- /dev/null +++ b/compiler/sam-outputs/dot/matmul_kji.gv @@ -0,0 +1,51 @@ +digraph SAM { + comment="X=ss10,B=ss10,C=ss01" + 17 [comment="type=fiberlookup,index=k,tensor=B,mode=1,format=compressed,src=true,root=true" label="FiberLookup k: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="1" format="compressed" src="true" root="true"] + 16 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 3 [comment="type=spaccumulator,order=2,in0=i,in1=j" label="SparseAccumulator 2 +0=i 1=j " color=brown shape=box style=filled type="spaccumulator" order="2" in0="i" in1="j"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*C1_dim*B0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*C1_dim*B0_dim" sink="true"] + 1 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=C1_dim+1,crdsize=C1_dim*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="C1_dim+1" crdsize="C1_dim*B0_dim" sink="true"] + 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=2,crdsize=C1_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="2" crdsize="C1_dim" sink="true"] + 12 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 11 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] + 10 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 4 [comment="type=crdhold,outer=j,inner=i" label="CrdHold j,i +outer=j,inner=i" color=orange shape=box style=filled type="crdhold" outer="j" inner="i"] + 9 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 8 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] + 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 15 [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"] + 14 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 13 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 18 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=true" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="true"] + 17 -> 16 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 16 -> 3 [label="crd_k" style=dashed type="crd" comment="k"] + 3 -> 0 [label="val" type="val"] + 3 -> 1 [label="crd_out-i" style=dashed type="crd" comment="out-i"] + 3 -> 2 [label="crd_out-j" style=dashed type="crd" comment="out-j"] + 16 -> 12 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 12 -> 11 [label="ref" style=bold type="ref"] + 11 -> 10 [label="crd" style=dashed type="crd" comment=""] + 10 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] + 4 -> 3 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] + 4 -> 3 [label="crd_inner-i" style=dashed type="crd" comment="inner-i"] + 10 -> 9 [label="crd" style=dashed type="crd" comment=""] + 9 -> 8 [label="repsig" style=dotted type="repsig"] + 8 -> 7 [label="ref" style=bold type="ref"] + 7 -> 5 [label="val" type="val"] + 5 -> 3 [label="val" type="val"] + 11 -> 6 [label="ref" style=bold type="ref" comment=""] + 6 -> 5 [label="val" type="val"] + 16 -> 15 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 15 -> 14 [label="crd" style=dashed type="crd" comment=""] + 14 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] + 14 -> 13 [label="crd" style=dashed type="crd" comment=""] + 13 -> 12 [label="repsig" style=dotted type="repsig"] + 15 -> 8 [label="ref" style=bold type="ref" comment=""] + 17 -> 16 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 18 -> 16 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 18 -> 16 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/tensor3_elemadd.gv b/compiler/sam-outputs/dot/tensor3_elemadd.gv new file mode 100644 index 00000000..e00deffd --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_elemadd.gv @@ -0,0 +1,43 @@ +digraph SAM { + comment="X=sss012,B=sss012,C=sss012" + 14 [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"] + 13 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] + 3 [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"] + 11 [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"] + 10 [comment="type=union,index=j" label="union j" color=purple shape=box style=filled type="union" index="j"] + 2 [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=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] + 7 [comment="type=union,index=k" label="union k" color=purple shape=box style=filled type="union" index="k"] + 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*B2_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*B2_dim" sink="true"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 4 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] + 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 9 [comment="type=fiberlookup,index=k,tensor=C,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: C2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="2" format="compressed" src="true" root="false"] + 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"] + 15 [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"] + 14 -> 13 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 13 -> 3 [label="crd" style=dashed type="crd"] + 13 -> 11 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 10 -> 2 [label="crd" style=dashed type="crd"] + 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 -> 1 [label="crd" style=dashed type="crd"] + 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 5 -> 4 [label="val" type="val"] + 4 -> 0 [label="val" type="val"] + 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 6 -> 4 [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"] + 13 -> 12 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 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"] + 14 -> 13 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/tensor3_elemmul.gv b/compiler/sam-outputs/dot/tensor3_elemmul.gv new file mode 100644 index 00000000..17d59669 --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_elemmul.gv @@ -0,0 +1,49 @@ +digraph SAM { + comment="X=sss012,B=sss012,C=sss012" + 16 [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"] + 15 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] + 7 [comment="type=crddrop,outer=i,inner=j" label="CrdDrop i,j" color=orange shape=box style=filled type="crddrop" outer="i" inner="j"] + 3 [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"] + 2 [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"] + 13 [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"] + 12 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] + 8 [comment="type=crddrop,outer=j,inner=k" label="CrdDrop j,k" color=orange shape=box style=filled type="crddrop" outer="j" inner="k"] + 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*B2_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*B2_dim" sink="true"] + 10 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] + 9 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] + 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 11 [comment="type=fiberlookup,index=k,tensor=C,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: C2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="2" format="compressed" src="true" root="false"] + 14 [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"] + 17 [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"] + 16 -> 15 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 15 -> 7 [label="crd_in-i" style=dashed type="crd" comment="in-i"] + 7 -> 3 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] + 7 -> 2 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] + 15 -> 13 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 13 -> 12 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 12 -> 8 [label="crd_in-j" style=dashed type="crd" comment="in-j"] + 8 -> 7 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] + 8 -> 1 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] + 12 -> 10 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 10 -> 9 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 9 -> 8 [label="crd_in-k" style=dashed type="crd" comment="in-k"] + 9 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 5 -> 4 [label="val" type="val"] + 4 -> 0 [label="val" type="val"] + 9 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 6 -> 4 [label="val" type="val"] + 10 -> 9 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 12 -> 11 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 11 -> 9 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 11 -> 9 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 13 -> 12 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 15 -> 14 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 14 -> 12 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 14 -> 12 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 16 -> 15 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 17 -> 15 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 17 -> 15 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/tensor3_identity.gv b/compiler/sam-outputs/dot/tensor3_identity.gv new file mode 100644 index 00000000..038c0739 --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_identity.gv @@ -0,0 +1,18 @@ +digraph SAM { + comment="X=sss012,B=sss012" + 7 [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"] + 3 [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"] + 6 [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"] + 2 [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"] + 5 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] + 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*B2_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*B2_dim" sink="true"] + 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] + 7 -> 3 [label="crd" style=dashed type="crd" comment=""] + 7 -> 6 [label="ref" style=bold type="ref" comment=""] + 6 -> 2 [label="crd" style=dashed type="crd" comment=""] + 6 -> 5 [label="ref" style=bold type="ref" comment=""] + 5 -> 1 [label="crd" style=dashed type="crd" comment=""] + 5 -> 4 [label="ref" style=bold type="ref" comment=""] + 4 -> 0 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/tensor3_identity_dense.gv b/compiler/sam-outputs/dot/tensor3_identity_dense.gv new file mode 100644 index 00000000..02224b56 --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_identity_dense.gv @@ -0,0 +1,18 @@ +digraph SAM { + comment="X=ddd012,B=ddd012" + 7 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=dense,src=true,root=true" label="FiberLookup i: B0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="dense" src="true" root="true"] + 3 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=dense,sink=true" label="FiberWrite i: X0\ndense" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="X" mode="0" format="dense" sink="true"] + 6 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=dense,src=true,root=false" label="FiberLookup j: B1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="dense" src="true" root="false"] + 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=dense,sink=true" label="FiberWrite j: X1\ndense" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="1" format="dense" sink="true"] + 5 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=dense,src=true,root=false" label="FiberLookup k: B2\ndense" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="dense" src="true" root="false"] + 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=dense,sink=true" label="FiberWrite k: X2\ndense" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="dense" sink="true"] + 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] + 7 -> 3 [label="crd" style=dashed type="crd" comment=""] + 7 -> 6 [label="ref" style=bold type="ref" comment=""] + 6 -> 2 [label="crd" style=dashed type="crd" comment=""] + 6 -> 5 [label="ref" style=bold type="ref" comment=""] + 5 -> 1 [label="crd" style=dashed type="crd" comment=""] + 5 -> 4 [label="ref" style=bold type="ref" comment=""] + 4 -> 0 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/tensor3_innerprod.gv b/compiler/sam-outputs/dot/tensor3_innerprod.gv new file mode 100644 index 00000000..0016bc45 --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_innerprod.gv @@ -0,0 +1,43 @@ +digraph SAM { + comment="x=none,B=sss012,C=sss012" + 14 [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"] + 13 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] + 11 [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"] + 10 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] + 8 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] + 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 2 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 1 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1" sink="true"] + 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 9 [comment="type=fiberlookup,index=k,tensor=C,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: C2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="2" format="compressed" src="true" root="false"] + 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"] + 15 [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"] + 14 -> 13 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 13 -> 11 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 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 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 5 -> 4 [label="val" type="val"] + 4 -> 3 [label="val" type="val"] + 3 -> 2 [label="val" type="val"] + 2 -> 1 [label="val" type="val"] + 1 -> 0 [label="val" type="val"] + 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 6 -> 4 [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"] + 13 -> 12 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 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"] + 14 -> 13 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] +} diff --git a/compiler/sam-outputs/dot/tensor3_mttkrp.gv b/compiler/sam-outputs/dot/tensor3_mttkrp.gv new file mode 100644 index 00000000..fb9387b2 --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_mttkrp.gv @@ -0,0 +1,80 @@ +digraph SAM { + comment="X=ss01,B=sss012,C=ss01,D=ss01" + 31 [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"] + 30 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 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"] + 29 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 28 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 26 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] + 24 [comment="type=fiberlookup,index=j,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup j: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="0" format="compressed" src="true" root="false"] + 23 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] + 22 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C0_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*C0_dim" sink="true"] + 21 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 20 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 18 [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"] + 17 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 16 [comment="type=repsiggen,index=k" label="RepeatSignalGenerator k" color=cyan3 shape=box style=filled type="repsiggen" index="k"] + 15 [comment="type=repeat,index=k,tensor=D,root=false" label="Repeat k: D" color=cyan2 shape=box style=filled type="repeat" index="k" tensor="D" root="false"] + 14 [comment="type=fiberlookup,index=l,tensor=D,mode=1,format=compressed,src=true,root=false" label="FiberLookup l: D1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="D" mode="1" format="compressed" src="true" root="false"] + 12 [comment="type=intersect,index=l" label="intersect l" color=purple shape=box style=filled type="intersect" index="l"] + 11 [comment="type=repsiggen,index=l" label="RepeatSignalGenerator l" color=cyan3 shape=box style=filled type="repsiggen" index="l"] + 10 [comment="type=repeat,index=l,tensor=C,root=false" label="Repeat l: C" color=cyan2 shape=box style=filled type="repeat" index="l" tensor="C" root="false"] + 8 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 6 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 4 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C0_dim" sink="true"] + 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 9 [comment="type=arrayvals,tensor=D" label="Array Vals: D" color=green2 shape=box style=filled type="arrayvals" tensor="D"] + 13 [comment="type=fiberlookup,index=l,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup l: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="B" mode="2" format="compressed" src="true" root="false"] + 19 [comment="type=fiberlookup,index=k,tensor=C,mode=1,format=compressed,src=true,root=false" label="FiberLookup k: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="1" format="compressed" src="true" root="false"] + 27 [comment="type=repeat,index=i,tensor=D,root=true" label="Repeat i: D" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="D" root="true"] + 25 [comment="type=fiberlookup,index=j,tensor=D,mode=0,format=compressed,src=true,root=false" label="FiberLookup j: D0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="D" mode="0" format="compressed" src="true" root="false"] + 31 -> 30 [label="crd" style=dashed type="crd" comment=""] + 30 -> 2 [label="crd" style=dashed type="crd"] + 30 -> 29 [label="crd" style=dashed type="crd"] + 29 -> 28 [label="repsig" style=dotted type="repsig"] + 28 -> 26 [label="repsig" style=dotted type="repsig"] + 26 -> 24 [label="ref" style=bold type="ref"] + 24 -> 23 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 23 -> 22 [label="crd" style=dashed type="crd"] + 22 -> 1 [label="crd" style=dashed type="crd"] + 22 -> 21 [label="crd" style=dashed type="crd"] + 21 -> 20 [label="repsig" style=dotted type="repsig"] + 20 -> 18 [label="ref" style=bold type="ref"] + 18 -> 17 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 17 -> 16 [label="crd" style=dashed type="crd"] + 16 -> 15 [label="repsig" style=dotted type="repsig"] + 15 -> 14 [label="ref" style=bold type="ref"] + 14 -> 12 [label="crd_in-D" style=dashed type="crd" comment="in-D"] + 12 -> 11 [label="crd" style=dashed type="crd"] + 11 -> 10 [label="repsig" style=dotted type="repsig"] + 10 -> 8 [label="ref" style=bold type="ref"] + 8 -> 6 [label="val" type="val"] + 6 -> 5 [label="val" type="val"] + 5 -> 4 [label="val" type="val"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 12 -> 7 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 7 -> 6 [label="val" type="val"] + 12 -> 9 [label="ref_out-D" style=bold type="ref" comment="out-D"] + 9 -> 5 [label="val" type="val"] + 14 -> 12 [label="ref_in-D" style=bold type="ref" comment="in-D"] + 17 -> 13 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 13 -> 12 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 13 -> 12 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 17 -> 10 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 18 -> 17 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 23 -> 19 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 19 -> 17 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 19 -> 17 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 23 -> 15 [label="ref_out-D" style=bold type="ref" comment="out-D"] + 24 -> 23 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 28 -> 27 [label="repsig" style=dotted type="repsig"] + 27 -> 25 [label="ref" style=bold type="ref"] + 25 -> 23 [label="crd_in-D" style=dashed type="crd" comment="in-D"] + 25 -> 23 [label="ref_in-D" style=bold type="ref" comment="in-D"] + 31 -> 20 [label="ref" style=bold type="ref" comment=""] +} diff --git a/compiler/sam-outputs/dot/tensor3_ttm.gv b/compiler/sam-outputs/dot/tensor3_ttm.gv new file mode 100644 index 00000000..acf4d70b --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_ttm.gv @@ -0,0 +1,54 @@ +digraph SAM { + comment="X=sss012,B=sss012,C=ss01" + 22 [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"] + 21 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 3 [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"] + 20 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 19 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] + 15 [comment="type=repeat,index=j,tensor=C,root=false" label="Repeat j: C" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="C" root="false"] + 14 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 13 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*C0_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*C0_dim" sink="true"] + 12 [comment="type=repsiggen,index=k" label="RepeatSignalGenerator k" color=cyan3 shape=box style=filled type="repsiggen" index="k"] + 11 [comment="type=repeat,index=k,tensor=B,root=false" label="Repeat k: B" color=cyan2 shape=box style=filled type="repeat" index="k" tensor="B" root="false"] + 9 [comment="type=fiberlookup,index=l,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup l: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="B" mode="2" format="compressed" src="true" root="false"] + 8 [comment="type=intersect,index=l" label="intersect l" color=purple shape=box style=filled type="intersect" index="l"] + 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 4 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*C0_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*C0_dim" sink="true"] + 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] + 10 [comment="type=fiberlookup,index=l,tensor=C,mode=1,format=compressed,src=true,root=false" label="FiberLookup l: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="C" mode="1" format="compressed" src="true" root="false"] + 18 [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"] + 17 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 2 [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"] + 16 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 22 -> 21 [label="crd" style=dashed type="crd" comment=""] + 21 -> 3 [label="crd" style=dashed type="crd"] + 21 -> 20 [label="crd" style=dashed type="crd"] + 20 -> 19 [label="repsig" style=dotted type="repsig"] + 19 -> 15 [label="ref" style=bold type="ref"] + 15 -> 14 [label="ref" style=bold type="ref"] + 14 -> 13 [label="crd" style=dashed type="crd" comment=""] + 13 -> 1 [label="crd" style=dashed type="crd"] + 13 -> 12 [label="crd" style=dashed type="crd"] + 12 -> 11 [label="repsig" style=dotted type="repsig"] + 11 -> 9 [label="ref" style=bold type="ref"] + 9 -> 8 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 8 -> 6 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 6 -> 5 [label="val" type="val"] + 5 -> 4 [label="val" type="val"] + 4 -> 0 [label="val" type="val"] + 8 -> 7 [label="ref_out-C" style=bold type="ref" comment="out-C"] + 7 -> 5 [label="val" type="val"] + 9 -> 8 [label="ref_in-B" style=bold type="ref" comment="in-B"] + 14 -> 10 [label="ref" style=bold type="ref" comment=""] + 10 -> 8 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 10 -> 8 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 22 -> 18 [label="ref" style=bold type="ref" comment=""] + 18 -> 17 [label="crd" style=dashed type="crd" comment=""] + 17 -> 2 [label="crd" style=dashed type="crd"] + 17 -> 16 [label="crd" style=dashed type="crd"] + 16 -> 15 [label="repsig" style=dotted type="repsig"] + 18 -> 11 [label="ref" style=bold type="ref" comment=""] +} diff --git a/compiler/sam-outputs/dot/tensor3_ttv.gv b/compiler/sam-outputs/dot/tensor3_ttv.gv new file mode 100644 index 00000000..959f9fe7 --- /dev/null +++ b/compiler/sam-outputs/dot/tensor3_ttv.gv @@ -0,0 +1,43 @@ +digraph SAM { + comment="X=ss01,B=sss012,c=s0" + 17 [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"] + 16 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 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"] + 15 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 14 [comment="type=repeat,index=i,tensor=c,root=true" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="true"] + 10 [comment="type=repeat,index=j,tensor=c,root=false" label="Repeat j: c" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="c" root="false"] + 9 [comment="type=fiberlookup,index=k,tensor=c,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="c" mode="0" format="compressed" src="true" root="false"] + 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] + 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"] + 6 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] + 13 [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"] + 12 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 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"] + 11 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] + 8 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] + 17 -> 16 [label="crd" style=dashed type="crd" comment=""] + 16 -> 2 [label="crd" style=dashed type="crd"] + 16 -> 15 [label="crd" style=dashed type="crd"] + 15 -> 14 [label="repsig" style=dotted type="repsig"] + 14 -> 10 [label="ref" style=bold type="ref"] + 10 -> 9 [label="ref" style=bold type="ref"] + 9 -> 7 [label="crd_in-c" style=dashed type="crd" comment="in-c"] + 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 5 -> 4 [label="val" type="val"] + 4 -> 3 [label="val" type="val"] + 3 -> 0 [label="val" type="val"] + 7 -> 6 [label="ref_out-c" style=bold type="ref" comment="out-c"] + 6 -> 4 [label="val" type="val"] + 9 -> 7 [label="ref_in-c" style=bold type="ref" comment="in-c"] + 17 -> 13 [label="ref" style=bold type="ref" comment=""] + 13 -> 12 [label="crd" style=dashed type="crd" comment=""] + 12 -> 1 [label="crd" style=dashed type="crd"] + 12 -> 11 [label="crd" style=dashed type="crd"] + 11 -> 10 [label="repsig" style=dotted type="repsig"] + 13 -> 8 [label="ref" style=bold type="ref" comment=""] + 8 -> 7 [label="crd_in-B" style=dashed type="crd" comment="in-B"] + 8 -> 7 [label="ref_in-B" style=bold type="ref" comment="in-B"] +} diff --git a/compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv b/compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv new file mode 100644 index 00000000..f29b24e5 --- /dev/null +++ b/compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv @@ -0,0 +1,10 @@ +digraph SAM { + comment="x=s0,b=d0" + 3 [comment="type=fiberlookup,index=i,tensor=b,mode=0,format=dense,src=true,root=true" label="FiberLookup i: b0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="b" mode="0" format="dense" src="true" root="true"] + 1 [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"] + 2 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] + 3 -> 1 [label="crd" style=dashed type="crd" comment=""] + 3 -> 2 [label="ref" style=bold type="ref" comment=""] + 2 -> 0 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/vec_elemadd.gv b/compiler/sam-outputs/dot/vec_elemadd.gv new file mode 100644 index 00000000..142dfa8d --- /dev/null +++ b/compiler/sam-outputs/dot/vec_elemadd.gv @@ -0,0 +1,21 @@ +digraph SAM { + comment="x=s0,b=s0,c=s0" + 6 [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"] + 5 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] + 1 [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"] + 3 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] + 2 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] + 4 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] + 7 [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"] + 6 -> 5 [label="crd_in-b" style=dashed type="crd" comment="in-b"] + 5 -> 1 [label="crd" style=dashed type="crd"] + 5 -> 3 [label="ref_out-b" style=bold type="ref" comment="out-b"] + 3 -> 2 [label="val" type="val"] + 2 -> 0 [label="val" type="val"] + 5 -> 4 [label="ref_out-c" style=bold type="ref" comment="out-c"] + 4 -> 2 [label="val" type="val"] + 6 -> 5 [label="ref_in-b" style=bold type="ref" comment="in-b"] + 7 -> 5 [label="crd_in-c" style=dashed type="crd" comment="in-c"] + 7 -> 5 [label="ref_in-c" style=bold type="ref" comment="in-c"] +} diff --git a/compiler/sam-outputs/dot/vec_elemmul.gv b/compiler/sam-outputs/dot/vec_elemmul.gv new file mode 100644 index 00000000..1411804f --- /dev/null +++ b/compiler/sam-outputs/dot/vec_elemmul.gv @@ -0,0 +1,21 @@ +digraph SAM { + comment="x=s0,b=s0,c=s0" + 6 [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"] + 5 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] + 1 [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"] + 3 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] + 2 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] + 4 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] + 7 [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"] + 6 -> 5 [label="crd_in-b" style=dashed type="crd" comment="in-b"] + 5 -> 1 [label="crd" style=dashed type="crd"] + 5 -> 3 [label="ref_out-b" style=bold type="ref" comment="out-b"] + 3 -> 2 [label="val" type="val"] + 2 -> 0 [label="val" type="val"] + 5 -> 4 [label="ref_out-c" style=bold type="ref" comment="out-c"] + 4 -> 2 [label="val" type="val"] + 6 -> 5 [label="ref_in-b" style=bold type="ref" comment="in-b"] + 7 -> 5 [label="crd_in-c" style=dashed type="crd" comment="in-c"] + 7 -> 5 [label="ref_in-c" style=bold type="ref" comment="in-c"] +} diff --git a/compiler/sam-outputs/dot/vec_identity.gv b/compiler/sam-outputs/dot/vec_identity.gv new file mode 100644 index 00000000..b1937f3f --- /dev/null +++ b/compiler/sam-outputs/dot/vec_identity.gv @@ -0,0 +1,10 @@ +digraph SAM { + comment="x=s0,b=s0" + 3 [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"] + 1 [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"] + 2 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] + 3 -> 1 [label="crd" style=dashed type="crd" comment=""] + 3 -> 2 [label="ref" style=bold type="ref" comment=""] + 2 -> 0 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/vec_scalar_mul.gv b/compiler/sam-outputs/dot/vec_scalar_mul.gv new file mode 100644 index 00000000..e0056a50 --- /dev/null +++ b/compiler/sam-outputs/dot/vec_scalar_mul.gv @@ -0,0 +1,21 @@ +digraph SAM { + comment="x=s0,b=none,c=s0" + 8 [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"] + 7 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 1 [comment="type=fiberwrite,index=i,tensor=x,mode=0,format=compressed,segsize=2,crdsize=c0_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="c0_dim" sink="true"] + 6 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 5 [comment="type=repeat,index=i,tensor=b,root=true" label="Repeat i: b" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="b" root="true"] + 3 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] + 2 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*c0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*c0_dim" sink="true"] + 4 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] + 8 -> 7 [label="crd" style=dashed type="crd" comment=""] + 7 -> 1 [label="crd" style=dashed type="crd"] + 7 -> 6 [label="crd" style=dashed type="crd"] + 6 -> 5 [label="repsig" style=dotted type="repsig"] + 5 -> 3 [label="ref" style=bold type="ref"] + 3 -> 2 [label="val" type="val"] + 2 -> 0 [label="val" type="val"] + 8 -> 4 [label="ref" style=bold type="ref" comment=""] + 4 -> 2 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv b/compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv new file mode 100644 index 00000000..9a2974ff --- /dev/null +++ b/compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv @@ -0,0 +1,10 @@ +digraph SAM { + comment="x=d0,b=s0" + 3 [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"] + 1 [comment="type=fiberwrite,index=i,tensor=x,mode=0,format=dense,sink=true" label="FiberWrite i: x0\ndense" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="x" mode="0" format="dense" sink="true"] + 2 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] + 3 -> 1 [label="crd" style=dashed type="crd" comment=""] + 3 -> 2 [label="ref" style=bold type="ref" comment=""] + 2 -> 0 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/dot/vec_spacc_simple.gv b/compiler/sam-outputs/dot/vec_spacc_simple.gv new file mode 100644 index 00000000..24e89e96 --- /dev/null +++ b/compiler/sam-outputs/dot/vec_spacc_simple.gv @@ -0,0 +1,17 @@ +digraph SAM { + comment="x=s0,B=ss01" + 5 [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"] + 2 [comment="type=spaccumulator,order=1,in0=j" label="SparseAccumulator 1 +0=j " color=brown shape=box style=filled type="spaccumulator" order="1" in0="j"] + 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B1_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B1_dim" sink="true"] + 1 [comment="type=fiberwrite,index=j,tensor=x,mode=0,format=compressed,segsize=2,crdsize=B1_dim,sink=true" label="FiberWrite j: x0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="x" mode="0" format="compressed" segsize="2" crdsize="B1_dim" sink="true"] + 4 [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"] + 3 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 5 -> 2 [label="crd_i" style=dashed type="crd" comment="i"] + 2 -> 0 [label="val" type="val"] + 2 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] + 5 -> 4 [label="ref" style=bold type="ref" comment=""] + 4 -> 2 [label="crd_j" style=dashed type="crd" comment="j"] + 4 -> 3 [label="ref" style=bold type="ref" comment=""] + 3 -> 2 [label="val" type="val"] +} diff --git a/compiler/sam-outputs/onyx-dot/matmul_ikj.gv b/compiler/sam-outputs/onyx-dot/matmul_ikj.gv new file mode 100644 index 00000000..6fbfbc85 --- /dev/null +++ b/compiler/sam-outputs/onyx-dot/matmul_ikj.gv @@ -0,0 +1,44 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss01" + 20 [comment="type=vectorreducer,index=j" label="VectorReducer j" color=brown shape=box style=filled type="vectorreducer" accum_index="j"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] + 19 [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"] + 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 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"] + 17 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 16 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] + 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 9 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 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"] + 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"] + 19 -> 18 [label="crd" style=dashed type="crd" comment=""] + 18 -> 17 [label="crd" style=dashed type="crd" comment=""] + 17 -> 16 [label="repsig" style=dotted type="repsig"] + 16 -> 15 [label="ref" style=bold type="ref"] + 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 13 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 9 -> 7 [label="ref" style=bold type="ref"] + 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=""] + 19 -> 2 [label="crd_i" style=dashed type="crd" comment="i"] + 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=""] + 8 -> 6 [label="val" type="val"] + 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 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"] + 20 -> 0 [label="final_vals" type="val"] + 20 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] +} From a724a56ec0328eed4c2fe366dbf36b952fd1cb1b Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Nov 2023 20:17:10 -0800 Subject: [PATCH 5/9] Revert "Update spacc tests" This reverts commit f28f02a7a86049e5b71d20d498f87f5e35b63445. --- sam/sim/test/primitives/test_spacc.py | 421 +++----------------------- 1 file changed, 37 insertions(+), 384 deletions(-) diff --git a/sam/sim/test/primitives/test_spacc.py b/sam/sim/test/primitives/test_spacc.py index 57a71814..39b08960 100644 --- a/sam/sim/test/primitives/test_spacc.py +++ b/sam/sim/test/primitives/test_spacc.py @@ -1,50 +1,47 @@ import copy import pytest -import random -import numpy as np from sam.sim.src.accumulator import SparseAccumulator1, SparseAccumulator2 -from sam.sim.src.rd_scanner import CompressedCrdRdScan -from sam.sim.src.array import Array -from sam.sim.src.wr_scanner import ValsWrScan, CompressWrScan from sam.sim.src.base import remove_emptystr -from sam.sim.test.test import TIMEOUT, gen_n_comp_arrs, gen_val_arr, get_point_list, \ - convert_point_tuple, convert_ndarr_point_tuple, convert_point_tuple_ndarr, check_point_tuple, remove_zeros +from sam.sim.test.test import TIMEOUT -arrs_dict1 = {'ocrd_in': [0, 2, 'S0', 2, 'S1', 'D'], - 'icrd_in': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 0, 2, 3, 'S2', 'D'], - 'val_in': [50, 5, 10, 'S0', 40, 4, 8, 'S1', -40, 33, 36, 'S2', 'D'], +arrs_dict1 = {'ocrd_in': [0, 0, 0, 2, 2, 2, 2, 2, 2, 'D'], + 'icrd_in': [0, 2, 3, 0, 2, 3, 0, 2, 3, 'D'], + 'val_in': [50, 5, 10, 40, 4, 8, -40, 33, 36, 'D'], + 'ocrd_gold': [0, 2, 'S0', 'D'], 'icrd_gold': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 'D'], - 'val_gold': [90, 9, 18, 'S0', -40, 33, 36, 'S1', 'D']} + 'val_gold': [50, 5, 10, 'S0', 0, 37, 44, 'S1', 'D']} -# New sparse accumulator @pytest.mark.parametrize("arrs", [arrs_dict1]) -def test_SparseAccumulator1new_direct(arrs, debug_sim): +def test_spacc1_direct(arrs, debug_sim): icrd = copy.deepcopy(arrs['icrd_in']) ocrd = copy.deepcopy(arrs['ocrd_in']) val = copy.deepcopy(arrs['val_in']) + gold_ocrd = copy.deepcopy(arrs['ocrd_gold']) gold_icrd = copy.deepcopy(arrs['icrd_gold']) gold_val = copy.deepcopy(arrs['val_gold']) - sa = SparseAccumulator1(valtype=int, val_stkn=True, debug=debug_sim) + sa = SparseAccumulator1(val_stkn=True, debug=debug_sim) done = False time = 0 + out_ocrd = [] out_icrd = [] out_val = [] while not done and time < TIMEOUT: if len(icrd) > 0: - sa.set_in_crd0(icrd.pop(0)) + sa.set_inner_crdpt(icrd.pop(0)) if len(ocrd) > 0: - sa.set_in_crd1(ocrd.pop(0)) + sa.set_outer_crdpt(ocrd.pop(0)) if len(val) > 0: sa.set_val(val.pop(0)) sa.update() - out_icrd.append(sa.out_crd0()) + out_ocrd.append(sa.out_outer_crd()) + out_icrd.append(sa.out_inner_crd()) out_val.append(sa.out_val()) print("Timestep", time, "\t Done:", sa.out_done()) @@ -52,139 +49,37 @@ def test_SparseAccumulator1new_direct(arrs, debug_sim): done = sa.out_done() time += 1 + out_ocrd = remove_emptystr(out_ocrd) out_icrd = remove_emptystr(out_icrd) out_val = remove_emptystr(out_val) if debug_sim: + print("Outer Crd: ", out_ocrd) print("Inner Crd: ", out_icrd) print("Vals: ", out_val) + assert (out_ocrd == gold_ocrd) assert (out_icrd == gold_icrd) assert (out_val == gold_val) -@pytest.mark.parametrize("dim", [2 ** x for x in range(2, 11, 2)]) -def test_SparseAccumulator1new_rand(dim, debug_sim, max_val=1000, fill=0): - in_mat_crds1, in_mat_segs1 = gen_n_comp_arrs(2, dim) - in_mat_vals1 = gen_val_arr(len(in_mat_crds1[-1]), max_val, -max_val) - - in1_tup = convert_point_tuple(get_point_list(in_mat_crds1, in_mat_segs1, in_mat_vals1)) - - nd1 = convert_point_tuple_ndarr(in1_tup, dim) - gold_nd = np.sum(nd1, 0) - gold_tup = convert_ndarr_point_tuple(gold_nd) - - rdscan_B1 = CompressedCrdRdScan(crd_arr=in_mat_crds1[0], seg_arr=in_mat_segs1[0], debug=debug_sim) - rdscan_B2 = CompressedCrdRdScan(crd_arr=in_mat_crds1[1], seg_arr=in_mat_segs1[1], debug=debug_sim) - - val_B = Array(init_arr=in_mat_vals1, debug=debug_sim) - sa = SparseAccumulator1(valtype=int, val_stkn=True, debug=debug_sim) - - vals_X = ValsWrScan(size=dim * dim, fill=fill, debug=debug_sim) - wrscan_X1 = CompressWrScan(seg_size=2, size=dim, fill=fill, debug=debug_sim) - - done = False - time = 0 - in_ref_B = [0, 'D'] - out_rdscan_B1 = [] - out_rdscan_B2 = [] - out_val_B = [] - while not done and time < TIMEOUT: - if len(in_ref_B) > 0: - rdscan_B1.set_in_ref(in_ref_B.pop(0)) - - rdscan_B2.set_in_ref(rdscan_B1.out_ref()) - val_B.set_load(rdscan_B2.out_ref()) +arrs_dict1 = {'crd1_in': [0, 2, 3, 0, 0, 2, 2, 2, 3, 3, 3, 3, 3, 0, 'D'], + 'crd0_in': [0, 2, 3, 0, 2, 0, 0, 3, 0, 2, 3, 0, 2, 0, 'D'], + 'val_in': [50, 5, 10, 40, 4, 8, -40, 33, 36, 1, 2, 3, 4, 5, 'D'], + 'crd1_gold': [0, 2, 3, 'S0', 'D'], + 'crd0_gold': [0, 2, 'S0', 0, 2, 3, 'S0', 0, 2, 3, 'S1', 'D'], + 'val_gold': [95.0, 4.0, 'S0', -32.0, 5.0, 33.0, 'S0', 39.0, 5.0, 12.0, 'S1', 'D']} - # Inject random empty strings - out_rdscan_B1.append(rdscan_B1.out_crd()) - out_rdscan_B2.append(rdscan_B2.out_crd()) - out_val_B.append(val_B.out_load()) - if random.random() < 0.2: - out_rdscan_B1.append("") - if random.random() < 0.2: - out_rdscan_B2.append("") - if random.random() < 0.2: - out_val_B.append("") - - sa.set_in_crd1(out_rdscan_B1.pop(0)) - sa.set_in_crd0(out_rdscan_B2.pop(0)) - sa.set_val(out_val_B.pop(0)) - vals_X.set_input(sa.out_val()) - wrscan_X1.set_input(sa.out_crd0()) - - rdscan_B1.update() - rdscan_B2.update() - val_B.update() - sa.update() - vals_X.update() - wrscan_X1.update() - - print("Timestep", time, "\t Done --", - "\tRdScan B1:", rdscan_B1.out_done(), - "\tSparseAccumulator1New:", sa.out_done(), - "\tArr:", val_B.out_done(), - "\tWrScan:", vals_X.out_done(), - "\tWrScan X1:", wrscan_X1.out_done(), - ) - - done = wrscan_X1.out_done() - time += 1 - - wrscan_X1.autosize() - vals_X.autosize() - - out_crds = [wrscan_X1.get_arr()] - out_segs = [wrscan_X1.get_seg_arr()] - out_val = vals_X.get_arr() - - if debug_sim: - print("Input", in_mat_segs1, in_mat_crds1, in_mat_vals1) - print("X seg", out_segs) - print("X crd", out_crds) - print("X val", out_val) - print("Gold np", gold_nd) - print("Gold Tuple", gold_tup) +arrs_dict2 = {'crd1_in': [0, 0, 0, 1, 1, 1, 1, 0, 0, 'D'], + 'crd0_in': [0, 2, 3, 0, 2, 3, 4, 2, 3, 'D'], + 'val_in': [50, 5, 10, 40, 4, 8, -40, 33, 36, 'D'], + 'crd1_gold': [0, 1, 'S0', 'D'], + 'crd0_gold': [0, 2, 3, 'S0', 0, 2, 3, 4, 'S1', 'D'], + 'val_gold': [50, 38, 46, 'S0', 40, 4, 8, -40, 'S1', 'D']} - if not out_val: - assert out_val == gold_tup - else: - out_tup = convert_point_tuple(get_point_list(out_crds, out_segs, out_val)) - out_tup = remove_zeros(out_tup) - assert (check_point_tuple(out_tup, gold_tup)) - -arrs_dict1 = {'crd2_in': [0, 1, 'S0', 'D'], - 'crd1_in': [0, 2, 'S0', 2, 'S1', 'D'], - 'crd0_in': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 0, 2, 3, 'S2', 'D'], - 'val_in': [50, 5, 10, 'S0', 40, 4, 8, 'S1', -40, 33, 36, 'S2', 'D'], - 'crd1_gold': [0, 2, 'S0', 'D'], - 'crd0_gold': [0, 2, 3, 'S0', 0, 2, 3, 'S1', 'D'], - 'val_gold': [50, 5, 10, 'S0', 0, 37, 44, 'S1', 'D']} - -# [[0, 1], [0, 4], [0, 2, 3, 4, 5]] [[0], [0, 1, 2, 3], [0, 2, 3, 1, 3]] [-60, 85, 314, 241, -887] -arrs_dict2 = {'crd2_in': [0, 'S0', 'D'], - 'crd1_in': [0, 1, 2, 3, 'S1', 'D'], - 'crd0_in': [0, 2, 'S0', 3, 'S0', 1, 'S0', 3, 'S2', 'D'], - 'val_in': [-60, 85, 'S0', 314, 'S0', 241, 'S0', -887, 'S2', 'D'], - 'crd1_gold': [0, 1, 2, 3, 'S0', 'D'], - 'crd0_gold': [0, 2, 'S0', 3, 'S0', 1, 'S0', 3, 'S1', 'D'], - 'val_gold': [-60, 85, 'S0', 314, 'S0', 241, 'S0', -887, 'S1', 'D']} - -# [[0, 1], [0, 3], [0, 4, 6, 8]] [[1], [0, 1, 2], [0, 1, 2, 3, 1, 3, 0, 2]] [637, 210, -847, 358, 162, 687, 95, -91] -arrs_dict3 = {'crd2_in': [1, 'S0', 'D'], - 'crd1_in': [0, 1, 2, 'S1', 'D'], - 'crd0_in': [0, 1, 2, 3, 'S0', 1, 3, 'S0', 0, 2, 'S2', 'D'], - 'val_in': [637, 210, -847, 358, 'S0', 162, 687, 'S0', 95, -91, 'S2', 'D'], - 'crd1_gold': [0, 1, 2, 'S0', 'D'], - 'crd0_gold': [0, 1, 2, 3, 'S0', 1, 3, 'S0', 0, 2, 'S1', 'D'], - 'val_gold': [637, 210, -847, 358, 'S0', 162, 687, 'S0', 95, -91, 'S1', 'D']} - - -# New sparse accumulator -@pytest.mark.parametrize("arrs", [arrs_dict1, arrs_dict2, arrs_dict3]) -def test_SparseAccumulator2new_stream_direct(arrs, debug_sim): - crd2 = copy.deepcopy(arrs['crd2_in']) +@pytest.mark.parametrize("arrs", [arrs_dict1, arrs_dict2]) +def test_spacc2_direct(arrs, debug_sim): crd1 = copy.deepcopy(arrs['crd1_in']) crd0 = copy.deepcopy(arrs['crd0_in']) val = copy.deepcopy(arrs['val_in']) @@ -193,7 +88,7 @@ def test_SparseAccumulator2new_stream_direct(arrs, debug_sim): gold_crd0 = copy.deepcopy(arrs['crd0_gold']) gold_val = copy.deepcopy(arrs['val_gold']) - sa = SparseAccumulator2(valtype=int, val_stkn=True, debug=debug_sim) + sa = SparseAccumulator2(val_stkn=True, debug=debug_sim) done = False time = 0 @@ -201,19 +96,17 @@ def test_SparseAccumulator2new_stream_direct(arrs, debug_sim): out_crd0 = [] out_val = [] while not done and time < TIMEOUT: - if len(crd2) > 0: - sa.set_in_crd2(crd2.pop(0)) - if len(crd1) > 0: - sa.set_in_crd1(crd1.pop(0)) if len(crd0) > 0: - sa.set_in_crd0(crd0.pop(0)) + sa.set_crd_inner(crd0.pop(0)) + if len(crd1) > 0: + sa.set_crd_outer(crd1.pop(0)) if len(val) > 0: sa.set_val(val.pop(0)) sa.update() - out_crd1.append(sa.out_crd1()) - out_crd0.append(sa.out_crd0()) + out_crd1.append(sa.out_crd_outer()) + out_crd0.append(sa.out_crd_inner()) out_val.append(sa.out_val()) print("Timestep", time, "\t Done:", sa.out_done()) @@ -233,243 +126,3 @@ def test_SparseAccumulator2new_stream_direct(arrs, debug_sim): assert (out_crd1 == gold_crd1) assert (out_crd0 == gold_crd0) assert (out_val == gold_val) - - -# Segs: [[0, 11], [0, 8, 18, 25, 31, 36, 44, 50, 61, 68, 78, 86], [0, 10, 18, 26, 35, 45, 53, 61, 69, 76, 84, 93, 99, 107, 114, 124, 134, 145, 154, 160, 168, 176, 188, 198, 208, 214, 223, 232, 242, 251, 261, 271, 280, 288, 294, 301, 308, 315, 323, 328, 339, 348, 357, 367, 378, 385, 391, 399, 408, 417, 425, 435, 440, 446, 453, 463, 467, 477, 489, 494, 502, 508, 516, 523, 531, 537, 541, 550, 557, 569, 576, 586, 593, 600, 608, 614, 623, 631, 640, 647, 656, 665, 675, 681, 689, 699, 703]] -# Crds: [[0, 2, 3, 4, 5, 8, 9, 10, 11, 14, 15], [0, 1, 2, 5, 6, 7, 9, 14, 3, 4, 5, 6, 7, 8, 10, 11, 13, 15, 4, 7, 8, 11, 12, 13, 14, 1, 5, 8, 10, 13, 14, 0, 3, 4, 7, 15, 1, 7, 9, 10, 12, 13, 14, 15, 1, 4, 8, 10, 11, 12, 1, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 0, 2, 4, 5, 8, 14, 15, 0, 1, 3, 4, 6, 8, 9, 10, 11, 13, 1, 2, 3, 6, 7, 8, 10, 12], [1, 2, 3, 8, 9, 10, 11, 13, 14, 15, 2, 3, 5, 8, 9, 10, 11, 14, 1, 4, 6, 7, 9, 10, 11, 12, 0, 1, 4, 9, 10, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 9, 13, 0, 1, 2, 6, 7, 9, 10, 15, 0, 1, 2, 8, 9, 12, 13, 15, 0, 1, 4, 6, 8, 9, 13, 15, 2, 4, 5, 7, 10, 13, 15, 2, 5, 7, 10, 11, 13, 14, 15, 0, 1, 2, 3, 9, 10, 12, 13, 15, 0, 5, 6, 11, 13, 15, 0, 5, 6, 9, 11, 12, 13, 14, 2, 3, 5, 6, 8, 10, 15, 0, 1, 2, 3, 5, 9, 11, 12, 13, 15, 1, 2, 4, 6, 8, 9, 10, 11, 14, 15, 0, 2, 3, 4, 7, 8, 9, 10, 11, 13, 15, 0, 3, 4, 5, 9, 10, 12, 14, 15, 1, 5, 6, 9, 12, 14, 0, 1, 4, 7, 10, 11, 12, 14, 1, 2, 6, 8, 10, 12, 13, 15, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 14, 15, 0, 2, 3, 4, 6, 9, 10, 11, 13, 15, 1, 3, 4, 5, 6, 7, 8, 11, 13, 14, 0, 3, 6, 8, 11, 12, 0, 2, 5, 6, 7, 8, 9, 14, 15, 1, 3, 6, 9, 11, 12, 13, 14, 15, 0, 3, 4, 5, 6, 9, 10, 12, 13, 14, 2, 4, 5, 6, 7, 9, 10, 13, 15, 0, 4, 6, 7, 8, 9, 12, 13, 14, 15, 0, 1, 2, 3, 5, 7, 8, 10, 13, 15, 2, 3, 4, 5, 6, 10, 12, 13, 15, 2, 3, 6, 7, 8, 12, 14, 15, 0, 4, 5, 10, 12, 15, 4, 5, 6, 7, 9, 10, 15, 0, 1, 5, 8, 10, 12, 14, 1, 5, 8, 9, 11, 12, 15, 0, 1, 4, 5, 6, 7, 8, 12, 0, 2, 5, 9, 11, 0, 2, 3, 4, 5, 6, 9, 10, 12, 13, 14, 1, 2, 4, 7, 10, 12, 13, 14, 15, 0, 3, 4, 5, 7, 11, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 15, 0, 1, 3, 4, 7, 8, 15, 1, 4, 6, 9, 10, 11, 0, 2, 3, 4, 7, 9, 12, 14, 0, 2, 4, 5, 8, 10, 12, 14, 15, 0, 3, 4, 6, 9, 10, 11, 12, 13, 1, 2, 6, 8, 9, 10, 12, 13, 4, 5, 6, 8, 9, 10, 11, 12, 14, 15, 1, 2, 3, 10, 15, 2, 5, 7, 9, 13, 15, 0, 2, 5, 6, 10, 11, 13, 0, 3, 4, 5, 6, 7, 10, 13, 14, 15, 2, 8, 10, 15, 0, 1, 2, 4, 6, 9, 10, 11, 12, 15, 0, 1, 2, 3, 5, 6, 7, 9, 10, 13, 14, 15, 0, 1, 7, 11, 12, 1, 2, 3, 4, 9, 11, 12, 14, 0, 2, 5, 6, 8, 10, 1, 3, 5, 7, 9, 12, 13, 14, 2, 4, 5, 7, 9, 11, 14, 0, 4, 5, 6, 7, 8, 11, 14, 0, 3, 4, 5, 7, 12, 5, 9, 12, 13, 0, 3, 4, 6, 7, 8, 9, 11, 13, 2, 3, 5, 6, 7, 9, 14, 0, 1, 2, 3, 5, 6, 7, 8, 9, 12, 13, 15, 2, 5, 6, 8, 12, 13, 15, 0, 2, 4, 5, 6, 7, 8, 12, 14, 15, 1, 2, 3, 5, 9, 12, 15, 0, 1, 5, 8, 12, 13, 14, 1, 3, 6, 8, 9, 11, 12, 13, 3, 4, 5, 9, 11, 13, 1, 2, 4, 6, 7, 8, 9, 12, 15, 1, 4, 5, 7, 12, 13, 14, 15, 0, 2, 3, 5, 7, 8, 9, 11, 12, 3, 6, 7, 9, 11, 13, 15, 1, 2, 3, 6, 8, 9, 11, 13, 14, 0, 2, 3, 4, 5, 7, 8, 11, 14, 0, 1, 2, 4, 5, 9, 12, 13, 14, 15, 5, 7, 11, 12, 13, 15, 0, 2, 3, 4, 7, 8, 10, 13, 1, 2, 3, 4, 5, 6, 7, 9, 12, 13, 4, 8, 11, 14]] -# Vals: [-275, 130, -863, 147, 180, 534, 563, 41, -124, -359, -481, -40, 158, 413, -110, 421, -441, 978, 443, 295, 743, 955, -57, 765, -901, -143, -471, -476, -820, -405, 7, -413, 566, 477, -92, -791, -672, -733, 958, -773, 265, -42, -895, 139, -262, 337, 602, -5, 424, 478, 489, 614, -744, 854, -604, 393, -693, 769, 605, -357, -970, -304, -87, 363, -919, 166, 179, -313, 151, -734, 992, -158, -603, -453, 260, -731, -135, -945, 885, -649, -917, -371, -483, -874, -761, 918, -704, 401, 985, 5, 902, -946, -218, -504, 857, 943, 273, 622, 692, 364, 61, -109, 540, -733, -826, 43, -303, 185, -938, -269, -951, -117, -279, -388, -57, 288, 562, -34, 562, -856, 481, 307, -584, 153, 600, -527, 50, 374, 887, 705, 742, -482, -52, -280, 14, -582, 387, -910, -11, -823, -974, 765, 569, -106, 754, 27, -678, 297, -248, 642, -383, -984, 119, 276, -635, -843, 558, -833, 831, 910, 148, -222, -878, -881, 576, -3, -772, 660, 718, -266, 24, -96, 125, -94, 144, -490, 14, 713, 765, -527, -925, 109, 542, -567, -368, 951, -610, -594, -482, -740, 995, 993, -487, -178, -51, 91, -517, 102, 68, -291, -558, 201, -465, -673, 112, 484, 327, 931, -988, -786, -942, 935, 961, -891, -143, 255, -823, 628, 775, -290, -163, -183, 354, -342, -465, 137, 902, 870, -466, -324, 207, 896, -308, 637, 717, -537, 395, -746, 351, 523, -960, -458, 505, 869, -580, -502, 664, 171, 320, 877, 497, 461, -226, 130, -743, 98, 826, 427, 92, -223, -822, 952, -565, 920, 569, 539, 372, -248, 592, 405, -832, -692, 673, 22, 978, -327, 935, -10, 191, -558, -430, -874, -147, -133, -850, 268, 380, 828, -519, 414, 289, -11, -407, -844, -54, 660, -9, 537, -25, -614, -985, 238, -52, -437, 763, 792, 212, -892, -527, 658, 944, 416, -910, -82, -262, 634, -380, 672, -667, 662, 331, 928, -893, 141, 715, -590, -762, 124, -116, -736, -652, 812, -919, 952, 5, -801, -189, 315, 778, 762, 269, -594, -215, 492, 650, 938, 203, 443, 546, -976, 404, 917, 377, 729, 194, -759, -12, -253, 395, -152, -142, 136, -768, 525, -20, -761, 171, -793, 174, 845, 377, 354, -424, 941, 213, -732, 836, 191, 314, -275, -390, 520, 595, -466, -639, -888, 775, 672, 299, 762, 735, -329, -566, 137, 423, -774, -548, 307, -297, -332, -497, -633, -242, -297, -648, 239, -828, -2, -577, -643, 236, 849, -792, -513, -521, -470, -212, 148, -897, 497, 627, 834, -720, -914, 245, 550, 99, -410, 550, 537, 784, -716, 646, 213, -387, 914, 976, 388, 534, -543, 588, -453, -54, -819, -792, 885, 89, -834, 832, -427, -906, -630, -79, -354, 605, 651, -96, 261, 96, -726, -832, 550, -327, 519, -561, -928, -47, -352, 186, -103, 3, -563, 247, -416, 289, -54, 815, -216, 859, 909, -540, 38, -759, 541, -132, -466, 685, -354, -746, -956, -826, 431, -343, 67, 823, -732, 946, -611, 592, 541, 198, -28, 518, 433, 348, 264, -620, 935, 700, 594, -144, -14, 15, -101, -730, 706, -200, 713, 951, 348, -62, -935, 419, 511, -358, -734, 561, -329, 685, 948, 554, 256, -615, -666, -473, 295, -688, 508, 917, -269, 363, 484, 775, 807, 408, -519, 388, -205, 443, -959, 344, 107, -600, -403, 254, 778, 518, 320, 415, -976, 339, -36, -723, -980, 846, 66, -405, 956, 932, 747, -111, -804, -495, -821, 538, 366, -866, 614, -349, -145, 426, 256, 662, 533, -549, -381, -668, 531, 954, -343, -645, 823, -611, -382, -846, 474, 503, -673, 841, -549, 263, 966, 632, 574, 719, -219, -396, -98, 374, 700, -567, 84, 951, 294, -260, 334, -532, -828, -867, -399, 575, -9, 342, 913, 736, -882, -993, 232, -627, -655, -451, 606, 571, 289, -690, -161, 864, 608, -695, 806, -620, -844, 719, 353, 834, -915, 371, -151, -239, 355, 379, 405, -48, -565, 592, -531, -850, -800, 424, -384, -663, -982, 225, 294, -557, -97, 883, -674, -42, -436, -100, 548, 466, -54, -337, -222, -11, 112, 893, 372, -950, 418, 80, -24, 391, 659, 741, 25, -321, 367, -488, 106, 361, 41, 301, 650, -672, 105, -715, 401, -989, 804, 858] -arrs_dict1 = { "segs": [[0, 11], [0, 8, 18, 25, 31, 36, 44, 50, 61, 68, 78, 86], [0, 10, 18, 26, 35, 45, 53, 61, 69, 76, - 84, 93, 99, 107, 114, 124, 134, 145, - 154, 160, 168, 176, 188, 198, 208, - 214, 223, 232, 242, 251, 261, 271, - 280, 288, 294, 301, 308, 315, 323, 328, 339, 348, 357, 367, 378, 385, 391, 399, 408, 417, 425, 435, 440, 446, 453, 463, 467, 477, 489, 494, 502, 508, 516, 523, 531, 537, 541, 550, 557, 569, 576, 586, 593, 600, 608, 614, 623, 631, 640, 647, 656, 665, 675, 681, 689, 699, 703]], - "crds": [[0, 2, 3, 4, 5, 8, 9, 10, 11, 14, 15], [0, 1, 2, 5, 6, 7, 9, 14, 3, 4, 5, 6, 7, 8, 10, 11, 13, - 15, 4, 7, 8, 11, 12, 13, 14, 1, 5, 8, 10, 13, 14, 0, 3, 4, 7, 15, 1, 7, 9, 10, 12, 13, 14, 15, 1, 4, 8, 10, 11, 12, 1, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 0, 2, 4, 5, 8, 14, 15, 0, 1, 3, 4, 6, 8, 9, 10, 11, 13, 1, 2, 3, 6, 7, 8, 10, 12], [1, 2, 3, 8, 9, 10, 11, 13, 14, 15, 2, 3, 5, 8, 9, 10, 11, 14, 1, 4, 6, 7, 9, 10, 11, 12, 0, 1, 4, 9, 10, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 9, 13, 0, 1, 2, 6, 7, 9, 10, 15, 0, 1, 2, 8, 9, 12, 13, 15, 0, 1, 4, 6, 8, 9, 13, 15, 2, 4, 5, 7, 10, 13, 15, 2, 5, 7, 10, 11, 13, 14, 15, 0, 1, 2, 3, 9, 10, 12, 13, 15, 0, 5, 6, 11, 13, 15, 0, 5, 6, 9, 11, 12, 13, 14, 2, 3, 5, 6, 8, 10, 15, 0, 1, 2, 3, 5, 9, 11, 12, 13, 15, 1, 2, 4, 6, 8, 9, 10, 11, 14, 15, 0, 2, 3, 4, 7, 8, 9, 10, 11, 13, 15, 0, 3, 4, 5, 9, 10, 12, 14, 15, 1, 5, 6, 9, 12, 14, 0, 1, 4, 7, 10, 11, 12, 14, 1, 2, 6, 8, 10, 12, 13, 15, 0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 14, 15, 0, 2, 3, 4, 6, 9, 10, 11, 13, 15, 1, 3, 4, 5, 6, 7, 8, 11, 13, 14, 0, 3, 6, 8, 11, 12, 0, 2, 5, 6, 7, 8, 9, 14, 15, 1, 3, 6, 9, 11, 12, 13, 14, 15, 0, 3, 4, 5, 6, 9, 10, 12, 13, 14, 2, 4, 5, 6, 7, 9, 10, 13, 15, 0, 4, 6, 7, 8, 9, 12, 13, 14, 15, 0, 1, 2, 3, 5, 7, 8, 10, 13, 15, 2, 3, 4, 5, 6, 10, 12, 13, 15, 2, 3, 6, 7, 8, 12, 14, 15, 0, 4, 5, 10, 12, 15, 4, 5, 6, 7, 9, 10, 15, 0, 1, 5, 8, 10, 12, 14, 1, 5, 8, 9, 11, 12, 15, 0, 1, 4, 5, 6, 7, 8, 12, 0, 2, 5, 9, 11, 0, 2, 3, 4, 5, 6, 9, 10, 12, 13, 14, 1, 2, 4, 7, 10, 12, 13, 14, 15, 0, 3, 4, 5, 7, 11, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 15, 0, 1, 3, 4, 7, 8, 15, 1, 4, 6, 9, 10, 11, 0, 2, 3, 4, 7, 9, 12, 14, 0, 2, 4, 5, 8, 10, 12, 14, 15, 0, 3, 4, 6, 9, 10, 11, 12, 13, 1, 2, 6, 8, 9, 10, 12, 13, 4, 5, 6, 8, 9, 10, 11, 12, 14, 15, 1, 2, 3, 10, 15, 2, 5, 7, 9, 13, 15, 0, 2, 5, 6, 10, 11, 13, 0, 3, 4, 5, 6, 7, 10, 13, 14, 15, 2, 8, 10, 15, 0, 1, 2, 4, 6, 9, 10, 11, 12, 15, 0, 1, 2, 3, 5, 6, 7, 9, 10, 13, 14, 15, 0, 1, 7, 11, 12, 1, 2, 3, 4, 9, 11, 12, 14, 0, 2, 5, 6, 8, 10, 1, 3, 5, 7, 9, 12, 13, 14, 2, 4, 5, 7, 9, 11, 14, 0, 4, 5, 6, 7, 8, 11, 14, 0, 3, 4, 5, 7, 12, 5, 9, 12, 13, 0, 3, 4, 6, 7, 8, 9, 11, 13, 2, 3, 5, 6, 7, 9, 14, 0, 1, 2, 3, 5, 6, 7, 8, 9, 12, 13, 15, 2, 5, 6, 8, 12, 13, 15, 0, 2, 4, 5, 6, 7, 8, 12, 14, 15, 1, 2, 3, 5, 9, 12, 15, 0, 1, 5, 8, 12, 13, 14, 1, 3, 6, 8, 9, 11, 12, 13, 3, 4, 5, 9, 11, 13, 1, 2, 4, 6, 7, 8, 9, 12, 15, 1, 4, 5, 7, 12, 13, 14, 15, 0, 2, 3, 5, 7, 8, 9, 11, 12, 3, 6, 7, 9, 11, 13, 15, 1, 2, 3, 6, 8, 9, 11, 13, 14, 0, 2, 3, 4, 5, 7, 8, 11, 14, 0, 1, 2, 4, 5, 9, 12, 13, 14, 15, 5, 7, 11, 12, 13, 15, 0, 2, 3, 4, 7, 8, 10, 13, 1, 2, 3, 4, 5, 6, 7, 9, 12, 13, 4, 8, 11, 14]], - "vals": [-275, 130, -863, 147, 180, 534, 563, 41, -124, -359, -481, -40, 158, 413, -110, 421, -441, 978, - 443, 295, 743, 955, -57, 765, -901, -143, -471, -476, -820, -405, 7, -413, 566, 477, -92, -791, -672, -733, 958, -773, 265, -42, -895, 139, -262, 337, 602, -5, 424, 478, 489, 614, -744, 854, -604, 393, -693, 769, 605, -357, -970, -304, -87, 363, -919, 166, 179, -313, 151, -734, 992, -158, -603, -453, 260, -731, -135, -945, 885, -649, -917, -371, -483, -874, -761, 918, -704, 401, 985, 5, 902, -946, -218, -504, 857, 943, 273, 622, 692, 364, 61, -109, 540, -733, -826, 43, -303, 185, -938, -269, -951, -117, -279, -388, -57, 288, 562, -34, 562, -856, 481, 307, -584, 153, 600, -527, 50, 374, 887, 705, 742, -482, -52, -280, 14, -582, 387, -910, -11, -823, -974, 765, 569, -106, 754, 27, -678, 297, -248, 642, -383, -984, 119, 276, -635, -843, 558, -833, 831, 910, 148, -222, -878, -881, 576, -3, -772, 660, 718, -266, 24, -96, 125, -94, 144, -490, 14, 713, 765, -527, -925, 109, 542, -567, -368, 951, -610, -594, -482, -740, 995, 993, -487, -178, -51, 91, -517, 102, 68, -291, -558, 201, -465, -673, 112, 484, 327, 931, -988, -786, -942, 935, 961, -891, -143, 255, -823, 628, 775, -290, -163, -183, 354, -342, -465, 137, 902, 870, -466, -324, 207, 896, -308, 637, 717, -537, 395, -746, 351, 523, -960, -458, 505, 869, -580, -502, 664, 171, 320, 877, 497, 461, -226, 130, -743, 98, 826, 427, 92, -223, -822, 952, -565, 920, 569, 539, 372, -248, 592, 405, -832, -692, 673, 22, 978, -327, 935, -10, 191, -558, -430, -874, -147, -133, -850, 268, 380, 828, -519, 414, 289, -11, -407, -844, -54, 660, -9, 537, -25, -614, -985, 238, -52, -437, 763, 792, 212, -892, -527, 658, 944, 416, -910, -82, -262, 634, -380, 672, -667, 662, 331, 928, -893, 141, 715, -590, -762, 124, -116, -736, -652, 812, -919, 952, 5, -801, -189, 315, 778, 762, 269, -594, -215, 492, 650, 938, 203, 443, 546, -976, 404, 917, 377, 729, 194, -759, -12, -253, 395, -152, -142, 136, -768, 525, -20, -761, 171, -793, 174, 845, 377, 354, -424, 941, 213, -732, 836, 191, 314, -275, -390, 520, 595, -466, -639, -888, 775, 672, 299, 762, 735, -329, -566, 137, 423, -774, -548, 307, -297, -332, -497, -633, -242, -297, -648, 239, -828, -2, -577, -643, 236, 849, -792, -513, -521, -470, -212, 148, -897, 497, 627, 834, -720, -914, 245, 550, 99, -410, 550, 537, 784, -716, 646, 213, -387, 914, 976, 388, 534, -543, 588, -453, -54, -819, -792, 885, 89, -834, 832, -427, -906, -630, -79, -354, 605, 651, -96, 261, 96, -726, -832, 550, -327, 519, -561, -928, -47, -352, 186, -103, 3, -563, 247, -416, 289, -54, 815, -216, 859, 909, -540, 38, -759, 541, -132, -466, 685, -354, -746, -956, -826, 431, -343, 67, 823, -732, 946, -611, 592, 541, 198, -28, 518, 433, 348, 264, -620, 935, 700, 594, -144, -14, 15, -101, -730, 706, -200, 713, 951, 348, -62, -935, 419, 511, -358, -734, 561, -329, 685, 948, 554, 256, -615, -666, -473, 295, -688, 508, 917, -269, 363, 484, 775, 807, 408, -519, 388, -205, 443, -959, 344, 107, -600, -403, 254, 778, 518, 320, 415, -976, 339, -36, -723, -980, 846, 66, -405, 956, 932, 747, -111, -804, -495, -821, 538, 366, -866, 614, -349, -145, 426, 256, 662, 533, -549, -381, -668, 531, 954, -343, -645, 823, -611, -382, -846, 474, 503, -673, 841, -549, 263, 966, 632, 574, 719, -219, -396, -98, 374, 700, -567, 84, 951, 294, -260, 334, -532, -828, -867, -399, 575, -9, 342, 913, 736, -882, -993, 232, -627, -655, -451, 606, 571, 289, -690, -161, 864, 608, -695, 806, -620, -844, 719, 353, 834, -915, 371, -151, -239, 355, 379, 405, -48, -565, 592, -531, -850, -800, 424, -384, -663, -982, 225, 294, -557, -97, 883, -674, -42, -436, -100, 548, 466, -54, -337, -222, -11, 112, 893, 372, -950, 418, 80, -24, 391, 659, 741, 25, -321, 367, -488, 106, 361, 41, 301, 650, -672, 105, -715, 401, -989, 804, 858], - "dim": 16 -} - -# Segs: [[0, 8], [0, 10, 21, 30, 40, 52, 61, 68, 76], [0, 8, 18, 28, 35, 48, 57, 62, 73, 83, 94, 99, 111, 121, 129, 137, 144, 152, 159, 166, 176, 184, 191, 197, 204, 214, 221, 233, 240, 246, 255, 264, 268, 275, 282, 291, 300, 308, 313, 320, 328, 338, 346, 356, 365, 376, 383, 391, 401, 407, 419, 426, 430, 439, 448, 457, 462, 468, 473, 480, 486, 494, 501, 508, 517, 526, 533, 543, 551, 559, 567, 577, 586, 592, 598, 608, 614]] -# Crds: [[0, 1, 2, 4, 7, 10, 12, 13], [0, 2, 5, 7, 8, 10, 11, 13, 14, 15, 0, 1, 2, 3, 4, 5, 7, 10, 12, 14, 15, 0, 1, 2, 3, 4, 5, 9, 14, 15, 0, 1, 2, 3, 6, 8, 9, 10, 11, 14, 0, 1, 2, 3, 4, 6, 7, 8, 11, 12, 14, 15, 0, 2, 3, 4, 7, 8, 11, 13, 14, 5, 6, 9, 10, 11, 14, 15, 2, 3, 5, 6, 10, 11, 12, 15], [0, 1, 3, 5, 7, 8, 11, 12, 0, 1, 2, 3, 6, 7, 9, 11, 14, 15, 0, 1, 2, 4, 6, 7, 11, 13, 14, 15, 2, 3, 4, 6, 10, 14, 15, 0, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 1, 2, 4, 5, 6, 9, 10, 11, 15, 4, 5, 6, 8, 13, 0, 1, 2, 4, 6, 9, 10, 11, 13, 14, 15, 1, 4, 6, 7, 8, 9, 12, 13, 14, 15, 1, 3, 4, 6, 8, 9, 10, 11, 12, 13, 15, 4, 6, 8, 9, 15, 0, 1, 2, 5, 6, 7, 8, 11, 12, 13, 14, 15, 1, 2, 5, 6, 8, 9, 11, 12, 13, 15, 3, 5, 6, 9, 10, 11, 12, 15, 0, 1, 2, 6, 7, 12, 14, 15, 2, 6, 7, 9, 10, 11, 15, 0, 4, 6, 7, 8, 10, 11, 13, 0, 5, 6, 8, 13, 14, 15, 3, 7, 9, 10, 11, 13, 15, 0, 3, 4, 6, 7, 8, 9, 11, 14, 15, 1, 2, 3, 4, 5, 9, 10, 14, 2, 3, 5, 8, 10, 12, 15, 0, 2, 8, 9, 11, 12, 0, 1, 3, 4, 10, 13, 15, 0, 1, 4, 5, 6, 7, 8, 11, 12, 13, 1, 2, 3, 6, 10, 11, 13, 1, 2, 3, 4, 5, 8, 9, 11, 12, 13, 14, 15, 2, 4, 5, 6, 9, 13, 14, 0, 5, 6, 9, 11, 15, 0, 1, 2, 4, 6, 8, 12, 13, 15, 0, 1, 2, 4, 5, 6, 8, 9, 11, 4, 6, 8, 13, 1, 2, 3, 6, 10, 13, 15, 0, 1, 2, 8, 13, 14, 15, 0, 2, 3, 4, 7, 9, 10, 12, 15, 0, 2, 4, 5, 7, 8, 10, 11, 15, 2, 4, 5, 7, 8, 10, 12, 15, 2, 8, 10, 13, 14, 0, 6, 9, 10, 12, 14, 15, 3, 4, 6, 7, 9, 10, 11, 14, 0, 3, 6, 7, 10, 11, 12, 13, 14, 15, 0, 2, 7, 8, 9, 11, 14, 15, 0, 1, 3, 5, 7, 8, 9, 12, 14, 15, 0, 3, 4, 5, 7, 8, 10, 11, 12, 0, 1, 2, 5, 6, 8, 9, 10, 11, 12, 14, 1, 2, 4, 5, 7, 8, 15, 1, 5, 8, 9, 10, 12, 13, 14, 0, 1, 2, 7, 8, 9, 10, 11, 12, 15, 0, 1, 6, 7, 10, 15, 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 13, 15, 0, 1, 2, 3, 9, 11, 14, 0, 4, 8, 10, 0, 1, 2, 4, 8, 11, 12, 14, 15, 0, 1, 2, 5, 8, 9, 12, 13, 14, 1, 3, 4, 5, 8, 9, 11, 12, 15, 1, 5, 10, 11, 14, 0, 5, 6, 9, 14, 15, 1, 2, 13, 14, 15, 4, 5, 6, 7, 8, 11, 12, 0, 2, 6, 10, 12, 15, 1, 3, 5, 6, 8, 9, 12, 15, 0, 3, 4, 7, 11, 12, 15, 1, 2, 4, 7, 9, 10, 11, 0, 3, 5, 7, 8, 9, 11, 12, 14, 0, 2, 3, 5, 6, 10, 11, 13, 14, 0, 2, 4, 7, 10, 12, 13, 0, 3, 4, 5, 6, 7, 9, 10, 13, 14, 1, 4, 6, 7, 8, 9, 11, 15, 0, 1, 2, 4, 7, 8, 13, 14, 0, 2, 4, 5, 10, 11, 12, 13, 0, 2, 3, 6, 8, 9, 10, 11, 12, 15, 0, 1, 2, 4, 5, 6, 9, 11, 12, 0, 1, 5, 13, 14, 15, 0, 2, 3, 7, 11, 12, 0, 1, 2, 3, 6, 8, 9, 10, 12, 13, 1, 5, 7, 9, 14, 15]] -# Vals: [-250, 363, -637, 105, -364, -874, 861, -490, -222, 321, -667, -537, -151, -746, -36, 71, -32, -998, 438, 604, 436, -383, 27, -107, -106, -109, -707, 226, 953, 707, -210, -155, 377, -780, 102, -186, -798, 171, -467, 982, -397, 387, -395, 456, -864, -836, -271, -27, -99, -159, -815, 885, -662, -14, -951, 462, 617, -442, 433, 395, 82, 819, -938, 877, -57, -349, -993, -812, -541, -269, -284, -60, -242, -744, 62, -829, -976, 403, 621, -87, -548, 731, -643, -137, -264, -38, 613, 643, 882, 410, -124, -688, 86, 365, 632, 657, -955, 279, -80, -409, 357, 181, 527, 537, 340, -683, -434, 203, 68, 480, 452, 981, 890, 700, -559, 792, 241, -528, 275, 45, 211, -765, 511, 931, -560, -897, 836, -816, -881, 44, 726, -858, -322, 847, 247, -336, -276, -835, 732, 961, -30, -570, 924, -605, -399, 80, 952, 747, 546, 25, -743, -687, -981, 454, 579, -634, 924, 156, -708, 716, -447, -234, -370, -746, -864, -87, 633, -176, 839, -868, -26, 32, 896, 593, 298, -668, -225, -213, 516, -300, -98, 417, -549, 168, 978, -902, -79, -192, 789, 488, 188, 814, -1000, 205, 186, 494, -319, 613, -460, -645, -723, -692, -333, -953, -211, -291, -957, 797, 607, -30, 611, 931, -725, -809, 583, 672, 262, 620, 711, 774, 563, 157, 395, 60, -456, -130, 268, 999, 705, 989, -812, 223, 501, 920, -495, -371, 816, 671, -183, 205, 910, -553, 465, -316, 712, 410, -804, -744, -369, -665, 619, -617, 256, -823, 640, 75, -758, -710, -697, -659, 990, -858, -235, 476, -236, 248, -47, 259, 271, -163, -889, -216, 692, -418, -14, 614, -829, -670, 381, -385, 928, -797, 670, 246, 395, 474, 917, -717, 700, -214, 162, -517, 389, 437, 278, -45, 219, -805, 617, 533, -772, 255, -25, 978, -46, -873, 262, -978, -13, -289, 812, -988, 626, -442, 223, -272, 933, 180, 182, 35, -176, -770, -86, 547, 590, -551, -627, -463, -361, 267, 859, -147, 979, -437, 735, -112, -348, -395, -745, -328, -974, -602, -820, -4, -600, -273, 458, 634, 591, 975, -116, -432, -689, -916, 523, -227, -203, 719, 527, 992, -475, -103, 28, -229, 680, -62, -83, -105, -394, 606, 15, 919, -546, 803, 5, -52, -817, 647, -436, 858, -51, -987, -923, 835, -2, 88, 873, -444, -509, -185, -988, -951, -863, -523, -969, -373, -817, -629, -999, 467, 148, -168, 512, -446, -386, -582, 810, 326, 505, -707, -339, 155, -27, -104, -603, -207, -740, -138, -107, 998, -252, 160, 689, -585, -140, 396, 453, 42, -325, 782, -638, 973, -343, 942, 968, 979, 879, -745, 245, 917, -532, -278, -194, 912, -299, 248, -849, -565, -100, -779, -658, -110, -257, -39, -766, 885, -704, -4, 533, 77, -27, -704, 497, -934, 299, 528, 149, 583, -697, -107, -48, 299, 759, 377, -798, -825, -893, -299, -178, 183, 39, -367, -862, -660, -157, -93, -89, 36, 563, 547, 392, -977, -864, 376, 4, 19, -416, 485, -637, 156, -20, -714, 116, -383, -182, -771, -851, -973, -282, 716, -243, -899, -267, 792, 668, -921, 10, -612, 96, 354, -23, 415, 233, 934, -193, 619, 5, 281, -660, -299, 50, 105, -469, -141, 347, 440, 758, -620, 620, -460, 673, 16, -905, -468, 565, -416, -3, -248, 57, 870, -895, 890, 847, -127, -490, -881, -901, 455, 235, 260, -703, -255, -541, -238, -215, 886, 429, -350, -357, 828, 646, 448, -860, -894, -934, -314, 922, -640, 506, 117, 525, -606, -701, -582, 356, 172, -218, -780, -540, 272, -768, 397, -41, -795, -619, -568, 268, 691, 669, -452, -851, -218, -432, -767, -300, 178, 769, -191, -272, 349, 573, -291, 429, -236] -@pytest.mark.parametrize("arrs", [arrs_dict1]) -def test_SparseAccumulator2new_tensor_direct(arrs, debug_sim, fill=0): - in_mat_crds1 = arrs["crds"] - in_mat_segs1 = arrs["segs"] - in_mat_vals1 = arrs["vals"] - dim = arrs["dim"] - - in1_tup = convert_point_tuple(get_point_list(in_mat_crds1, in_mat_segs1, in_mat_vals1)) - - nd1 = convert_point_tuple_ndarr(in1_tup, dim) - gold_nd = np.sum(nd1, 0) - gold_tup = convert_ndarr_point_tuple(gold_nd) - - rdscan_B1 = CompressedCrdRdScan(crd_arr=in_mat_crds1[0], seg_arr=in_mat_segs1[0], debug=debug_sim) - rdscan_B2 = CompressedCrdRdScan(crd_arr=in_mat_crds1[1], seg_arr=in_mat_segs1[1], debug=debug_sim) - rdscan_B3 = CompressedCrdRdScan(crd_arr=in_mat_crds1[2], seg_arr=in_mat_segs1[2], debug=debug_sim) - - val_B = Array(init_arr=in_mat_vals1, debug=debug_sim) - sa = SparseAccumulator2(valtype=int, val_stkn=True, debug=debug_sim) - - vals_X = ValsWrScan(size=dim * dim, fill=fill, debug=debug_sim) - wrscan_X1 = CompressWrScan(seg_size=2, size=dim, fill=fill, debug=debug_sim) - wrscan_X2 = CompressWrScan(seg_size=dim + 1, size=dim * dim, fill=fill, debug=debug_sim) - - done = False - time = 0 - in_ref_B = [0, 'D'] - out_rdscan_B1 = [] - out_rdscan_B2 = [] - out_rdscan_B3 = [] - out_val_B = [] - while not done and time < TIMEOUT: - if len(in_ref_B) > 0: - rdscan_B1.set_in_ref(in_ref_B.pop(0)) - - rdscan_B2.set_in_ref(rdscan_B1.out_ref()) - rdscan_B3.set_in_ref(rdscan_B2.out_ref()) - val_B.set_load(rdscan_B3.out_ref()) - - # Inject random empty strings - out_rdscan_B1.append(rdscan_B1.out_crd()) - out_rdscan_B2.append(rdscan_B2.out_crd()) - out_rdscan_B3.append(rdscan_B3.out_crd()) - out_val_B.append(val_B.out_load()) - - # Inject random delay - if random.random() < 0.2: - out_rdscan_B1.append("") - if random.random() < 0.2: - out_rdscan_B2.append("") - if random.random() < 0.2: - out_val_B.append("") - - sa.set_in_crd2(out_rdscan_B1.pop(0)) - sa.set_in_crd1(out_rdscan_B2.pop(0)) - sa.set_in_crd0(out_rdscan_B3.pop(0)) - sa.set_val(out_val_B.pop(0)) - - vals_X.set_input(sa.out_val()) - wrscan_X1.set_input(sa.out_crd1()) - wrscan_X2.set_input(sa.out_crd0()) - - rdscan_B1.update() - rdscan_B2.update() - rdscan_B3.update() - val_B.update() - sa.update() - vals_X.update() - wrscan_X1.update() - wrscan_X2.update() - - if time % 100 == 0: - print("Timestep", time, "\t Done --", - "\tRdScan B1:", rdscan_B1.out_done(), - "\tRdScan B2:", rdscan_B2.out_done(), - "\tRdScan B3:", rdscan_B3.out_done(), - "\tSparseAccumulator1New:", sa.out_done(), - "\tArr:", val_B.out_done(), - "\tWrScan:", vals_X.out_done(), - "\tWrScan X1:", wrscan_X1.out_done(), - "\tWrScan X2:", wrscan_X2.out_done(), - ) - - done = wrscan_X2.out_done() and wrscan_X1.out_done() and vals_X.out_done() - time += 1 - - wrscan_X1.autosize() - wrscan_X2.autosize() - vals_X.autosize() - - out_crds = [wrscan_X1.get_arr(), wrscan_X2.get_arr()] - out_segs = [wrscan_X1.get_seg_arr(), wrscan_X2.get_seg_arr()] - out_val = vals_X.get_arr() - - if debug_sim: - print("Input", in_mat_segs1, in_mat_crds1, in_mat_vals1) - print(nd1) - print("X seg", out_segs) - print("X crd", out_crds) - print("X val", out_val) - print("Gold np", gold_nd) - print("Gold Tuple", gold_tup) - - if not out_val: - assert out_val == gold_tup - else: - out_tup = convert_point_tuple(get_point_list(out_crds, out_segs, out_val)) - out_tup = remove_zeros(out_tup) - print("\nSegs: " + str(in_mat_segs1) + "\nCrds: " + str(in_mat_crds1) + \ - "\nVals: " + str(in_mat_vals1)) - assert check_point_tuple(out_tup, gold_tup) - -@pytest.mark.parametrize("dim", [2 ** x for x in range(1, 5, 1)]) -def test_SparseAccumulator2new_tensor_rand(dim, debug_sim, max_val=1000, fill=0): - in_mat_crds1, in_mat_segs1 = gen_n_comp_arrs(3, dim) - in_mat_vals1 = gen_val_arr(len(in_mat_crds1[-1]), max_val, -max_val) - - in1_tup = convert_point_tuple(get_point_list(in_mat_crds1, in_mat_segs1, in_mat_vals1)) - - nd1 = convert_point_tuple_ndarr(in1_tup, dim) - gold_nd = np.sum(nd1, 0) - gold_tup = convert_ndarr_point_tuple(gold_nd) - - rdscan_B1 = CompressedCrdRdScan(crd_arr=in_mat_crds1[0], seg_arr=in_mat_segs1[0], debug=debug_sim) - rdscan_B2 = CompressedCrdRdScan(crd_arr=in_mat_crds1[1], seg_arr=in_mat_segs1[1], debug=debug_sim) - rdscan_B3 = CompressedCrdRdScan(crd_arr=in_mat_crds1[2], seg_arr=in_mat_segs1[2], debug=debug_sim) - - val_B = Array(init_arr=in_mat_vals1, debug=debug_sim) - sa = SparseAccumulator2(valtype=int, val_stkn=True, debug=debug_sim) - - vals_X = ValsWrScan(size=dim * dim, fill=fill, debug=debug_sim) - wrscan_X1 = CompressWrScan(seg_size=2, size=dim, fill=fill, debug=debug_sim) - wrscan_X2 = CompressWrScan(seg_size=dim + 1, size=dim * dim, fill=fill, debug=debug_sim) - - done = False - time = 0 - in_ref_B = [0, 'D'] - out_rdscan_B1 = [] - out_rdscan_B2 = [] - out_rdscan_B3 = [] - out_val_B = [] - while not done and time < TIMEOUT: - if len(in_ref_B) > 0: - rdscan_B1.set_in_ref(in_ref_B.pop(0)) - - rdscan_B2.set_in_ref(rdscan_B1.out_ref()) - rdscan_B3.set_in_ref(rdscan_B2.out_ref()) - val_B.set_load(rdscan_B3.out_ref()) - - # Inject random empty strings - out_rdscan_B1.append(rdscan_B1.out_crd()) - out_rdscan_B2.append(rdscan_B2.out_crd()) - out_rdscan_B3.append(rdscan_B3.out_crd()) - out_val_B.append(val_B.out_load()) - - # Inject random delay - if random.random() < 0.2: - out_rdscan_B1.append("") - if random.random() < 0.2: - out_rdscan_B2.append("") - if random.random() < 0.2: - out_val_B.append("") - - sa.set_in_crd2(out_rdscan_B1.pop(0)) - sa.set_in_crd1(out_rdscan_B2.pop(0)) - sa.set_in_crd0(out_rdscan_B3.pop(0)) - sa.set_val(out_val_B.pop(0)) - - vals_X.set_input(sa.out_val()) - wrscan_X1.set_input(sa.out_crd1()) - wrscan_X2.set_input(sa.out_crd0()) - - rdscan_B1.update() - rdscan_B2.update() - rdscan_B3.update() - val_B.update() - sa.update() - vals_X.update() - wrscan_X1.update() - wrscan_X2.update() - - if time % 100 == 0: - print("Timestep", time, "\t Done --", - "\tRdScan B1:", rdscan_B1.out_done(), - "\tRdScan B2:", rdscan_B2.out_done(), - "\tRdScan B3:", rdscan_B3.out_done(), - "\tSparseAccumulator1New:", sa.out_done(), - "\tArr:", val_B.out_done(), - "\tWrScan:", vals_X.out_done(), - "\tWrScan X1:", wrscan_X1.out_done(), - "\tWrScan X2:", wrscan_X2.out_done(), - ) - - done = wrscan_X2.out_done() and wrscan_X1.out_done() and vals_X.out_done() - time += 1 - - wrscan_X1.autosize() - wrscan_X2.autosize() - vals_X.autosize() - - out_crds = [wrscan_X1.get_arr(), wrscan_X2.get_arr()] - out_segs = [wrscan_X1.get_seg_arr(), wrscan_X2.get_seg_arr()] - out_val = vals_X.get_arr() - - if debug_sim: - print("Input", in_mat_segs1, in_mat_crds1, in_mat_vals1) - print(nd1) - print("X seg", out_segs) - print("X crd", out_crds) - print("X val", out_val) - print("Gold np", gold_nd) - print("Gold Tuple", gold_tup) - - if not out_val: - assert out_val == gold_tup - else: - out_tup = convert_point_tuple(get_point_list(out_crds, out_segs, out_val)) - print("\nSegs: " + str(in_mat_segs1) + "\nCrds: " + str(in_mat_crds1) + \ - "\nVals: " + str(in_mat_vals1)) - assert check_point_tuple(out_tup, gold_tup) \ No newline at end of file From d48e1fc72ea293fc65dacc5a7051b48765cf5268 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Nov 2023 20:19:33 -0800 Subject: [PATCH 6/9] Revert "New graphs" This reverts commit e84a882fb333dae23b96a9bacde37f4e0f4023ee. --- compiler/sam-outputs/dot/mat_elemadd.gv | 32 -------- compiler/sam-outputs/dot/mat_elemadd3.gv | 44 ---------- compiler/sam-outputs/dot/mat_elemmul.gv | 35 -------- compiler/sam-outputs/dot/mat_identity.gv | 14 ---- .../sam-outputs/dot/mat_identity_dense.gv | 14 ---- compiler/sam-outputs/dot/mat_sddmm.gv | 69 ---------------- compiler/sam-outputs/dot/mat_spacc_simple.gv | 26 ------ compiler/sam-outputs/dot/mat_vecmul_ij.gv | 32 -------- compiler/sam-outputs/dot/mat_vecmul_ji.gv | 35 -------- compiler/sam-outputs/dot/matmul_ijk.gv | 43 ---------- compiler/sam-outputs/dot/matmul_ikj.gv | 55 ------------- .../matmul_ikj_hand_BLACKBOX_with_crddrop.gv | 47 ----------- compiler/sam-outputs/dot/matmul_jik.gv | 43 ---------- compiler/sam-outputs/dot/matmul_jki.gv | 55 ------------- compiler/sam-outputs/dot/matmul_kij.gv | 51 ------------ compiler/sam-outputs/dot/matmul_kji.gv | 51 ------------ compiler/sam-outputs/dot/tensor3_elemadd.gv | 43 ---------- compiler/sam-outputs/dot/tensor3_elemmul.gv | 49 ------------ compiler/sam-outputs/dot/tensor3_identity.gv | 18 ----- .../sam-outputs/dot/tensor3_identity_dense.gv | 18 ----- compiler/sam-outputs/dot/tensor3_innerprod.gv | 43 ---------- compiler/sam-outputs/dot/tensor3_mttkrp.gv | 80 ------------------- compiler/sam-outputs/dot/tensor3_ttm.gv | 54 ------------- compiler/sam-outputs/dot/tensor3_ttv.gv | 43 ---------- .../dot/vec_ds_compression_WRONG.gv | 10 --- compiler/sam-outputs/dot/vec_elemadd.gv | 21 ----- compiler/sam-outputs/dot/vec_elemmul.gv | 21 ----- compiler/sam-outputs/dot/vec_identity.gv | 10 --- compiler/sam-outputs/dot/vec_scalar_mul.gv | 21 ----- .../dot/vec_sd_compression_WRONG.gv | 10 --- compiler/sam-outputs/dot/vec_spacc_simple.gv | 17 ---- compiler/sam-outputs/onyx-dot/matmul_ikj.gv | 44 ---------- 32 files changed, 1148 deletions(-) delete mode 100644 compiler/sam-outputs/dot/mat_elemadd.gv delete mode 100644 compiler/sam-outputs/dot/mat_elemadd3.gv delete mode 100644 compiler/sam-outputs/dot/mat_elemmul.gv delete mode 100644 compiler/sam-outputs/dot/mat_identity.gv delete mode 100644 compiler/sam-outputs/dot/mat_identity_dense.gv delete mode 100644 compiler/sam-outputs/dot/mat_sddmm.gv delete mode 100644 compiler/sam-outputs/dot/mat_spacc_simple.gv delete mode 100644 compiler/sam-outputs/dot/mat_vecmul_ij.gv delete mode 100644 compiler/sam-outputs/dot/mat_vecmul_ji.gv delete mode 100644 compiler/sam-outputs/dot/matmul_ijk.gv delete mode 100644 compiler/sam-outputs/dot/matmul_ikj.gv delete mode 100644 compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv delete mode 100644 compiler/sam-outputs/dot/matmul_jik.gv delete mode 100644 compiler/sam-outputs/dot/matmul_jki.gv delete mode 100644 compiler/sam-outputs/dot/matmul_kij.gv delete mode 100644 compiler/sam-outputs/dot/matmul_kji.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_elemadd.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_elemmul.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_identity.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_identity_dense.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_innerprod.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_mttkrp.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_ttm.gv delete mode 100644 compiler/sam-outputs/dot/tensor3_ttv.gv delete mode 100644 compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv delete mode 100644 compiler/sam-outputs/dot/vec_elemadd.gv delete mode 100644 compiler/sam-outputs/dot/vec_elemmul.gv delete mode 100644 compiler/sam-outputs/dot/vec_identity.gv delete mode 100644 compiler/sam-outputs/dot/vec_scalar_mul.gv delete mode 100644 compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv delete mode 100644 compiler/sam-outputs/dot/vec_spacc_simple.gv delete mode 100644 compiler/sam-outputs/onyx-dot/matmul_ikj.gv diff --git a/compiler/sam-outputs/dot/mat_elemadd.gv b/compiler/sam-outputs/dot/mat_elemadd.gv deleted file mode 100644 index e3f2e6a3..00000000 --- a/compiler/sam-outputs/dot/mat_elemadd.gv +++ /dev/null @@ -1,32 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01,C=ss01" - 10 [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"] - 9 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] - 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"] - 7 [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"] - 6 [comment="type=union,index=j" label="union j" color=purple shape=box style=filled type="union" index="j"] - 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"] - 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 3 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] - 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"] - 11 [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"] - 10 -> 9 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 9 -> 2 [label="crd" style=dashed type="crd"] - 9 -> 7 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 7 -> 6 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 6 -> 1 [label="crd" style=dashed type="crd"] - 6 -> 4 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 4 -> 3 [label="val" type="val"] - 3 -> 0 [label="val" type="val"] - 6 -> 5 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 5 -> 3 [label="val" type="val"] - 7 -> 6 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 9 -> 8 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 8 -> 6 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 8 -> 6 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 10 -> 9 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 11 -> 9 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 11 -> 9 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/mat_elemadd3.gv b/compiler/sam-outputs/dot/mat_elemadd3.gv deleted file mode 100644 index eb3cc154..00000000 --- a/compiler/sam-outputs/dot/mat_elemadd3.gv +++ /dev/null @@ -1,44 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01,C=ss01,D=ss01" - 13 [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"] - 12 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] - 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"] - 9 [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"] - 8 [comment="type=union,index=j" label="union j" color=purple shape=box style=filled type="union" index="j"] - 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"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 4 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] - 3 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] - 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"] - 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 7 [comment="type=arrayvals,tensor=D" label="Array Vals: D" color=green2 shape=box style=filled type="arrayvals" tensor="D"] - 10 [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=fiberlookup,index=j,tensor=D,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: D1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="D" mode="1" format="compressed" src="true" root="false"] - 14 [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"] - 15 [comment="type=fiberlookup,index=i,tensor=D,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: D0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="D" mode="0" format="compressed" src="true" root="true"] - 13 -> 12 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 12 -> 2 [label="crd" style=dashed type="crd"] - 12 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 9 -> 8 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 8 -> 1 [label="crd" style=dashed type="crd"] - 8 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 5 -> 4 [label="val" type="val"] - 4 -> 3 [label="val" type="val"] - 3 -> 0 [label="val" type="val"] - 8 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 6 -> 4 [label="val" type="val"] - 8 -> 7 [label="ref_out-D" style=bold type="ref" comment="out-D"] - 7 -> 3 [label="val" type="val"] - 9 -> 8 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 12 -> 10 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 10 -> 8 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 10 -> 8 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 12 -> 11 [label="ref_out-D" style=bold type="ref" comment="out-D"] - 11 -> 8 [label="crd_in-D" style=dashed type="crd" comment="in-D"] - 11 -> 8 [label="ref_in-D" style=bold type="ref" comment="in-D"] - 13 -> 12 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 14 -> 12 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 14 -> 12 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 15 -> 12 [label="crd_in-D" style=dashed type="crd" comment="in-D"] - 15 -> 12 [label="ref_in-D" style=bold type="ref" comment="in-D"] -} diff --git a/compiler/sam-outputs/dot/mat_elemmul.gv b/compiler/sam-outputs/dot/mat_elemmul.gv deleted file mode 100644 index fa8e23d5..00000000 --- a/compiler/sam-outputs/dot/mat_elemmul.gv +++ /dev/null @@ -1,35 +0,0 @@ -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=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 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/compiler/sam-outputs/dot/mat_identity.gv b/compiler/sam-outputs/dot/mat_identity.gv deleted file mode 100644 index 1b152c36..00000000 --- a/compiler/sam-outputs/dot/mat_identity.gv +++ /dev/null @@ -1,14 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01" - 5 [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"] - 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"] - 4 [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"] - 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"] - 3 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 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 -> 2 [label="crd" style=dashed type="crd" comment=""] - 5 -> 4 [label="ref" style=bold type="ref" comment=""] - 4 -> 1 [label="crd" style=dashed type="crd" comment=""] - 4 -> 3 [label="ref" style=bold type="ref" comment=""] - 3 -> 0 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/mat_identity_dense.gv b/compiler/sam-outputs/dot/mat_identity_dense.gv deleted file mode 100644 index 0f5eb309..00000000 --- a/compiler/sam-outputs/dot/mat_identity_dense.gv +++ /dev/null @@ -1,14 +0,0 @@ -digraph SAM { - comment="X=dd01,B=dd01" - 5 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=dense,src=true,root=true" label="FiberLookup i: B0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="dense" src="true" root="true"] - 2 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=dense,sink=true" label="FiberWrite i: X0\ndense" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="X" mode="0" format="dense" sink="true"] - 4 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=dense,src=true,root=false" label="FiberLookup j: B1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="dense" src="true" root="false"] - 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=dense,sink=true" label="FiberWrite j: X1\ndense" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="1" format="dense" sink="true"] - 3 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 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 -> 2 [label="crd" style=dashed type="crd" comment=""] - 5 -> 4 [label="ref" style=bold type="ref" comment=""] - 4 -> 1 [label="crd" style=dashed type="crd" comment=""] - 4 -> 3 [label="ref" style=bold type="ref" comment=""] - 3 -> 0 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/mat_sddmm.gv b/compiler/sam-outputs/dot/mat_sddmm.gv deleted file mode 100644 index 685371a9..00000000 --- a/compiler/sam-outputs/dot/mat_sddmm.gv +++ /dev/null @@ -1,69 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01,C=dd01,D=dd10" - 25 [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"] - 24 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] - 23 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 9 [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"] - 22 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 21 [comment="type=repeat,index=i,tensor=D,root=true" label="Repeat i: D" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="D" root="true"] - 20 [comment="type=fiberlookup,index=j,tensor=D,mode=1,format=dense,src=true,root=false" label="FiberLookup j: D1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="D" mode="1" format="dense" src="true" root="false"] - 18 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] - 17 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 16 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 15 [comment="type=repeat,index=j,tensor=C,root=false" label="Repeat j: C" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="C" root="false"] - 13 [comment="type=fiberlookup,index=k,tensor=C,mode=1,format=dense,src=true,root=false" label="FiberLookup k: C1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="1" format="dense" src="true" root="false"] - 12 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 11 [comment="type=repsiggen,index=k" label="RepeatSignalGenerator k" color=cyan3 shape=box style=filled type="repsiggen" index="k"] - 10 [comment="type=repeat,index=k,tensor=B,root=false" label="Repeat k: B" color=cyan2 shape=box style=filled type="repeat" index="k" tensor="B" root="false"] - 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 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"] - 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 8 [comment="type=arrayvals,tensor=D" label="Array Vals: D" color=green2 shape=box style=filled type="arrayvals" tensor="D"] - 14 [comment="type=fiberlookup,index=k,tensor=D,mode=0,format=dense,src=true,root=false" label="FiberLookup k: D0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="D" mode="0" format="dense" src="true" root="false"] - 19 [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"] - 26 [comment="type=fiberlookup,index=i,tensor=C,mode=0,format=dense,src=true,root=true" label="FiberLookup i: C0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="C" mode="0" format="dense" src="true" root="true"] - 25 -> 24 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 24 -> 23 [label="crd_i" style=dashed type="crd" comment="i"] - 23 -> 9 [label="crd_i" style=dashed type="crd" comment="i"] - 9 -> 2 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] - 9 -> 1 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] - 23 -> 22 [label="crd" style=dashed type="crd" comment=""] - 22 -> 21 [label="repsig" style=dotted type="repsig"] - 21 -> 20 [label="ref" style=bold type="ref"] - 20 -> 18 [label="crd_in-D" style=dashed type="crd" comment="in-D"] - 18 -> 17 [label="crd_j" style=dashed type="crd" comment="j"] - 17 -> 9 [label="crd_j" style=dashed type="crd" comment="j"] - 17 -> 16 [label="crd" style=dashed type="crd" comment=""] - 16 -> 15 [label="repsig" style=dotted type="repsig"] - 15 -> 13 [label="ref" style=bold type="ref"] - 13 -> 12 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 12 -> 11 [label="crd" style=dashed type="crd"] - 11 -> 10 [label="repsig" style=dotted type="repsig"] - 10 -> 6 [label="ref" style=bold type="ref"] - 6 -> 5 [label="val" type="val"] - 5 -> 4 [label="val" type="val"] - 4 -> 3 [label="val" type="val"] - 3 -> 0 [label="val" type="val"] - 12 -> 7 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 7 -> 5 [label="val" type="val"] - 12 -> 8 [label="ref_out-D" style=bold type="ref" comment="out-D"] - 8 -> 4 [label="val" type="val"] - 13 -> 12 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 18 -> 10 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 18 -> 14 [label="ref_out-D" style=bold type="ref" comment="out-D"] - 14 -> 12 [label="crd_in-D" style=dashed type="crd" comment="in-D"] - 14 -> 12 [label="ref_in-D" style=bold type="ref" comment="in-D"] - 20 -> 18 [label="ref_in-D" style=bold type="ref" comment="in-D"] - 24 -> 19 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 19 -> 18 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 19 -> 18 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 24 -> 15 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 25 -> 24 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 26 -> 24 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 26 -> 24 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/mat_spacc_simple.gv b/compiler/sam-outputs/dot/mat_spacc_simple.gv deleted file mode 100644 index acc21feb..00000000 --- a/compiler/sam-outputs/dot/mat_spacc_simple.gv +++ /dev/null @@ -1,26 +0,0 @@ -digraph SAM { - comment="X=ss01,B=sss012" - 8 [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"] - 3 [comment="type=spaccumulator,order=2,in0=k,in1=j" label="SparseAccumulator 2 -0=k 1=j " color=brown shape=box style=filled type="spaccumulator" order="2" in0="k" in1="j"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B1_dim*B2_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B1_dim*B2_dim" sink="true"] - 1 [comment="type=fiberwrite,index=k,tensor=X,mode=1,format=compressed,segsize=B1_dim+1,crdsize=B1_dim*B2_dim,sink=true" label="FiberWrite k: X1\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="1" format="compressed" segsize="B1_dim+1" crdsize="B1_dim*B2_dim" sink="true"] - 2 [comment="type=fiberwrite,index=j,tensor=X,mode=0,format=compressed,segsize=2,crdsize=B1_dim,sink=true" label="FiberWrite j: X0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="0" format="compressed" segsize="2" crdsize="B1_dim" sink="true"] - 7 [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"] - 4 [comment="type=crdhold,outer=j,inner=k" label="CrdHold j,k -outer=j,inner=k" color=orange shape=box style=filled type="crdhold" outer="j" inner="k"] - 6 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 8 -> 3 [label="crd_i" style=dashed type="crd" comment="i"] - 3 -> 0 [label="val" type="val"] - 3 -> 1 [label="crd_out-k" style=dashed type="crd" comment="out-k"] - 3 -> 2 [label="crd_out-j" style=dashed type="crd" comment="out-j"] - 8 -> 7 [label="ref" style=bold type="ref" comment=""] - 7 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] - 4 -> 3 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] - 4 -> 3 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] - 7 -> 6 [label="ref" style=bold type="ref" comment=""] - 6 -> 4 [label="crd_k" style=dashed type="crd" comment="k"] - 6 -> 5 [label="ref" style=bold type="ref" comment=""] - 5 -> 3 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/mat_vecmul_ij.gv b/compiler/sam-outputs/dot/mat_vecmul_ij.gv deleted file mode 100644 index 7ff0e0f7..00000000 --- a/compiler/sam-outputs/dot/mat_vecmul_ij.gv +++ /dev/null @@ -1,32 +0,0 @@ -digraph SAM { - comment="x=s0,B=ss01,c=s0" - 12 [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"] - 11 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 1 [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"] - 10 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 9 [comment="type=repeat,index=i,tensor=c,root=true" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="true"] - 8 [comment="type=fiberlookup,index=j,tensor=c,mode=0,format=compressed,src=true,root=false" label="FiberLookup j: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="c" mode="0" format="compressed" src="true" root="false"] - 6 [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=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 2 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B0_dim" sink="true"] - 5 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] - 7 [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"] - 12 -> 11 [label="crd" style=dashed type="crd" comment=""] - 11 -> 1 [label="crd" style=dashed type="crd"] - 11 -> 10 [label="crd" style=dashed type="crd"] - 10 -> 9 [label="repsig" style=dotted type="repsig"] - 9 -> 8 [label="ref" style=bold type="ref"] - 8 -> 6 [label="crd_in-c" style=dashed type="crd" comment="in-c"] - 6 -> 4 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 4 -> 3 [label="val" type="val"] - 3 -> 2 [label="val" type="val"] - 2 -> 0 [label="val" type="val"] - 6 -> 5 [label="ref_out-c" style=bold type="ref" comment="out-c"] - 5 -> 3 [label="val" type="val"] - 8 -> 6 [label="ref_in-c" style=bold type="ref" comment="in-c"] - 12 -> 7 [label="ref" style=bold type="ref" comment=""] - 7 -> 6 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 7 -> 6 [label="ref_in-B" style=bold type="ref" comment="in-B"] -} diff --git a/compiler/sam-outputs/dot/mat_vecmul_ji.gv b/compiler/sam-outputs/dot/mat_vecmul_ji.gv deleted file mode 100644 index 545dc82d..00000000 --- a/compiler/sam-outputs/dot/mat_vecmul_ji.gv +++ /dev/null @@ -1,35 +0,0 @@ -digraph SAM { - comment="x=s0,B=ss10,c=s0" - 11 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=compressed,src=true,root=true" label="FiberLookup j: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="compressed" src="true" root="true"] - 10 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] - 2 [comment="type=spaccumulator,order=1,in0=i" label="SparseAccumulator 1 -0=i " color=brown shape=box style=filled type="spaccumulator" order="1" in0="i"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B0_dim" sink="true"] - 1 [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"] - 9 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] - 8 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 7 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 6 [comment="type=repeat,index=i,tensor=c,root=false" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="false"] - 5 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] - 3 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 12 [comment="type=fiberlookup,index=j,tensor=c,mode=0,format=compressed,src=true,root=true" label="FiberLookup j: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="c" mode="0" format="compressed" src="true" root="true"] - 11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 10 -> 2 [label="crd_j" style=dashed type="crd" comment="j"] - 2 -> 0 [label="val" type="val"] - 2 -> 1 [label="crd_out-i" style=dashed type="crd" comment="out-i"] - 10 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 9 -> 8 [label="crd" style=dashed type="crd" comment=""] - 8 -> 2 [label="crd_i" style=dashed type="crd" comment="i"] - 8 -> 7 [label="crd" style=dashed type="crd" comment=""] - 7 -> 6 [label="repsig" style=dotted type="repsig"] - 6 -> 5 [label="ref" style=bold type="ref"] - 5 -> 3 [label="val" type="val"] - 3 -> 2 [label="val" type="val"] - 9 -> 4 [label="ref" style=bold type="ref" comment=""] - 4 -> 3 [label="val" type="val"] - 10 -> 6 [label="ref_out-c" style=bold type="ref" comment="out-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/compiler/sam-outputs/dot/matmul_ijk.gv b/compiler/sam-outputs/dot/matmul_ijk.gv deleted file mode 100644 index d491fe04..00000000 --- a/compiler/sam-outputs/dot/matmul_ijk.gv +++ /dev/null @@ -1,43 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01,C=ss10" - 17 [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"] - 16 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 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"] - 15 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 14 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] - 13 [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=broadcast" shape=point style=invis type="broadcast"] - 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] - 11 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 10 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] - 8 [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"] - 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] - 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 9 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] - 17 -> 16 [label="crd" style=dashed type="crd" comment=""] - 16 -> 2 [label="crd" style=dashed type="crd"] - 16 -> 15 [label="crd" style=dashed type="crd"] - 15 -> 14 [label="repsig" style=dotted type="repsig"] - 14 -> 13 [label="ref" style=bold type="ref"] - 13 -> 12 [label="crd" style=dashed type="crd" comment=""] - 12 -> 1 [label="crd" style=dashed type="crd"] - 12 -> 11 [label="crd" style=dashed type="crd"] - 11 -> 10 [label="repsig" style=dotted type="repsig"] - 10 -> 8 [label="ref" style=bold type="ref"] - 8 -> 7 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 5 -> 4 [label="val" type="val"] - 4 -> 3 [label="val" type="val"] - 3 -> 0 [label="val" type="val"] - 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 6 -> 4 [label="val" type="val"] - 8 -> 7 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 13 -> 9 [label="ref" style=bold type="ref" comment=""] - 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"] - 17 -> 10 [label="ref" style=bold type="ref" comment=""] -} diff --git a/compiler/sam-outputs/dot/matmul_ikj.gv b/compiler/sam-outputs/dot/matmul_ikj.gv deleted file mode 100644 index 6b3f557a..00000000 --- a/compiler/sam-outputs/dot/matmul_ikj.gv +++ /dev/null @@ -1,55 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01,C=ss01" - 19 [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"] - 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 5 [comment="type=crdhold,outer=i,inner=k" label="CrdHold i,k -outer=i,inner=k" color=orange shape=box style=filled type="crdhold" outer="i" inner="k"] - 4 [comment="type=crdhold,outer=i,inner=j" label="CrdHold i,j -outer=i,inner=j" color=orange shape=box style=filled type="crdhold" outer="i" inner="j"] - 3 [comment="type=spaccumulator,order=1,in0=j,in1=i" label="SparseAccumulator 1 -0=j 1=i " color=brown shape=box style=filled type="spaccumulator" order="1" in0="j" in1="i"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] - 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] - 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"] - 17 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 16 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] - 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] - 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 9 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] - 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 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"] - 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"] - 19 -> 18 [label="crd" style=dashed type="crd" comment=""] - 18 -> 5 [label="crd_i" style=dashed type="crd" comment="i"] - 5 -> 4 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] - 4 -> 3 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] - 3 -> 0 [label="val" type="val"] - 3 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] - 3 -> 2 [label="crd_out-i" style=dashed type="crd" comment="out-i"] - 4 -> 3 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] - 5 -> 3 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] - 18 -> 17 [label="crd" style=dashed type="crd" comment=""] - 17 -> 16 [label="repsig" style=dotted type="repsig"] - 16 -> 15 [label="ref" style=bold type="ref"] - 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 13 -> 5 [label="crd_k" style=dashed type="crd" comment="k"] - 13 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 9 -> 7 [label="ref" style=bold type="ref"] - 7 -> 6 [label="val" type="val"] - 6 -> 3 [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 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] - 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=""] - 8 -> 6 [label="val" type="val"] - 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 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"] -} diff --git a/compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv b/compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv deleted file mode 100644 index 637156d1..00000000 --- a/compiler/sam-outputs/dot/matmul_ikj_hand_BLACKBOX_with_crddrop.gv +++ /dev/null @@ -1,47 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01,C=ss01" - 20 [comment="type=vectorreducer,index=j" label="VectorReducer j" color=brown shape=box style=filled type="vectorreducer" accum_index="j"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] - 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] - 19 [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"] - 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 4 [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"] - 17 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 16 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] - 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] - 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 9 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] - 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 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"] - 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"] - 19 -> 18 [label="crd" style=dashed type="crd" comment=""] - 4 -> 2 [label="crd_out-i" style=dashed type="crd" comment="out-i"] - 18 -> 17 [label="crd" style=dashed type="crd" comment=""] - 17 -> 16 [label="repsig" style=dotted type="repsig"] - 16 -> 15 [label="ref" style=bold type="ref"] - 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 13 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 9 -> 7 [label="ref" style=bold type="ref"] - 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=""] - 19 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] - 11 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] - 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=""] - 8 -> 6 [label="val" type="val"] - 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 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"] - 4 -> 20 [label="crddrp-crd-j-out" style=dashed type="crd" comment="crddrp-crd-j-out"] - 6 -> 20 [label="mul_val_out" type="val"] - 20 -> 0 [label="final_vals" type="val"] - 20 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] -} diff --git a/compiler/sam-outputs/dot/matmul_jik.gv b/compiler/sam-outputs/dot/matmul_jik.gv deleted file mode 100644 index 1878bca2..00000000 --- a/compiler/sam-outputs/dot/matmul_jik.gv +++ /dev/null @@ -1,43 +0,0 @@ -digraph SAM { - comment="X=ss10,B=ss01,C=ss10" - 17 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=compressed,src=true,root=true" label="FiberLookup j: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="compressed" src="true" root="true"] - 16 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=2,crdsize=C1_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="2" crdsize="C1_dim" sink="true"] - 15 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 14 [comment="type=repeat,index=j,tensor=B,root=true" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="true"] - 13 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] - 12 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 1 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=C1_dim+1,crdsize=C1_dim*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="C1_dim+1" crdsize="C1_dim*B0_dim" sink="true"] - 11 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 10 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] - 9 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] - 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*C1_dim*B0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*C1_dim*B0_dim" sink="true"] - 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 8 [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"] - 17 -> 16 [label="crd" style=dashed type="crd" comment=""] - 16 -> 2 [label="crd" style=dashed type="crd"] - 16 -> 15 [label="crd" style=dashed type="crd"] - 15 -> 14 [label="repsig" style=dotted type="repsig"] - 14 -> 13 [label="ref" style=bold type="ref"] - 13 -> 12 [label="crd" style=dashed type="crd" comment=""] - 12 -> 1 [label="crd" style=dashed type="crd"] - 12 -> 11 [label="crd" style=dashed type="crd"] - 11 -> 10 [label="repsig" style=dotted type="repsig"] - 10 -> 9 [label="ref" style=bold type="ref"] - 9 -> 7 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 5 -> 4 [label="val" type="val"] - 4 -> 3 [label="val" type="val"] - 3 -> 0 [label="val" type="val"] - 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 6 -> 4 [label="val" type="val"] - 9 -> 7 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 13 -> 8 [label="ref" style=bold type="ref" comment=""] - 8 -> 7 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 8 -> 7 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 17 -> 10 [label="ref" style=bold type="ref" comment=""] -} diff --git a/compiler/sam-outputs/dot/matmul_jki.gv b/compiler/sam-outputs/dot/matmul_jki.gv deleted file mode 100644 index fb3fe514..00000000 --- a/compiler/sam-outputs/dot/matmul_jki.gv +++ /dev/null @@ -1,55 +0,0 @@ -digraph SAM { - comment="X=ss10,B=ss10,C=ss10" - 19 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=compressed,src=true,root=true" label="FiberLookup j: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="compressed" src="true" root="true"] - 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 5 [comment="type=crdhold,outer=j,inner=k" label="CrdHold j,k -outer=j,inner=k" color=orange shape=box style=filled type="crdhold" outer="j" inner="k"] - 4 [comment="type=crdhold,outer=j,inner=i" label="CrdHold j,i -outer=j,inner=i" color=orange shape=box style=filled type="crdhold" outer="j" inner="i"] - 3 [comment="type=spaccumulator,order=1,in0=i,in1=j" label="SparseAccumulator 1 -0=i 1=j " color=brown shape=box style=filled type="spaccumulator" order="1" in0="i" in1="j"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*C1_dim*B0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*C1_dim*B0_dim" sink="true"] - 1 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=C1_dim+1,crdsize=C1_dim*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="C1_dim+1" crdsize="C1_dim*B0_dim" sink="true"] - 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=2,crdsize=C1_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="2" crdsize="C1_dim" sink="true"] - 17 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 16 [comment="type=repeat,index=j,tensor=B,root=true" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="true"] - 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"] - 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 12 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] - 11 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 10 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 9 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] - 8 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 6 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] - 19 -> 18 [label="crd" style=dashed type="crd" comment=""] - 18 -> 5 [label="crd_j" style=dashed type="crd" comment="j"] - 5 -> 4 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] - 4 -> 3 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] - 3 -> 0 [label="val" type="val"] - 3 -> 1 [label="crd_out-i" style=dashed type="crd" comment="out-i"] - 3 -> 2 [label="crd_out-j" style=dashed type="crd" comment="out-j"] - 4 -> 3 [label="crd_inner-i" style=dashed type="crd" comment="inner-i"] - 5 -> 3 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] - 18 -> 17 [label="crd" style=dashed type="crd" comment=""] - 17 -> 16 [label="repsig" style=dotted type="repsig"] - 16 -> 14 [label="ref" style=bold type="ref"] - 14 -> 13 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 13 -> 5 [label="crd_k" style=dashed type="crd" comment="k"] - 13 -> 12 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 12 -> 11 [label="crd" style=dashed type="crd" comment=""] - 11 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] - 11 -> 10 [label="crd" style=dashed type="crd" comment=""] - 10 -> 9 [label="repsig" style=dotted type="repsig"] - 9 -> 8 [label="ref" style=bold type="ref"] - 8 -> 6 [label="val" type="val"] - 6 -> 3 [label="val" type="val"] - 12 -> 7 [label="ref" style=bold type="ref" comment=""] - 7 -> 6 [label="val" type="val"] - 13 -> 9 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 14 -> 13 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 19 -> 15 [label="ref" style=bold type="ref" comment=""] - 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/matmul_kij.gv b/compiler/sam-outputs/dot/matmul_kij.gv deleted file mode 100644 index 4271bd23..00000000 --- a/compiler/sam-outputs/dot/matmul_kij.gv +++ /dev/null @@ -1,51 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss10,C=ss01" - 17 [comment="type=fiberlookup,index=k,tensor=B,mode=1,format=compressed,src=true,root=true" label="FiberLookup k: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="1" format="compressed" src="true" root="true"] - 16 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 3 [comment="type=spaccumulator,order=2,in0=j,in1=i" label="SparseAccumulator 2 -0=j 1=i " color=brown shape=box style=filled type="spaccumulator" order="2" in0="j" in1="i"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] - 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] - 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"] - 15 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] - 14 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 4 [comment="type=crdhold,outer=i,inner=j" label="CrdHold i,j -outer=i,inner=j" color=orange shape=box style=filled type="crdhold" outer="i" inner="j"] - 13 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 12 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] - 11 [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"] - 10 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 9 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 8 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] - 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 18 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=true" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="true"] - 17 -> 16 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 16 -> 3 [label="crd_k" style=dashed type="crd" comment="k"] - 3 -> 0 [label="val" type="val"] - 3 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] - 3 -> 2 [label="crd_out-i" style=dashed type="crd" comment="out-i"] - 16 -> 15 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 15 -> 14 [label="crd" style=dashed type="crd" comment=""] - 14 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] - 4 -> 3 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] - 4 -> 3 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] - 14 -> 13 [label="crd" style=dashed type="crd" comment=""] - 13 -> 12 [label="repsig" style=dotted type="repsig"] - 12 -> 11 [label="ref" style=bold type="ref"] - 11 -> 10 [label="crd" style=dashed type="crd" comment=""] - 10 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] - 10 -> 9 [label="crd" style=dashed type="crd" comment=""] - 9 -> 8 [label="repsig" style=dotted type="repsig"] - 8 -> 6 [label="ref" style=bold type="ref"] - 6 -> 5 [label="val" type="val"] - 5 -> 3 [label="val" type="val"] - 11 -> 7 [label="ref" style=bold type="ref" comment=""] - 7 -> 5 [label="val" type="val"] - 15 -> 8 [label="ref" style=bold type="ref" comment=""] - 16 -> 12 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 17 -> 16 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 18 -> 16 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 18 -> 16 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/matmul_kji.gv b/compiler/sam-outputs/dot/matmul_kji.gv deleted file mode 100644 index 9951a3c1..00000000 --- a/compiler/sam-outputs/dot/matmul_kji.gv +++ /dev/null @@ -1,51 +0,0 @@ -digraph SAM { - comment="X=ss10,B=ss10,C=ss01" - 17 [comment="type=fiberlookup,index=k,tensor=B,mode=1,format=compressed,src=true,root=true" label="FiberLookup k: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="1" format="compressed" src="true" root="true"] - 16 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 3 [comment="type=spaccumulator,order=2,in0=i,in1=j" label="SparseAccumulator 2 -0=i 1=j " color=brown shape=box style=filled type="spaccumulator" order="2" in0="i" in1="j"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*C1_dim*B0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*C1_dim*B0_dim" sink="true"] - 1 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=C1_dim+1,crdsize=C1_dim*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="C1_dim+1" crdsize="C1_dim*B0_dim" sink="true"] - 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=2,crdsize=C1_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="2" crdsize="C1_dim" sink="true"] - 12 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] - 11 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=false" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="false"] - 10 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 4 [comment="type=crdhold,outer=j,inner=i" label="CrdHold j,i -outer=j,inner=i" color=orange shape=box style=filled type="crdhold" outer="j" inner="i"] - 9 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 8 [comment="type=repeat,index=i,tensor=C,root=false" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="false"] - 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 15 [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"] - 14 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 13 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 18 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=true" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="true"] - 17 -> 16 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 16 -> 3 [label="crd_k" style=dashed type="crd" comment="k"] - 3 -> 0 [label="val" type="val"] - 3 -> 1 [label="crd_out-i" style=dashed type="crd" comment="out-i"] - 3 -> 2 [label="crd_out-j" style=dashed type="crd" comment="out-j"] - 16 -> 12 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 12 -> 11 [label="ref" style=bold type="ref"] - 11 -> 10 [label="crd" style=dashed type="crd" comment=""] - 10 -> 4 [label="crd_i" style=dashed type="crd" comment="i"] - 4 -> 3 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] - 4 -> 3 [label="crd_inner-i" style=dashed type="crd" comment="inner-i"] - 10 -> 9 [label="crd" style=dashed type="crd" comment=""] - 9 -> 8 [label="repsig" style=dotted type="repsig"] - 8 -> 7 [label="ref" style=bold type="ref"] - 7 -> 5 [label="val" type="val"] - 5 -> 3 [label="val" type="val"] - 11 -> 6 [label="ref" style=bold type="ref" comment=""] - 6 -> 5 [label="val" type="val"] - 16 -> 15 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 15 -> 14 [label="crd" style=dashed type="crd" comment=""] - 14 -> 4 [label="crd_j" style=dashed type="crd" comment="j"] - 14 -> 13 [label="crd" style=dashed type="crd" comment=""] - 13 -> 12 [label="repsig" style=dotted type="repsig"] - 15 -> 8 [label="ref" style=bold type="ref" comment=""] - 17 -> 16 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 18 -> 16 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 18 -> 16 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/tensor3_elemadd.gv b/compiler/sam-outputs/dot/tensor3_elemadd.gv deleted file mode 100644 index e00deffd..00000000 --- a/compiler/sam-outputs/dot/tensor3_elemadd.gv +++ /dev/null @@ -1,43 +0,0 @@ -digraph SAM { - comment="X=sss012,B=sss012,C=sss012" - 14 [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"] - 13 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] - 3 [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"] - 11 [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"] - 10 [comment="type=union,index=j" label="union j" color=purple shape=box style=filled type="union" index="j"] - 2 [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=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] - 7 [comment="type=union,index=k" label="union k" color=purple shape=box style=filled type="union" index="k"] - 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*B2_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*B2_dim" sink="true"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 4 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] - 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 9 [comment="type=fiberlookup,index=k,tensor=C,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: C2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="2" format="compressed" src="true" root="false"] - 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"] - 15 [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"] - 14 -> 13 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 13 -> 3 [label="crd" style=dashed type="crd"] - 13 -> 11 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 10 -> 2 [label="crd" style=dashed type="crd"] - 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 -> 1 [label="crd" style=dashed type="crd"] - 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 5 -> 4 [label="val" type="val"] - 4 -> 0 [label="val" type="val"] - 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 6 -> 4 [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"] - 13 -> 12 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 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"] - 14 -> 13 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/tensor3_elemmul.gv b/compiler/sam-outputs/dot/tensor3_elemmul.gv deleted file mode 100644 index 17d59669..00000000 --- a/compiler/sam-outputs/dot/tensor3_elemmul.gv +++ /dev/null @@ -1,49 +0,0 @@ -digraph SAM { - comment="X=sss012,B=sss012,C=sss012" - 16 [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"] - 15 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] - 7 [comment="type=crddrop,outer=i,inner=j" label="CrdDrop i,j" color=orange shape=box style=filled type="crddrop" outer="i" inner="j"] - 3 [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"] - 2 [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"] - 13 [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"] - 12 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] - 8 [comment="type=crddrop,outer=j,inner=k" label="CrdDrop j,k" color=orange shape=box style=filled type="crddrop" outer="j" inner="k"] - 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*B2_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*B2_dim" sink="true"] - 10 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] - 9 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] - 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 11 [comment="type=fiberlookup,index=k,tensor=C,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: C2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="2" format="compressed" src="true" root="false"] - 14 [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"] - 17 [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"] - 16 -> 15 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 15 -> 7 [label="crd_in-i" style=dashed type="crd" comment="in-i"] - 7 -> 3 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"] - 7 -> 2 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"] - 15 -> 13 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 13 -> 12 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 12 -> 8 [label="crd_in-j" style=dashed type="crd" comment="in-j"] - 8 -> 7 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"] - 8 -> 1 [label="crd_inner-k" style=dashed type="crd" comment="inner-k"] - 12 -> 10 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 10 -> 9 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 9 -> 8 [label="crd_in-k" style=dashed type="crd" comment="in-k"] - 9 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 5 -> 4 [label="val" type="val"] - 4 -> 0 [label="val" type="val"] - 9 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 6 -> 4 [label="val" type="val"] - 10 -> 9 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 12 -> 11 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 11 -> 9 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 11 -> 9 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 13 -> 12 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 15 -> 14 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 14 -> 12 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 14 -> 12 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 16 -> 15 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 17 -> 15 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 17 -> 15 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/tensor3_identity.gv b/compiler/sam-outputs/dot/tensor3_identity.gv deleted file mode 100644 index 038c0739..00000000 --- a/compiler/sam-outputs/dot/tensor3_identity.gv +++ /dev/null @@ -1,18 +0,0 @@ -digraph SAM { - comment="X=sss012,B=sss012" - 7 [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"] - 3 [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"] - 6 [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"] - 2 [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"] - 5 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] - 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*B2_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*B2_dim" sink="true"] - 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] - 7 -> 3 [label="crd" style=dashed type="crd" comment=""] - 7 -> 6 [label="ref" style=bold type="ref" comment=""] - 6 -> 2 [label="crd" style=dashed type="crd" comment=""] - 6 -> 5 [label="ref" style=bold type="ref" comment=""] - 5 -> 1 [label="crd" style=dashed type="crd" comment=""] - 5 -> 4 [label="ref" style=bold type="ref" comment=""] - 4 -> 0 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/tensor3_identity_dense.gv b/compiler/sam-outputs/dot/tensor3_identity_dense.gv deleted file mode 100644 index 02224b56..00000000 --- a/compiler/sam-outputs/dot/tensor3_identity_dense.gv +++ /dev/null @@ -1,18 +0,0 @@ -digraph SAM { - comment="X=ddd012,B=ddd012" - 7 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=dense,src=true,root=true" label="FiberLookup i: B0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="dense" src="true" root="true"] - 3 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=dense,sink=true" label="FiberWrite i: X0\ndense" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="X" mode="0" format="dense" sink="true"] - 6 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=dense,src=true,root=false" label="FiberLookup j: B1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="dense" src="true" root="false"] - 2 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=dense,sink=true" label="FiberWrite j: X1\ndense" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="1" format="dense" sink="true"] - 5 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=dense,src=true,root=false" label="FiberLookup k: B2\ndense" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="dense" src="true" root="false"] - 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=dense,sink=true" label="FiberWrite k: X2\ndense" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="dense" sink="true"] - 4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*B2_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*B2_dim" sink="true"] - 7 -> 3 [label="crd" style=dashed type="crd" comment=""] - 7 -> 6 [label="ref" style=bold type="ref" comment=""] - 6 -> 2 [label="crd" style=dashed type="crd" comment=""] - 6 -> 5 [label="ref" style=bold type="ref" comment=""] - 5 -> 1 [label="crd" style=dashed type="crd" comment=""] - 5 -> 4 [label="ref" style=bold type="ref" comment=""] - 4 -> 0 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/tensor3_innerprod.gv b/compiler/sam-outputs/dot/tensor3_innerprod.gv deleted file mode 100644 index 0016bc45..00000000 --- a/compiler/sam-outputs/dot/tensor3_innerprod.gv +++ /dev/null @@ -1,43 +0,0 @@ -digraph SAM { - comment="x=none,B=sss012,C=sss012" - 14 [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"] - 13 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] - 11 [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"] - 10 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] - 8 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] - 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 2 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 1 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1" sink="true"] - 6 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 9 [comment="type=fiberlookup,index=k,tensor=C,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: C2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="2" format="compressed" src="true" root="false"] - 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"] - 15 [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"] - 14 -> 13 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 13 -> 11 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 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 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 5 -> 4 [label="val" type="val"] - 4 -> 3 [label="val" type="val"] - 3 -> 2 [label="val" type="val"] - 2 -> 1 [label="val" type="val"] - 1 -> 0 [label="val" type="val"] - 7 -> 6 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 6 -> 4 [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"] - 13 -> 12 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 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"] - 14 -> 13 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] -} diff --git a/compiler/sam-outputs/dot/tensor3_mttkrp.gv b/compiler/sam-outputs/dot/tensor3_mttkrp.gv deleted file mode 100644 index fb9387b2..00000000 --- a/compiler/sam-outputs/dot/tensor3_mttkrp.gv +++ /dev/null @@ -1,80 +0,0 @@ -digraph SAM { - comment="X=ss01,B=sss012,C=ss01,D=ss01" - 31 [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"] - 30 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 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"] - 29 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 28 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 26 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] - 24 [comment="type=fiberlookup,index=j,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup j: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="0" format="compressed" src="true" root="false"] - 23 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"] - 22 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C0_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*C0_dim" sink="true"] - 21 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 20 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] - 18 [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"] - 17 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 16 [comment="type=repsiggen,index=k" label="RepeatSignalGenerator k" color=cyan3 shape=box style=filled type="repsiggen" index="k"] - 15 [comment="type=repeat,index=k,tensor=D,root=false" label="Repeat k: D" color=cyan2 shape=box style=filled type="repeat" index="k" tensor="D" root="false"] - 14 [comment="type=fiberlookup,index=l,tensor=D,mode=1,format=compressed,src=true,root=false" label="FiberLookup l: D1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="D" mode="1" format="compressed" src="true" root="false"] - 12 [comment="type=intersect,index=l" label="intersect l" color=purple shape=box style=filled type="intersect" index="l"] - 11 [comment="type=repsiggen,index=l" label="RepeatSignalGenerator l" color=cyan3 shape=box style=filled type="repsiggen" index="l"] - 10 [comment="type=repeat,index=l,tensor=C,root=false" label="Repeat l: C" color=cyan2 shape=box style=filled type="repeat" index="l" tensor="C" root="false"] - 8 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 6 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 4 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C0_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C0_dim" sink="true"] - 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 9 [comment="type=arrayvals,tensor=D" label="Array Vals: D" color=green2 shape=box style=filled type="arrayvals" tensor="D"] - 13 [comment="type=fiberlookup,index=l,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup l: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="B" mode="2" format="compressed" src="true" root="false"] - 19 [comment="type=fiberlookup,index=k,tensor=C,mode=1,format=compressed,src=true,root=false" label="FiberLookup k: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="1" format="compressed" src="true" root="false"] - 27 [comment="type=repeat,index=i,tensor=D,root=true" label="Repeat i: D" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="D" root="true"] - 25 [comment="type=fiberlookup,index=j,tensor=D,mode=0,format=compressed,src=true,root=false" label="FiberLookup j: D0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="D" mode="0" format="compressed" src="true" root="false"] - 31 -> 30 [label="crd" style=dashed type="crd" comment=""] - 30 -> 2 [label="crd" style=dashed type="crd"] - 30 -> 29 [label="crd" style=dashed type="crd"] - 29 -> 28 [label="repsig" style=dotted type="repsig"] - 28 -> 26 [label="repsig" style=dotted type="repsig"] - 26 -> 24 [label="ref" style=bold type="ref"] - 24 -> 23 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 23 -> 22 [label="crd" style=dashed type="crd"] - 22 -> 1 [label="crd" style=dashed type="crd"] - 22 -> 21 [label="crd" style=dashed type="crd"] - 21 -> 20 [label="repsig" style=dotted type="repsig"] - 20 -> 18 [label="ref" style=bold type="ref"] - 18 -> 17 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 17 -> 16 [label="crd" style=dashed type="crd"] - 16 -> 15 [label="repsig" style=dotted type="repsig"] - 15 -> 14 [label="ref" style=bold type="ref"] - 14 -> 12 [label="crd_in-D" style=dashed type="crd" comment="in-D"] - 12 -> 11 [label="crd" style=dashed type="crd"] - 11 -> 10 [label="repsig" style=dotted type="repsig"] - 10 -> 8 [label="ref" style=bold type="ref"] - 8 -> 6 [label="val" type="val"] - 6 -> 5 [label="val" type="val"] - 5 -> 4 [label="val" type="val"] - 4 -> 3 [label="val" type="val"] - 3 -> 0 [label="val" type="val"] - 12 -> 7 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 7 -> 6 [label="val" type="val"] - 12 -> 9 [label="ref_out-D" style=bold type="ref" comment="out-D"] - 9 -> 5 [label="val" type="val"] - 14 -> 12 [label="ref_in-D" style=bold type="ref" comment="in-D"] - 17 -> 13 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 13 -> 12 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 13 -> 12 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 17 -> 10 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 18 -> 17 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 23 -> 19 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 19 -> 17 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 19 -> 17 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 23 -> 15 [label="ref_out-D" style=bold type="ref" comment="out-D"] - 24 -> 23 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 28 -> 27 [label="repsig" style=dotted type="repsig"] - 27 -> 25 [label="ref" style=bold type="ref"] - 25 -> 23 [label="crd_in-D" style=dashed type="crd" comment="in-D"] - 25 -> 23 [label="ref_in-D" style=bold type="ref" comment="in-D"] - 31 -> 20 [label="ref" style=bold type="ref" comment=""] -} diff --git a/compiler/sam-outputs/dot/tensor3_ttm.gv b/compiler/sam-outputs/dot/tensor3_ttm.gv deleted file mode 100644 index acf4d70b..00000000 --- a/compiler/sam-outputs/dot/tensor3_ttm.gv +++ /dev/null @@ -1,54 +0,0 @@ -digraph SAM { - comment="X=sss012,B=sss012,C=ss01" - 22 [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"] - 21 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 3 [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"] - 20 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 19 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] - 15 [comment="type=repeat,index=j,tensor=C,root=false" label="Repeat j: C" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="C" root="false"] - 14 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] - 13 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 1 [comment="type=fiberwrite,index=k,tensor=X,mode=2,format=compressed,segsize=B0_dim*B1_dim+1,crdsize=B0_dim*B1_dim*C0_dim,sink=true" label="FiberWrite k: X2\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="k" tensor="X" mode="2" format="compressed" segsize="B0_dim*B1_dim+1" crdsize="B0_dim*B1_dim*C0_dim" sink="true"] - 12 [comment="type=repsiggen,index=k" label="RepeatSignalGenerator k" color=cyan3 shape=box style=filled type="repsiggen" index="k"] - 11 [comment="type=repeat,index=k,tensor=B,root=false" label="Repeat k: B" color=cyan2 shape=box style=filled type="repeat" index="k" tensor="B" root="false"] - 9 [comment="type=fiberlookup,index=l,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup l: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="B" mode="2" format="compressed" src="true" root="false"] - 8 [comment="type=intersect,index=l" label="intersect l" color=purple shape=box style=filled type="intersect" index="l"] - 6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 4 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim*C0_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*C0_dim" sink="true"] - 7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"] - 10 [comment="type=fiberlookup,index=l,tensor=C,mode=1,format=compressed,src=true,root=false" label="FiberLookup l: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="C" mode="1" format="compressed" src="true" root="false"] - 18 [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"] - 17 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 2 [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"] - 16 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 22 -> 21 [label="crd" style=dashed type="crd" comment=""] - 21 -> 3 [label="crd" style=dashed type="crd"] - 21 -> 20 [label="crd" style=dashed type="crd"] - 20 -> 19 [label="repsig" style=dotted type="repsig"] - 19 -> 15 [label="ref" style=bold type="ref"] - 15 -> 14 [label="ref" style=bold type="ref"] - 14 -> 13 [label="crd" style=dashed type="crd" comment=""] - 13 -> 1 [label="crd" style=dashed type="crd"] - 13 -> 12 [label="crd" style=dashed type="crd"] - 12 -> 11 [label="repsig" style=dotted type="repsig"] - 11 -> 9 [label="ref" style=bold type="ref"] - 9 -> 8 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 8 -> 6 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 6 -> 5 [label="val" type="val"] - 5 -> 4 [label="val" type="val"] - 4 -> 0 [label="val" type="val"] - 8 -> 7 [label="ref_out-C" style=bold type="ref" comment="out-C"] - 7 -> 5 [label="val" type="val"] - 9 -> 8 [label="ref_in-B" style=bold type="ref" comment="in-B"] - 14 -> 10 [label="ref" style=bold type="ref" comment=""] - 10 -> 8 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 10 -> 8 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 22 -> 18 [label="ref" style=bold type="ref" comment=""] - 18 -> 17 [label="crd" style=dashed type="crd" comment=""] - 17 -> 2 [label="crd" style=dashed type="crd"] - 17 -> 16 [label="crd" style=dashed type="crd"] - 16 -> 15 [label="repsig" style=dotted type="repsig"] - 18 -> 11 [label="ref" style=bold type="ref" comment=""] -} diff --git a/compiler/sam-outputs/dot/tensor3_ttv.gv b/compiler/sam-outputs/dot/tensor3_ttv.gv deleted file mode 100644 index 959f9fe7..00000000 --- a/compiler/sam-outputs/dot/tensor3_ttv.gv +++ /dev/null @@ -1,43 +0,0 @@ -digraph SAM { - comment="X=ss01,B=sss012,c=s0" - 17 [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"] - 16 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 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"] - 15 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 14 [comment="type=repeat,index=i,tensor=c,root=true" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="true"] - 10 [comment="type=repeat,index=j,tensor=c,root=false" label="Repeat j: c" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="c" root="false"] - 9 [comment="type=fiberlookup,index=k,tensor=c,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="c" mode="0" format="compressed" src="true" root="false"] - 7 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"] - 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"] - 6 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] - 13 [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"] - 12 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 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"] - 11 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"] - 8 [comment="type=fiberlookup,index=k,tensor=B,mode=2,format=compressed,src=true,root=false" label="FiberLookup k: B2\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="2" format="compressed" src="true" root="false"] - 17 -> 16 [label="crd" style=dashed type="crd" comment=""] - 16 -> 2 [label="crd" style=dashed type="crd"] - 16 -> 15 [label="crd" style=dashed type="crd"] - 15 -> 14 [label="repsig" style=dotted type="repsig"] - 14 -> 10 [label="ref" style=bold type="ref"] - 10 -> 9 [label="ref" style=bold type="ref"] - 9 -> 7 [label="crd_in-c" style=dashed type="crd" comment="in-c"] - 7 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 5 -> 4 [label="val" type="val"] - 4 -> 3 [label="val" type="val"] - 3 -> 0 [label="val" type="val"] - 7 -> 6 [label="ref_out-c" style=bold type="ref" comment="out-c"] - 6 -> 4 [label="val" type="val"] - 9 -> 7 [label="ref_in-c" style=bold type="ref" comment="in-c"] - 17 -> 13 [label="ref" style=bold type="ref" comment=""] - 13 -> 12 [label="crd" style=dashed type="crd" comment=""] - 12 -> 1 [label="crd" style=dashed type="crd"] - 12 -> 11 [label="crd" style=dashed type="crd"] - 11 -> 10 [label="repsig" style=dotted type="repsig"] - 13 -> 8 [label="ref" style=bold type="ref" comment=""] - 8 -> 7 [label="crd_in-B" style=dashed type="crd" comment="in-B"] - 8 -> 7 [label="ref_in-B" style=bold type="ref" comment="in-B"] -} diff --git a/compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv b/compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv deleted file mode 100644 index f29b24e5..00000000 --- a/compiler/sam-outputs/dot/vec_ds_compression_WRONG.gv +++ /dev/null @@ -1,10 +0,0 @@ -digraph SAM { - comment="x=s0,b=d0" - 3 [comment="type=fiberlookup,index=i,tensor=b,mode=0,format=dense,src=true,root=true" label="FiberLookup i: b0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="b" mode="0" format="dense" src="true" root="true"] - 1 [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"] - 2 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] - 3 -> 1 [label="crd" style=dashed type="crd" comment=""] - 3 -> 2 [label="ref" style=bold type="ref" comment=""] - 2 -> 0 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/vec_elemadd.gv b/compiler/sam-outputs/dot/vec_elemadd.gv deleted file mode 100644 index 142dfa8d..00000000 --- a/compiler/sam-outputs/dot/vec_elemadd.gv +++ /dev/null @@ -1,21 +0,0 @@ -digraph SAM { - comment="x=s0,b=s0,c=s0" - 6 [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"] - 5 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"] - 1 [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"] - 3 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] - 2 [comment="type=add,sub=0" label="Add" color=brown shape=box style=filled type="add" sub="0"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] - 4 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] - 7 [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"] - 6 -> 5 [label="crd_in-b" style=dashed type="crd" comment="in-b"] - 5 -> 1 [label="crd" style=dashed type="crd"] - 5 -> 3 [label="ref_out-b" style=bold type="ref" comment="out-b"] - 3 -> 2 [label="val" type="val"] - 2 -> 0 [label="val" type="val"] - 5 -> 4 [label="ref_out-c" style=bold type="ref" comment="out-c"] - 4 -> 2 [label="val" type="val"] - 6 -> 5 [label="ref_in-b" style=bold type="ref" comment="in-b"] - 7 -> 5 [label="crd_in-c" style=dashed type="crd" comment="in-c"] - 7 -> 5 [label="ref_in-c" style=bold type="ref" comment="in-c"] -} diff --git a/compiler/sam-outputs/dot/vec_elemmul.gv b/compiler/sam-outputs/dot/vec_elemmul.gv deleted file mode 100644 index 1411804f..00000000 --- a/compiler/sam-outputs/dot/vec_elemmul.gv +++ /dev/null @@ -1,21 +0,0 @@ -digraph SAM { - comment="x=s0,b=s0,c=s0" - 6 [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"] - 5 [comment="type=intersect,index=i" label="intersect i" color=purple shape=box style=filled type="intersect" index="i"] - 1 [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"] - 3 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] - 2 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] - 4 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] - 7 [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"] - 6 -> 5 [label="crd_in-b" style=dashed type="crd" comment="in-b"] - 5 -> 1 [label="crd" style=dashed type="crd"] - 5 -> 3 [label="ref_out-b" style=bold type="ref" comment="out-b"] - 3 -> 2 [label="val" type="val"] - 2 -> 0 [label="val" type="val"] - 5 -> 4 [label="ref_out-c" style=bold type="ref" comment="out-c"] - 4 -> 2 [label="val" type="val"] - 6 -> 5 [label="ref_in-b" style=bold type="ref" comment="in-b"] - 7 -> 5 [label="crd_in-c" style=dashed type="crd" comment="in-c"] - 7 -> 5 [label="ref_in-c" style=bold type="ref" comment="in-c"] -} diff --git a/compiler/sam-outputs/dot/vec_identity.gv b/compiler/sam-outputs/dot/vec_identity.gv deleted file mode 100644 index b1937f3f..00000000 --- a/compiler/sam-outputs/dot/vec_identity.gv +++ /dev/null @@ -1,10 +0,0 @@ -digraph SAM { - comment="x=s0,b=s0" - 3 [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"] - 1 [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"] - 2 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] - 3 -> 1 [label="crd" style=dashed type="crd" comment=""] - 3 -> 2 [label="ref" style=bold type="ref" comment=""] - 2 -> 0 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/vec_scalar_mul.gv b/compiler/sam-outputs/dot/vec_scalar_mul.gv deleted file mode 100644 index e0056a50..00000000 --- a/compiler/sam-outputs/dot/vec_scalar_mul.gv +++ /dev/null @@ -1,21 +0,0 @@ -digraph SAM { - comment="x=s0,b=none,c=s0" - 8 [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"] - 7 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 1 [comment="type=fiberwrite,index=i,tensor=x,mode=0,format=compressed,segsize=2,crdsize=c0_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="c0_dim" sink="true"] - 6 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 5 [comment="type=repeat,index=i,tensor=b,root=true" label="Repeat i: b" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="b" root="true"] - 3 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] - 2 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*c0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*c0_dim" sink="true"] - 4 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"] - 8 -> 7 [label="crd" style=dashed type="crd" comment=""] - 7 -> 1 [label="crd" style=dashed type="crd"] - 7 -> 6 [label="crd" style=dashed type="crd"] - 6 -> 5 [label="repsig" style=dotted type="repsig"] - 5 -> 3 [label="ref" style=bold type="ref"] - 3 -> 2 [label="val" type="val"] - 2 -> 0 [label="val" type="val"] - 8 -> 4 [label="ref" style=bold type="ref" comment=""] - 4 -> 2 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv b/compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv deleted file mode 100644 index 9a2974ff..00000000 --- a/compiler/sam-outputs/dot/vec_sd_compression_WRONG.gv +++ /dev/null @@ -1,10 +0,0 @@ -digraph SAM { - comment="x=d0,b=s0" - 3 [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"] - 1 [comment="type=fiberwrite,index=i,tensor=x,mode=0,format=dense,sink=true" label="FiberWrite i: x0\ndense" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="x" mode="0" format="dense" sink="true"] - 2 [comment="type=arrayvals,tensor=b" label="Array Vals: b" color=green2 shape=box style=filled type="arrayvals" tensor="b"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*b0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*b0_dim" sink="true"] - 3 -> 1 [label="crd" style=dashed type="crd" comment=""] - 3 -> 2 [label="ref" style=bold type="ref" comment=""] - 2 -> 0 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/dot/vec_spacc_simple.gv b/compiler/sam-outputs/dot/vec_spacc_simple.gv deleted file mode 100644 index 24e89e96..00000000 --- a/compiler/sam-outputs/dot/vec_spacc_simple.gv +++ /dev/null @@ -1,17 +0,0 @@ -digraph SAM { - comment="x=s0,B=ss01" - 5 [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"] - 2 [comment="type=spaccumulator,order=1,in0=j" label="SparseAccumulator 1 -0=j " color=brown shape=box style=filled type="spaccumulator" order="1" in0="j"] - 0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B1_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B1_dim" sink="true"] - 1 [comment="type=fiberwrite,index=j,tensor=x,mode=0,format=compressed,segsize=2,crdsize=B1_dim,sink=true" label="FiberWrite j: x0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="x" mode="0" format="compressed" segsize="2" crdsize="B1_dim" sink="true"] - 4 [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"] - 3 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 5 -> 2 [label="crd_i" style=dashed type="crd" comment="i"] - 2 -> 0 [label="val" type="val"] - 2 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] - 5 -> 4 [label="ref" style=bold type="ref" comment=""] - 4 -> 2 [label="crd_j" style=dashed type="crd" comment="j"] - 4 -> 3 [label="ref" style=bold type="ref" comment=""] - 3 -> 2 [label="val" type="val"] -} diff --git a/compiler/sam-outputs/onyx-dot/matmul_ikj.gv b/compiler/sam-outputs/onyx-dot/matmul_ikj.gv deleted file mode 100644 index 6fbfbc85..00000000 --- a/compiler/sam-outputs/onyx-dot/matmul_ikj.gv +++ /dev/null @@ -1,44 +0,0 @@ -digraph SAM { - comment="X=ss01,B=ss01,C=ss01" - 20 [comment="type=vectorreducer,index=j" label="VectorReducer j" color=brown shape=box style=filled type="vectorreducer" accum_index="j"] - 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] - 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] - 19 [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"] - 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] - 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"] - 17 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] - 16 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] - 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] - 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] - 9 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] - 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] - 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"] - 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"] - 19 -> 18 [label="crd" style=dashed type="crd" comment=""] - 18 -> 17 [label="crd" style=dashed type="crd" comment=""] - 17 -> 16 [label="repsig" style=dotted type="repsig"] - 16 -> 15 [label="ref" style=bold type="ref"] - 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] - 13 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] - 9 -> 7 [label="ref" style=bold type="ref"] - 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=""] - 19 -> 2 [label="crd_i" style=dashed type="crd" comment="i"] - 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=""] - 8 -> 6 [label="val" type="val"] - 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] - 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"] - 20 -> 0 [label="final_vals" type="val"] - 20 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] -} From 892cda632f7b7158638365c1f0dc4df2f9d34b53 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Nov 2023 20:24:23 -0800 Subject: [PATCH 7/9] Add the graph --- compiler/sam-outputs/onyx-dot/matmul_ikj.gv | 44 +++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 compiler/sam-outputs/onyx-dot/matmul_ikj.gv diff --git a/compiler/sam-outputs/onyx-dot/matmul_ikj.gv b/compiler/sam-outputs/onyx-dot/matmul_ikj.gv new file mode 100644 index 00000000..6fbfbc85 --- /dev/null +++ b/compiler/sam-outputs/onyx-dot/matmul_ikj.gv @@ -0,0 +1,44 @@ +digraph SAM { + comment="X=ss01,B=ss01,C=ss01" + 20 [comment="type=vectorreducer,index=j" label="VectorReducer j" color=brown shape=box style=filled type="vectorreducer" accum_index="j"] + 0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"] + 1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"] + 19 [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"] + 18 [comment="type=broadcast" shape=point style=invis type="broadcast"] + 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"] + 17 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"] + 16 [comment="type=repeat,index=i,tensor=C,root=true" label="Repeat i: C" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="C" root="true"] + 15 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"] + 13 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"] + 9 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"] + 7 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"] + 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"] + 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"] + 19 -> 18 [label="crd" style=dashed type="crd" comment=""] + 18 -> 17 [label="crd" style=dashed type="crd" comment=""] + 17 -> 16 [label="repsig" style=dotted type="repsig"] + 16 -> 15 [label="ref" style=bold type="ref"] + 15 -> 13 [label="crd_in-C" style=dashed type="crd" comment="in-C"] + 13 -> 9 [label="ref_out-B" style=bold type="ref" comment="out-B"] + 9 -> 7 [label="ref" style=bold type="ref"] + 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=""] + 19 -> 2 [label="crd_i" style=dashed type="crd" comment="i"] + 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=""] + 8 -> 6 [label="val" type="val"] + 15 -> 13 [label="ref_in-C" style=bold type="ref" comment="in-C"] + 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"] + 20 -> 0 [label="final_vals" type="val"] + 20 -> 1 [label="crd_out-j" style=dashed type="crd" comment="out-j"] +} From 820d6b8c0c85d84888783897847cd00c1abf99ef Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Nov 2023 08:53:25 -0800 Subject: [PATCH 8/9] Roll back accumulator.py; owhsu to merge later --- sam/sim/src/accumulator.py | 677 +++++++++++++------------------------ 1 file changed, 238 insertions(+), 439 deletions(-) diff --git a/sam/sim/src/accumulator.py b/sam/sim/src/accumulator.py index 83b3acef..a3500369 100644 --- a/sam/sim/src/accumulator.py +++ b/sam/sim/src/accumulator.py @@ -1,6 +1,5 @@ -import enum - from .base import * +from .crd_manager import CrdPtConverter class Reduce(Primitive): @@ -66,7 +65,7 @@ def update(self): if (self.backpressure_en and self.check_backpressure()) or not self.backpressure_en: if self.backpressure_en: self.data_valid = True - if len(self.in_val) > 0: + if (len(self.in_val) > 0): self.block_start = False curr_in_val = "" @@ -152,6 +151,7 @@ def return_statistics(self): stats_dict = {} return stats_dict + class SparseCrdPtAccumulator1(Primitive): def __init__(self, maxdim=100, valtype=float, fifos=None, **kwargs): super().__init__(**kwargs) @@ -382,33 +382,32 @@ def return_hits(self): return i, cnt_gt_zero, cnt_total, total_sum -# NEW VERSION: Accumulation into a vector +# Accumulation into a vector class SparseAccumulator1(Primitive): def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, depth=1, **kwargs): super().__init__(**kwargs) - self.kwargs = kwargs - self.maxdim = maxdim - self.valtype = valtype - self.last_level = last_level - # Boolean flag for whether to output stop tokens on the output val stream - self.val_stkn = val_stkn - - self.in_crd1 = [] - self.in_crd0 = [] + self.in_outer_crdpt = [] + self.in_inner_crdpt = [] self.in_val = [] + self.crdpt_spacc = SparseCrdPtAccumulator1(maxdim=maxdim, valtype=valtype, debug=self.debug, + statisics=self.get_stats, name="", back_en=False) + self.crdpt_converter = CrdPtConverter(last_level=last_level, debug=self.debug, + statisics=self.get_stats, name="", back_en=False) - self.storage = {} + self.crdpt_spacc_out_val = [] - self.curr_crd1 = None - self.curr_crd0 = None + self.curr_outer_crd = None + self.curr_inner_crd = None self.curr_val = None - self.curr_in_crd0 = None - self.curr_in_val = None + self.outer_crdpt = [] + self.inner_crdpt = [] + + self.val_stkn = val_stkn if self.get_stats: - self.in_crd0_fifo = 0 - self.in_crd1_fifo = 0 + self.in_outer_crd_pt_fifo = 0 + self.in_inner_crd_pt_fifo = 0 self.in_val_fifo = 0 if self.backpressure_en: @@ -419,14 +418,9 @@ def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, d self.fifo_avail_outer = True self.fifo_avail_val = True - self.states = enum.Enum('States', ['READY', 'ACC', 'WR', 'DONE']) - self.curr_state = self.states.READY - self.next_state = self.states.READY - self.writeout = False - self.writeout_storage = [] - - self.seen_done = False - self.crd1_stkn = None + self.temp_maxdim = maxdim + self.temp_valtype = valtype + self.temp_last_level = last_level def check_backpressure(self): if self.backpressure_en: @@ -461,185 +455,169 @@ def add_child(self, child=None, branch=""): def update_ready(self): if self.backpressure_en: - self.fifo_avail_outer = not (len(self.in_crd1) > self.depth) - self.fifo_avail_inner = not (len(self.in_crd0) > self.depth) - self.fifo_avail_val = not (len(self.in_val) > self.depth) - - def ACC_body(self): - self.curr_in_crd0 = self.in_crd0.pop(0) - self.curr_in_val = self.in_val.pop(0) - # In accumulation, accumulate into memory - if is_nc_tkn(self.curr_in_val, self.valtype): - assert is_nc_tkn(self.curr_in_crd0, int), "The inner coordinate must be a non-control token" - if self.curr_in_crd0 in self.storage.keys(): - # Coordinate is in storage, so accumulate - self.storage[self.curr_in_crd0] += self.curr_in_val + if len(self.in_inner_crdpt) > self.depth: + self.fifo_avail_inner = False else: - # Coordinate is not in storage, so add it in - self.storage[self.curr_in_crd0] = self.curr_in_val - self.next_state = self.states.ACC - # In accumulation, if you see a stop token in the inner level, go back to start - elif is_stkn(self.curr_in_crd0): - assert is_stkn(self.curr_in_val) and stkn_order(self.curr_in_crd0) == stkn_order(self.curr_in_val), \ - "Stop tokens must match for inner crd: " + str(self.curr_in_crd0) + " and val: " + str(self.curr_in_val) - self.next_state = self.states.READY - elif is_dtkn(self.curr_in_crd0): - assert False, "Shouldn't have done token for coordinates if in accumulate (ACC) state" - # Do nothing - else: - self.next_state = self.states.ACC + self.fifo_avail_inner = True + if len(self.in_outer_crdpt) > self.depth: + self.fifo_avail_outer = False + else: + self.fifo_avail_outer = True + if len(self.in_val) > self.depth: + self.fifo_avail_val = False + else: + self.fifo_avail_val = True def update(self): self.update_done() self.update_ready() - - # Print out debugging statements - if self.debug: - print("========== " + self.name + " SPACC1 (NEW) ==========") - print("Inputs: ", self.in_crd1, self.in_crd0, self.in_val) - print("Temps: ", self.curr_crd1, self.crd1_stkn, self.curr_in_crd0, self.curr_in_val) - print("Store/Wr: ", self.storage, self.writeout_storage, self.writeout) - print("Outputs: ", self.curr_crd0, self.curr_val) - print("State: ", self.curr_state) - if self.backpressure_en: self.data_valid = False if (self.backpressure_en and self.check_backpressure()) or not self.backpressure_en: - # Update state of state machine to next state - self.curr_state = self.next_state + if self.backpressure_en: + self.data_valid = True + if self.debug: + print(self.in_outer_crdpt, self.in_inner_crdpt, self.in_val) + print(self.crdpt_spacc.print_debug()) + print(self.crdpt_converter.print_debug()) + if self.done: + f1, f2, f3 = self.crdpt_spacc.return_fifo() + f4, f5 = self.crdpt_converter.return_fifo() + self.crdpt_spacc = SparseCrdPtAccumulator1(maxdim=self.temp_maxdim, + valtype=self.temp_valtype, fifos=[f1, f2, f3]) + self.crdpt_converter = CrdPtConverter(last_level=self.temp_last_level, fifos=[f4, f5]) # FIXME: (owhsu) self.data_ready not defined in init if self.backpressure_en: - self.data_valid = True self.data_ready = True - - if self.done: - # Reset things - # fch1, fch2 = self.crdhold_01.return_fifo() - # fs1, fs2, fs3 = self.spacc1_no_crdhold.return_fifo() - # fsd1 = self.stkndrop_crd1.return_fifo() - # fsd2 = self.stkndrop_crd0.return_fifo() - # fsd3 = self.stkndrop_val.return_fifo() - # self.crdhold_01 = CrdHold(fifos=[fch1, fch2], **self.kwargs) - # - # self.spacc1_no_crdhold = SpAcc1NoCrdHold(maxdim=self.maxdim, valtype=self.valtype, - # name=self.name + "_no_crdhold", - # fifos=[fs1, fs2, fs3], **self.kwargs) - # self.stkndrop_crd1 = StknDrop(fifos=[fsd1], **self.kwargs) - # self.stkndrop_crd0 = StknDrop(fifos=[fsd2], **self.kwargs) - # self.stkndrop_val = StknDrop(fifos=[fsd3], **self.kwargs) - pass - - # Set when block counts should start - if len(self.in_crd1) > 0 or len(self.in_crd0) > 0 or len(self.in_val) > 0: + if len(self.in_outer_crdpt) > 0 or len(self.in_inner_crdpt) > 0: self.block_start = False - # Store block statistics if asked to be reported + # What to do for drop tokens? if self.get_stats: - # What to do for drop tokens? - pass - - # Begin state machine computation - if self.curr_state == self.states.READY: - if len(self.in_crd1) > 0: - self.curr_crd1 = self.in_crd1.pop(0) - if is_nc_tkn(self.curr_crd1): - if len(self.in_crd0) > 0 and len(self.in_val) > 0: - self.ACC_body() - else: - self.next_state = self.states.ACC - elif is_stkn(self.curr_crd1): - # TODO: what to do when we want to writeout but writeout isn't done - - # Set writeout to be true, move over storage, and clear it. - self.crd1_stkn = self.curr_crd1 - self.writeout = True - self.writeout_storage = [item for item in sorted(self.storage.items())] - self.storage = {} - self.next_state = self.states.READY - elif is_dtkn(self.curr_crd1): - self.seen_done = True - if self.writeout: - self.next_state = self.states.WR - else: - self.next_state = self.states.DONE - else: - assert False, "Cannot have a coordinate token of this type: " + str(self.curr_crd1) - # Handle accumulation into storage - elif self.curr_state == self.states.ACC: - if len(self.in_crd0) > 0 and len(self.in_val) > 0: - self.ACC_body() - # Finish writeout and then be done. - elif self.curr_state == self.states.WR: - if not self.writeout: - self.next_state = self.states.DONE - else: - self.next_state = self.states.WR - # See a done signal AND writeout is done - # Stay done until reset - elif self.curr_state == self.states.DONE: - self.done = True - self.next_state = self.states.DONE - # Default to the current state - else: - self.next_state = self.curr_state - - # Writeout is true, so writeout the current values for storage - if self.writeout: - # Writeout is done when there are no elements left - if len(self.writeout_storage) == 0: - self.writeout = False - assert self.crd1_stkn is not None, "The current writeout stop token should not be None" - self.curr_crd0 = self.crd1_stkn - self.curr_val = self.crd1_stkn + self.in_outer_crd_pt_fifo = max(self.in_outer_crd_pt_fifo, len(self.in_outer_crdpt)) + self.in_inner_crd_pt_fifo = max(self.in_inner_crd_pt_fifo, len(self.in_inner_crdpt)) + self.in_val_fifo = max(self.in_val_fifo, len(self.in_val)) + + if len(self.in_outer_crdpt) > 0: + self.crdpt_spacc.set_outer_crdpt(self.in_outer_crdpt.pop(0)) + + if len(self.in_inner_crdpt) > 0: + self.crdpt_spacc.set_inner_crdpt(self.in_inner_crdpt.pop(0)) + + if len(self.in_val) > 0: + self.crdpt_spacc.set_val(self.in_val.pop(0)) + + self.crdpt_spacc.update() + print(">>>>>>>>>>>>SPACC:", self.crdpt_spacc.out_outer_crdpt(), self.crdpt_spacc.out_inner_crdpt()) + self.crdpt_converter.set_outer_crdpt(self.crdpt_spacc.out_outer_crdpt()) + self.crdpt_converter.set_inner_crdpt(self.crdpt_spacc.out_inner_crdpt()) + + if self.crdpt_spacc.out_val() != '': + self.crdpt_spacc_out_val.append(self.crdpt_spacc.out_val()) + + self.crdpt_converter.update() + self.curr_outer_crd = self.crdpt_converter.out_crd_outer() + self.curr_inner_crd = self.crdpt_converter.out_crd_inner() + + if self.val_stkn: + self.curr_val = self.crdpt_spacc_out_val.pop(0) if isinstance(self.curr_inner_crd, int) and \ + len(self.crdpt_spacc_out_val) > 0 else self.curr_inner_crd else: - curr_writeout_elem = self.writeout_storage.pop(0) - self.curr_val = curr_writeout_elem[1] - self.curr_crd0 = curr_writeout_elem[0] - elif self.done: - self.curr_val = 'D' - self.curr_crd0 = 'D' - else: - self.curr_val = "" - self.curr_crd0 = "" + self.curr_val = self.crdpt_spacc_out_val.pop(0) if len(self.crdpt_spacc_out_val) > 0 else '' + + if self.debug: + print(self.in_val) - # Update the current state - self.curr_state = self.next_state + self.done = self.crdpt_spacc.out_done() and self.crdpt_converter.out_done() if self.debug: - print(self.in_crd1, self.in_crd0, self.in_val) - print(self.curr_crd1, self.curr_crd0, self.curr_val) + print("Vals: ", self.in_val, "\n Done:", self.done, + "\n SpCrdPt Accum Done:", self.crdpt_spacc.out_done(), + "\t CrdPtConverter Done:", self.crdpt_converter.out_done() + ) - def set_in_crd0(self, crd, parent=None): - if crd != '' and crd is not None: - self.in_crd0.append(crd) + def set_inner_crdpt(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_inner_crdpt.append(crdpt) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_inner) - def set_in_crd1(self, crd, parent=None): - if crd != '' and crd is not None: - self.in_crd1.append(crd) + def set_outer_crdpt(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_outer_crdpt.append(crdpt) + if self.backpressure_en: + parent.set_backpressure(self.fifo_avail_outer) + + def crd_in_inner(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_inner_crdpt.append(crdpt) + if self.backpressure_en: + parent.set_backpressure(self.fifo_avail_inner) + + def crd_in_outer(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_outer_crdpt.append(crdpt) + if self.backpressure_en: + parent.set_backpressure(self.fifo_avail_outer) + + def set_crd_inner(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_inner_crdpt.append(crdpt) + if self.backpressure_en: + parent.set_backpressure(self.fifo_avail_inner) + + def set_crd_outer(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in_outer_crdpt.append(crdpt) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_outer) def set_val(self, val, parent=None): + assert not is_stkn(val), 'Values associated with points should not have stop tokens' if val != '' and val is not None: self.in_val.append(val) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_val) - def out_crd0(self): + def out_outer_crd(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_crd0 + return self.curr_outer_crd + + def out_inner_crd(self): + if (self.backpressure_en and self.data_valid) or not self.backpressure_en: + return self.curr_inner_crd def out_val(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: return self.curr_val + def out_crd_outer(self): + if (self.backpressure_en and self.data_valid) or not self.backpressure_en: + return self.curr_outer_crd + + def out_crd_inner(self): + if (self.backpressure_en and self.data_valid) or not self.backpressure_en: + return self.curr_inner_crd + def return_statistics(self): if self.get_stats: stats_dict = {} - # TODO: Finish adding in other statistics + stats_dict["in_outer_fifo"] = self.in_outer_crd_pt_fifo + stats_dict["in_inner_fifo"] = self.in_inner_crd_pt_fifo + stats_dict["in_val_fifo"] = self.in_val_fifo + hits_info = self.crdpt_spacc.return_hits() + stats_dict["max_hits"] = hits_info[0] + stats_dict["hits_gt_one"] = hits_info[1] + stats_dict["total_elems"] = hits_info[2] + stats_dict["rmw_ops"] = hits_info[3] + stats_dict.update(self.crdpt_spacc.return_statistics()) stats_dict.update(super().return_statistics()) else: stats_dict = {} @@ -648,6 +626,7 @@ def return_statistics(self): def print_fifos(self): print("Spaccumulator: None available") + class SparseCrdPtAccumulator2(Primitive): def __init__(self, maxdim=100, valtype=float, **kwargs): super().__init__(**kwargs) @@ -827,57 +806,42 @@ def return_statistics(self): return stats_dict -# NEW VERSION: Accumulation into a matrix +# Accumulation into a matrix (2D) class SparseAccumulator2(Primitive): def __init__(self, maxdim=100, valtype=float, last_level=True, val_stkn=False, depth=1, **kwargs): super().__init__(**kwargs) - self.kwargs = kwargs - self.maxdim = maxdim - self.valtype = valtype - self.last_level = last_level - # Boolean flag for whether to output stop tokens on the output val stream - self.val_stkn = val_stkn - - self.in_crd2 = [] - self.in_crd1 = [] - self.in_crd0 = [] + self.in1_crdpt = [] + self.in0_crdpt = [] self.in_val = [] - self.storage = {} + self.crdpt_spacc = SparseCrdPtAccumulator2(maxdim=maxdim, valtype=valtype, **kwargs) + self.crdpt_converter = CrdPtConverter(last_level=True, **kwargs) - self.curr_crd2 = None - self.curr_crd1 = None - self.curr_crd0 = None - self.curr_val = None - - self.curr_in_crd1 = None - self.curr_in_crd0 = None - self.curr_in_val = None + self.crdpt_spacc_out_val = [] - self.states = enum.Enum('States', ['READY', 'ACC1', 'ACC0', 'WR', 'DONE']) - self.curr_state = self.states.READY - self.next_state = self.states.READY - self.writeout0 = False - self.writeout1 = False - self.writeout_storage1 = [] - self.writeout_storage0 = [] + self.curr_1_crd = None + self.curr_0_crd = None + self.curr_val = None - self.seen_done = False - self.crd2_stkn = None + self.outer_crdpt = [] + self.inner_crdpt = [] + self.val_stkn = val_stkn if self.get_stats: - self.in_crd0_fifo = 0 - self.in_crd1_fifo = 0 - self.in_val_fifo = 0 + self.in1_fifo = 0 + self.in0_fifo = 0 + self.inval_fifo = 0 if self.backpressure_en: self.ready_backpressure = True self.data_valid = True self.depth = depth - self.fifo_avail_2 = True - self.fifo_avail_1 = True - self.fifo_avail_0 = True + self.fifo_avail_inner = True + self.fifo_avail_outer = True self.fifo_avail_val = True + self.temp_maxdim = maxdim + self.temp_valtype = valtype + self.temp_last_level = last_level def check_backpressure(self): if self.backpressure_en: @@ -890,20 +854,6 @@ def set_backpressure(self, backpressure): if not backpressure: self.ready_backpressure = False - # FIXME: (owhsu) This code is unreachable - def fifo_available(self, br=""): - assert False - if self.backpressure_en: - if br == "inner": - # and len(self.in_inner_crdpt) > self.depth: - return self.fifo_avail_inner - if br == "outer": # and len(self.in_outer_crdpt) > self.depth: - return self.fifo_avail_outer # return False - if br == "val": # and len(self.in_val) > self.depth: - return self.fifo_avail_val # return False - # return True - return True - def add_child(self, child=None, branch=""): if self.backpressure_en: if child is not None: @@ -912,261 +862,110 @@ def add_child(self, child=None, branch=""): def update_ready(self): if self.backpressure_en: - self.fifo_avail_outer = not (len(self.in_crd1) > self.depth) - self.fifo_avail_inner = not (len(self.in_crd0) > self.depth) - self.fifo_avail_val = not (len(self.in_val) > self.depth) - - def print_debug(self): - print("========== " + self.name + " SPACC2 (NEW) ==========") - print("Inputs: ", self.in_crd2, self.in_crd1, self.in_crd0, self.in_val) - print("Temps: ", self.curr_crd2, self.crd2_stkn, self.curr_in_crd1, self.curr_in_crd0, self.curr_in_val) - print("Store/Wr: ", self.storage, self.writeout_storage1, self.writeout_storage0, self.writeout1, - self.writeout0) - print("Outputs: ", self.curr_crd1, self.curr_crd0, self.curr_val) - print("State: ", self.curr_state, self.next_state) - - def get_writout(self): - return self.writeout0 or self.writeout1 - - def build_writeout(self): - result = [] - for crd1 in sorted(self.storage.keys()): - for crd0, val in self.storage[crd1].items(): - result.append((crd0, val)) - result.append(('S0', 'S0')) - # Remove last stop token - return result[:-1] - - def update_storage(self, crd1, crd0, val): - if crd1 not in self.storage.keys(): - self.storage[crd1] = {crd0: val} - else: - assert isinstance(self.storage[crd1], dict), "Storage must be a dictionary of dictionaries" - if crd0 not in self.storage[crd1].keys(): - self.storage[crd1][crd0] = val + if len(self.in0_crdpt) > self.depth: + self.fifo_avail_inner = False else: - self.storage[crd1][crd0] += val - - def ACC1_body(self): - # In accumulation, accumulate into memory - self.curr_in_crd1 = self.in_crd1.pop(0) - - # All elements are ready - if is_nc_tkn(self.curr_in_crd1): - if len(self.in_crd0) > 0 and len(self.in_val) > 0: - self.ACC0_body() + self.fifo_avail_inner = True + if len(self.in1_crdpt) > self.depth: + self.fifo_avail_outer = False else: - self.next_state = self.states.ACC0 - elif is_stkn(self.curr_in_crd1): - self.next_state = self.states.READY - elif is_dtkn(self.curr_in_crd1): - assert False, "Shouldn't have done token for coordinates if in accumulate (ACC) state" - else: - assert False, "Cannot have a coordinate token of this type: " + str(self.curr_in_crd1) - - def ACC0_body(self): - self.curr_in_crd0 = self.in_crd0.pop(0) - self.curr_in_val = self.in_val.pop(0) - - if is_nc_tkn(self.curr_in_val, self.valtype): - assert is_nc_tkn(self.curr_in_crd0, int), "The inner coordinate must be a non-control token" - self.update_storage(self.curr_in_crd1, self.curr_in_crd0, self.curr_in_val) - self.next_state = self.states.ACC0 - # In accumulation, if you see a stop token in the inner level, go back to start - elif is_stkn(self.curr_in_crd0): - assert is_stkn(self.curr_in_val) and stkn_order(self.curr_in_crd0) == stkn_order(self.curr_in_val), \ - "Stop tokens must match for inner crd: " + str(self.curr_in_crd0) + " and val: " + str(self.curr_in_val) - self.next_state = self.states.ACC1 - elif is_dtkn(self.curr_in_crd0): - assert False, "Shouldn't have done token for coordinates if in accumulate (ACC) state" - # Do nothing - else: - assert False, "Cannot have a coordinate token of this type: " + str(self.curr_in_crd0) + self.fifo_avail_outer = True + if len(self.in_val) > self.depth: + self.fifo_avail_val = False + else: + self.fifo_avail_val = True def update(self): self.update_done() self.update_ready() - - # Print out debugging statements - if self.debug: - self.print_debug() - if self.backpressure_en: self.data_valid = False if (self.backpressure_en and self.check_backpressure()) or not self.backpressure_en: - # Update state of state machine to next state - self.curr_state = self.next_state - - # FIXME: (owhsu) self.data_ready not defined in init + if self.done: + f1, f2, f3 = self.crdpt_spacc.return_fifo() + f4, f5 = self.crdpt_converter.return_fifo() + self.crdpt_spacc = SparseCrdPtAccumulator2(maxdim=self.temp_maxdim, valtype=self.temp_valtype, + fifos=[f1, f2, f3]) + self.crdpt_converter = CrdPtConverter(last_level=self.temp_last_level, fifos=[f4, f5]) if self.backpressure_en: self.data_valid = True - self.data_ready = True - - if self.done: - # Reset things - # fch1, fch2 = self.crdhold_01.return_fifo() - # fs1, fs2, fs3 = self.spacc1_no_crdhold.return_fifo() - # fsd1 = self.stkndrop_crd1.return_fifo() - # fsd2 = self.stkndrop_crd0.return_fifo() - # fsd3 = self.stkndrop_val.return_fifo() - # self.crdhold_01 = CrdHold(fifos=[fch1, fch2], **self.kwargs) - # - # self.spacc1_no_crdhold = SpAcc1NoCrdHold(maxdim=self.maxdim, valtype=self.valtype, - # name=self.name + "_no_crdhold", - # fifos=[fs1, fs2, fs3], **self.kwargs) - # self.stkndrop_crd1 = StknDrop(fifos=[fsd1], **self.kwargs) - # self.stkndrop_crd0 = StknDrop(fifos=[fsd2], **self.kwargs) - # self.stkndrop_val = StknDrop(fifos=[fsd3], **self.kwargs) - pass - - # Set when block counts should start - if len(self.in_crd1) > 0 or len(self.in_crd0) > 0 or len(self.in_val) > 0: + if (len(self.in1_crdpt) > 0 or len(self.in0_crdpt) > 0 or len(self.in_val) > 0): self.block_start = False - # Store block statistics if asked to be reported if self.get_stats: - # What to do for drop tokens? - pass - - # Begin state machine computation - # READY State - # Accepts crd2 token - if self.curr_state == self.states.READY: - if len(self.in_crd2) > 0: - self.curr_crd2 = self.in_crd2.pop(0) - if is_nc_tkn(self.curr_crd2): - if len(self.in_crd1) > 0: - self.ACC1_body() - else: - self.next_state = self.states.ACC1 - elif is_stkn(self.curr_crd2) and not self.get_writout(): - # Set writeout to be true, move over storage, and clear it. - self.crd2_stkn = self.curr_crd2 - self.writeout1 = True - self.writeout0 = True - self.writeout_storage1 = [k for k in sorted(self.storage.keys())] - self.writeout_storage0 = self.build_writeout() - self.storage = {} - self.next_state = self.states.READY - elif is_stkn(self.curr_crd2): - # Wait for previous writeout to be done - self.next_state = self.states.WR - elif is_dtkn(self.curr_crd2): - self.seen_done = True - if self.get_writout(): - self.next_state = self.states.WR - else: - self.next_state = self.states.DONE - else: - assert False, "Cannot have a coordinate token of this type: " + str(self.curr_crd2) - # Handle accumulation into storage - # Accepts crd1 token - elif self.curr_state == self.states.ACC1: - if len(self.in_crd1) > 0: - self.ACC1_body() - else: - self.next_state = self.states.ACC1 - elif self.curr_state == self.states.ACC0: - if len(self.in_crd0) > 0 and len(self.in_val) > 0: - self.ACC0_body() - else: - self.next_state = self.states.ACC0 - # Finish writeout and then be done or go back to ready state - elif self.curr_state == self.states.WR: - if not self.get_writout() and self.seen_done: - self.next_state = self.states.DONE - elif not self.get_writout(): - self.next_state = self.states.READY - else: - self.next_state = self.states.WR - # See a done signal AND writeout is done - # Stay done until reset - elif self.curr_state == self.states.DONE: - self.done = True - self.next_state = self.states.DONE - # Default to the current state - else: - self.next_state = self.curr_state - - # Writeout is true, so writeout the current values for storage - if self.get_writout(): - # Writeout is done when there are no elements left - # Writeout outer (crd1) level coordinates - if self.writeout1: - if len(self.writeout_storage1) == 0: - self.writeout1 = False - assert self.crd2_stkn is not None, "The current writeout stop token should not be None" - self.curr_crd1 = self.crd2_stkn - else: - curr_writeout_elem1 = self.writeout_storage1.pop(0) - self.curr_crd1 = curr_writeout_elem1 - else: - self.curr_crd1 = "" + self.compute_fifo() - # Writeout inner (crd0) level coordinates - if self.writeout0: - if len(self.writeout_storage0) == 0: - self.writeout0 = False - assert self.crd2_stkn is not None, "The current writeout stop token should not be None" - self.curr_crd0 = increment_stkn(self.crd2_stkn) + if len(self.in1_crdpt) > 0: + self.crdpt_spacc.set_outer_crdpt(self.in1_crdpt.pop(0)) - self.curr_val = increment_stkn(self.crd2_stkn) - else: - curr_writeout_elem0 = self.writeout_storage0.pop(0) - self.curr_crd0 = curr_writeout_elem0[0] - self.curr_val = curr_writeout_elem0[1] + if len(self.in0_crdpt) > 0: + self.crdpt_spacc.set_inner_crdpt(self.in0_crdpt.pop(0)) + + if len(self.in_val) > 0: + self.crdpt_spacc.set_val(self.in_val.pop(0)) + + self.crdpt_spacc.update() + + self.crdpt_converter.set_inner_crdpt(self.crdpt_spacc.out_inner_crdpt()) + self.crdpt_converter.set_outer_crdpt(self.crdpt_spacc.out_outer_crdpt()) + self.crdpt_converter.update() + + if self.crdpt_spacc.out_val() != '': + self.crdpt_spacc_out_val.append(self.crdpt_spacc.out_val()) + + self.curr_1_crd = self.crdpt_converter.out_crd_outer() + self.curr_0_crd = self.crdpt_converter.out_crd_inner() + + if self.val_stkn: + self.curr_val = self.crdpt_spacc_out_val.pop(0) if isinstance(self.curr_0_crd, int) and \ + len(self.crdpt_spacc_out_val) > 0 else self.curr_0_crd else: - self.curr_crd0 = "" - self.curr_val = "" + self.curr_val = self.crdpt_spacc_out_val.pop(0) if len(self.crdpt_spacc_out_val) > 0 else '' - elif self.done: - self.curr_val = 'D' - self.curr_crd0 = 'D' - self.curr_crd1 = 'D' - else: - self.curr_val = "" - self.curr_crd0 = "" - self.curr_crd1 = "" + if self.debug: + print(self.in_val) - # Update the current state - self.curr_state = self.next_state + self.done = self.crdpt_spacc.out_done() and self.crdpt_converter.out_done() if self.debug: - print(self.in_crd1, self.in_crd0, self.in_val) - print(self.curr_crd1, self.curr_crd0, self.curr_val) - print("====== SPACC2 END =======") + print("Done:", self.done, + "\n SpCrdPt Accum Done:", self.crdpt_spacc.out_done(), + "\t CrdPtConv 01 Done:", self.crdpt_converter.out_done() + ) - def set_in_crd0(self, crd, parent=None): - if super().valid_token(crd, int): - self.in_crd0.append(crd) - if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_0) + def compute_fifo(self): + self.in1_fifo = max(self.in1_fifo, len(self.in1_crdpt)) + self.in0_fifo = max(self.in0_fifo, len(self.in0_crdpt)) + self.inval_fifo = max(self.inval_fifo, len(self.in_val)) - def set_in_crd1(self, crd, parent=None): - if super().valid_token(crd, int): - self.in_crd1.append(crd) + def set_crd_inner(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in0_crdpt.append(crdpt) if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_1) + parent.set_backpressure(self.fifo_avail_inner) - def set_in_crd2(self, crd, parent=None): - if super().valid_token(crd, int): - self.in_crd2.append(crd) + def set_crd_outer(self, crdpt, parent=None): + assert not is_stkn(crdpt), 'Coordinate points should not have stop tokens' + if crdpt != '' and crdpt is not None: + self.in1_crdpt.append(crdpt) if self.backpressure_en: - parent.set_backpressure(self.fifo_avail_2) + parent.set_backpressure(self.fifo_avail_outer) def set_val(self, val, parent=None): + assert not is_stkn(val), 'Values associated with points should not have stop tokens' if val != '' and val is not None: self.in_val.append(val) if self.backpressure_en: parent.set_backpressure(self.fifo_avail_val) - def out_crd1(self): + def out_crd_outer(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_crd1 + return self.curr_1_crd - def out_crd0(self): + def out_crd_inner(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: - return self.curr_crd0 + return self.curr_0_crd def out_val(self): if (self.backpressure_en and self.data_valid) or not self.backpressure_en: @@ -1174,12 +973,12 @@ def out_val(self): def return_statistics(self): if self.get_stats: - stats_dict = {} - # TODO: Finish adding in other statistics + hits_info = self.crdpt_spacc.return_hits() + stats_dict = {"in1_fifo": self.in1_fifo, "in0_fifo": self.in0_fifo, + "inval_fifo": self.inval_fifo, "max_hits": hits_info[0], "gt_one": hits_info[1], + "total_elems": hits_info[2]} + stats_dict.update(self.crdpt_spacc.return_statistics()) stats_dict.update(super().return_statistics()) else: stats_dict = {} return stats_dict - - def print_fifos(self): - print("Spaccumulator: None available") From 8b313f84ff6a8f5813b9242bfa6961c991426a97 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Nov 2023 09:04:00 -0800 Subject: [PATCH 9/9] Style fix --- sam/onyx/hw_nodes/compute_node.py | 2 +- sam/onyx/hw_nodes/fiberaccess_node.py | 8 +- sam/onyx/hw_nodes/intersect_node.py | 1 - sam/onyx/hw_nodes/merge_node.py | 2 +- sam/onyx/hw_nodes/read_scanner_node.py | 14 +-- sam/onyx/hw_nodes/write_scanner_node.py | 8 +- sam/onyx/parse_dot.py | 159 ++++++++++++++++-------- 7 files changed, 122 insertions(+), 72 deletions(-) diff --git a/sam/onyx/hw_nodes/compute_node.py b/sam/onyx/hw_nodes/compute_node.py index 560aa4db..283b771f 100644 --- a/sam/onyx/hw_nodes/compute_node.py +++ b/sam/onyx/hw_nodes/compute_node.py @@ -63,7 +63,7 @@ def connect(self, other, edge, kwargs=None): # isect_conn = other.get_num_inputs() if 'vector_reduce_mode' in edge.get_attributes(): - if edge.get_attributes()['vector_reduce_mode'] == True: + if edge.get_attributes()['vector_reduce_mode']: isect_conn = 0 else: if 'tensor' not in edge.get_attributes(): diff --git a/sam/onyx/hw_nodes/fiberaccess_node.py b/sam/onyx/hw_nodes/fiberaccess_node.py index 63e7c85f..7e7a3722 100644 --- a/sam/onyx/hw_nodes/fiberaccess_node.py +++ b/sam/onyx/hw_nodes/fiberaccess_node.py @@ -230,10 +230,10 @@ def configure(self, attributes, flavor): cfg_kwargs['flavor'] = flavor print("THESE ARE MY CONFIG KWARGS") print(cfg_kwargs) - #breakpoint() + # breakpoint() - #vr_mode = 0 - #cfg_tuple += (vr_mode,) - #cfg_kwargs["vr_mode"] = vr_mode + # vr_mode = 0 + # cfg_tuple += (vr_mode,) + # cfg_kwargs["vr_mode"] = vr_mode return cfg_tuple, cfg_kwargs diff --git a/sam/onyx/hw_nodes/intersect_node.py b/sam/onyx/hw_nodes/intersect_node.py index 5f4617d4..f84feeef 100644 --- a/sam/onyx/hw_nodes/intersect_node.py +++ b/sam/onyx/hw_nodes/intersect_node.py @@ -250,7 +250,6 @@ def configure(self, attributes): cmrg_stop_lvl = 0 type_op = attributes['type'].strip('"') - if 'vector_reduce_mode' in attributes: is_in_vr_mode = attributes['vector_reduce_mode'].strip('"') if is_in_vr_mode == "true": diff --git a/sam/onyx/hw_nodes/merge_node.py b/sam/onyx/hw_nodes/merge_node.py index 5dccdb88..f074e3e4 100644 --- a/sam/onyx/hw_nodes/merge_node.py +++ b/sam/onyx/hw_nodes/merge_node.py @@ -71,7 +71,7 @@ def connect(self, other, edge, kwargs=None): } return new_conns - #raise NotImplementedError(f'Cannot connect MergeNode to {other_type}') + # raise NotImplementedError(f'Cannot connect MergeNode to {other_type}') elif other_type == ReduceNode: # raise NotImplementedError(f'Cannot connect MergeNode to {other_type}') other_red = other.get_name() diff --git a/sam/onyx/hw_nodes/read_scanner_node.py b/sam/onyx/hw_nodes/read_scanner_node.py index 64c4cad0..74fd70ef 100644 --- a/sam/onyx/hw_nodes/read_scanner_node.py +++ b/sam/onyx/hw_nodes/read_scanner_node.py @@ -91,7 +91,7 @@ def connect(self, other, edge, kwargs=None): if 'use_alt_out_port' in edge_attr: out_conn = 'block_rd_out' elif ('vector_reduce_mode' in edge_attr): - if (edge_attr['vector_reduce_mode'] == True): + if (edge_attr['vector_reduce_mode']): out_conn = 'pos_out' else: out_conn = 'coord_out' @@ -106,7 +106,7 @@ def connect(self, other, edge, kwargs=None): # Send both.... isect = other.get_name() if 'vector_reduce_mode' in edge.get_attributes(): - if edge.get_attributes()['vector_reduce_mode'] == True: + if edge.get_attributes()['vector_reduce_mode']: isect_conn = 1 elif 'special' in edge.get_attributes(): isect_conn = 0 @@ -256,11 +256,11 @@ def configure(self, attributes): dim_size = 1 stop_lvl = 0 - #if 'spacc' in attributes: + # if 'spacc' in attributes: # spacc_mode = 1 # assert 'stop_lvl' in attributes # stop_lvl = int(attributes['stop_lvl'].strip('"')) - #else: + # else: # spacc_mode = 0 # This is a fiberwrite's opposing read scanner for comms with GLB @@ -292,7 +292,6 @@ def configure(self, attributes): lookup = 0 block_mode = int(attributes['type'].strip('"') == 'fiberwrite') - if 'vector_reduce_mode' in attributes: is_in_vr_mode = attributes['vector_reduce_mode'].strip('"') if is_in_vr_mode == "true": @@ -300,7 +299,6 @@ def configure(self, attributes): else: vr_mode = 0 - cfg_kwargs = { 'dense': dense, 'dim_size': dim_size, @@ -312,10 +310,10 @@ def configure(self, attributes): 'do_repeat': do_repeat, 'repeat_outer': repeat_outer, 'repeat_factor': repeat_factor, - #'stop_lvl': stop_lvl, + # 'stop_lvl': stop_lvl, 'block_mode': block_mode, 'lookup': lookup, - #'spacc_mode': spacc_mode + # 'spacc_mode': spacc_mode 'vr_mode': vr_mode } diff --git a/sam/onyx/hw_nodes/write_scanner_node.py b/sam/onyx/hw_nodes/write_scanner_node.py index 4ac63f81..25df864a 100644 --- a/sam/onyx/hw_nodes/write_scanner_node.py +++ b/sam/onyx/hw_nodes/write_scanner_node.py @@ -90,12 +90,12 @@ def configure(self, attributes): else: compressed = 1 - #if 'spacc' in attributes: + # if 'spacc' in attributes: # spacc_mode = 1 # init_blank = 1 # assert 'stop_lvl' in attributes # stop_lvl = int(attributes['stop_lvl'].strip('"')) - #else: + # else: # spacc_mode = 0 # init_blank = 0 @@ -112,7 +112,7 @@ def configure(self, attributes): block_mode = 1 else: block_mode = 0 - + if 'vector_reduce_mode' in attributes: is_in_vr_mode = attributes['vector_reduce_mode'].strip('"') if is_in_vr_mode == "true": @@ -131,6 +131,6 @@ def configure(self, attributes): 'block_mode': block_mode, 'vr_mode': vr_mode, 'init_blank': init_blank - #'spacc_mode': spacc_mode + # 'spacc_mode': spacc_mode } return cfg_tuple, cfg_kwargs diff --git a/sam/onyx/parse_dot.py b/sam/onyx/parse_dot.py index b21f553d..8533c9a8 100644 --- a/sam/onyx/parse_dot.py +++ b/sam/onyx/parse_dot.py @@ -148,14 +148,14 @@ def rewrite_VectorReducer(self): # TODO: Get redux crd output_crd = attrs['accum_index'].strip('"') - #input_crd = None + # input_crd = None incoming_edges = [edge for edge in self.graph.get_edges() if edge.get_destination() == vr_node.get_name()] outgoing_edges = [edge for edge in self.graph.get_edges() if edge.get_source() == vr_node.get_name()] in_val_node = None in_crd_node = None - #in_input_node = None + # in_input_node = None # Keep these for the edges in_edge_attrs = {} @@ -167,11 +167,11 @@ def rewrite_VectorReducer(self): in_val_node = incoming_edge_.get_source() in_edge_attrs[in_val_node] = edge_attr elif edge_attr['type'].strip('"') == 'crd': - #edge_comment = edge_attr['comment'].strip('"') - #if output_crd in edge_comment: + # edge_comment = edge_attr['comment'].strip('"') + # if output_crd in edge_comment: in_crd_node = incoming_edge_.get_source() in_edge_attrs[in_crd_node] = edge_attr - #else: + # else: # input_crd = edge_comment # in_input_node = incoming_edge_.get_source() # in_edge_attrs[in_input_node] = edge_attr @@ -190,16 +190,22 @@ def rewrite_VectorReducer(self): og_type = attrs['type'] del attrs['type'] - #rsg = pydot.Node(f"vr_rsg_{self.get_next_seq()}", + # rsg = pydot.Node(f"vr_rsg_{self.get_next_seq()}", # **attrs, label=f"{og_label}_rsg", hwnode=f"{HWNodeType.RepSigGen}", # type=og_type) - #repeat = pydot.Node(f"vr_repeat_{self.get_next_seq()}", + # repeat = pydot.Node(f"vr_repeat_{self.get_next_seq()}", # **attrs, label=f"{og_label}_repeat", hwnode=f"{HWNodeType.Repeat}", # root="true", type=og_type, spacc="true") - union = pydot.Node(f"vr_union_{self.get_next_seq()}", label=f"{og_label}_union", hwnode=f"{HWNodeType.Intersect}", - type="union", vector_reduce_mode="true", comment=f"type=union,index={output_crd}", index=output_crd) + union = pydot.Node( + f"vr_union_{self.get_next_seq()}", + label=f"{og_label}_union", + hwnode=f"{HWNodeType.Intersect}", + type="union", + vector_reduce_mode="true", + comment=f"type=union,index={output_crd}", + index=output_crd) add = pydot.Node(f"vr_add_{self.get_next_seq()}", label=f"{og_label}_Add", hwnode=f"{HWNodeType.Compute}", type="add", sub="0", comment="type=add,sub=0") @@ -208,14 +214,30 @@ def rewrite_VectorReducer(self): label=f"{og_label}_crd_buffet", hwnode=f"{HWNodeType.Buffet}", type="buffet", vector_reduce_mode="true", fa_color=self.fa_color, comment="crd_buffet") - crd_rd_scanner = pydot.Node(f"vr_crd_rd_scanner_{self.get_next_seq()}", - label=f"{og_label}_crd_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", - tensor="X", type="fiberlookup", root="false", format="compressed", - mode="0", index=f"{output_crd}", vector_reduce_mode="true", fa_color=self.fa_color, comment="crd_rd_scanner") - - crd_wr_scanner = pydot.Node(f"vr_crd_wr_scanner_{self.get_next_seq()}", - label=f"{og_label}_crd_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", - type="fiberwrite", mode="0", format="compressed", vector_reduce_mode="true", fa_color=self.fa_color, comment="crd_wr_scanner") + crd_rd_scanner = pydot.Node( + f"vr_crd_rd_scanner_{self.get_next_seq()}", + label=f"{og_label}_crd_rd_scanner", + hwnode=f"{HWNodeType.ReadScanner}", + tensor="X", + type="fiberlookup", + root="false", + format="compressed", + mode="0", + index=f"{output_crd}", + vector_reduce_mode="true", + fa_color=self.fa_color, + comment="crd_rd_scanner") + + crd_wr_scanner = pydot.Node( + f"vr_crd_wr_scanner_{self.get_next_seq()}", + label=f"{og_label}_crd_wr_scanner", + hwnode=f"{HWNodeType.WriteScanner}", + type="fiberwrite", + mode="0", + format="compressed", + vector_reduce_mode="true", + fa_color=self.fa_color, + comment="crd_wr_scanner") self.fa_color += 1 @@ -227,25 +249,40 @@ def rewrite_VectorReducer(self): label=f"{og_label}_vals_buffet", hwnode=f"{HWNodeType.Buffet}", type="buffet", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_buffet") - #vals_rd_scanner = pydot.Node(f"vr_vals_rd_scanner_{self.get_next_seq()}", + # vals_rd_scanner = pydot.Node(f"vr_vals_rd_scanner_{self.get_next_seq()}", # label=f"{og_label}_vals_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", # tensor="X", type="arrayvals", root="false", format="vals", - # mode="vals", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_rd_scanner") - - vals_rd_scanner = pydot.Node(f"vr_vals_rd_scanner_{self.get_next_seq()}", - label=f"{og_label}_vals_rd_scanner", hwnode=f"{HWNodeType.ReadScanner}", - tensor="X", type="fiberlookup", root="false", format="compressed", - mode="1", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_rd_scanner") - - #vals_wr_scanner = pydot.Node(f"vr_vals_wr_scanner_{self.get_next_seq()}", + # mode="vals", vector_reduce_mode="true", fa_color=self.fa_color, + # comment="vals_rd_scanner") + + vals_rd_scanner = pydot.Node( + f"vr_vals_rd_scanner_{self.get_next_seq()}", + label=f"{og_label}_vals_rd_scanner", + hwnode=f"{HWNodeType.ReadScanner}", + tensor="X", + type="fiberlookup", + root="false", + format="compressed", + mode="1", + vector_reduce_mode="true", + fa_color=self.fa_color, + comment="vals_rd_scanner") + + # vals_wr_scanner = pydot.Node(f"vr_vals_wr_scanner_{self.get_next_seq()}", # label=f"{og_label}_vals_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", - # type="fiberwrite", mode="vals", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_wr_scanner") - - - vals_wr_scanner = pydot.Node(f"vr_vals_wr_scanner_{self.get_next_seq()}", - label=f"{og_label}_vals_wr_scanner", hwnode=f"{HWNodeType.WriteScanner}", - type="fiberwrite", mode="1", format="compressed", vector_reduce_mode="true", fa_color=self.fa_color, comment="vals_wr_scanner") - + # type="fiberwrite", mode="vals", vector_reduce_mode="true", + # fa_color=self.fa_color, comment="vals_wr_scanner") + + vals_wr_scanner = pydot.Node( + f"vr_vals_wr_scanner_{self.get_next_seq()}", + label=f"{og_label}_vals_wr_scanner", + hwnode=f"{HWNodeType.WriteScanner}", + type="fiberwrite", + mode="1", + format="compressed", + vector_reduce_mode="true", + fa_color=self.fa_color, + comment="vals_wr_scanner") # glb_vals = pydot.Node(f"vr_crd_vals_{self.get_next_seq()}", **attrs, # label=f"{og_label}_glb_vals_read", hwnode=f"{HWNodeType.GLB}", @@ -253,7 +290,6 @@ def rewrite_VectorReducer(self): self.fa_color += 1 - self.graph.add_node(union) self.graph.add_node(add) self.graph.add_node(crd_buffet) @@ -263,7 +299,7 @@ def rewrite_VectorReducer(self): self.graph.add_node(vals_rd_scanner) self.graph.add_node(vals_wr_scanner) - #print(in_edge_attrs[in_input_node]) + # print(in_edge_attrs[in_input_node]) print(in_edge_attrs[in_crd_node]) print(in_edge_attrs[in_val_node]) @@ -272,17 +308,24 @@ def rewrite_VectorReducer(self): del in_edge_attrs[in_crd_node]['type'] # Edges - #input_to_rsg_edge = pydot.Edge(src=in_input_node, dst=rsg, **in_edge_attrs[in_input_node]) - #rsg_to_repeat = pydot.Edge(src=rsg, dst=repeat) - #repeat_to_crd_rd_scan = pydot.Edge(src=repeat, dst=crd_rd_scanner) - #crd_rd_scan_to_val_rd_scan = pydot.Edge(src=crd_rd_scanner, dst=vals_rd_scanner) + # input_to_rsg_edge = pydot.Edge(src=in_input_node, dst=rsg, **in_edge_attrs[in_input_node]) + # rsg_to_repeat = pydot.Edge(src=rsg, dst=repeat) + # repeat_to_crd_rd_scan = pydot.Edge(src=repeat, dst=crd_rd_scanner) + # crd_rd_scan_to_val_rd_scan = pydot.Edge(src=crd_rd_scanner, dst=vals_rd_scanner) in_crd_to_union = pydot.Edge(src=in_crd_node, dst=union, - **in_edge_attrs[in_crd_node], type="crd", comment=f"in-B") + **in_edge_attrs[in_crd_node], type="crd", comment=f"in-B") in_val_to_union = pydot.Edge(src=in_val_node, dst=union, **in_edge_attrs[in_val_node], - type="ref", comment=f"in-B", val="true", vector_reduce_mode=True) + type="ref", comment=f"in-B", val="true", vector_reduce_mode=True) # type="ref", comment=f"in-C", val="true") - crd_rd_scan_to_union = pydot.Edge(src=crd_rd_scanner, dst=union, type="crd", comment="in-x", vector_reduce_mode=True) - val_rd_scan_to_union = pydot.Edge(src=vals_rd_scanner, dst=union, type="ref", comment="in-x", val="true", vector_reduce_mode=True) + crd_rd_scan_to_union = pydot.Edge(src=crd_rd_scanner, dst=union, type="crd", + comment="in-x", vector_reduce_mode=True) + val_rd_scan_to_union = pydot.Edge( + src=vals_rd_scanner, + dst=union, + type="ref", + comment="in-x", + val="true", + vector_reduce_mode=True) union_crd_to_crd_wr_scan = pydot.Edge(src=union, dst=crd_wr_scanner, type="crd") union_val0_to_alu = pydot.Edge(src=union, dst=add, comment='out-B') # union_val0_to_alu = pydot.Edge(src=union, dst=add, comment='out-C') @@ -315,16 +358,26 @@ def rewrite_VectorReducer(self): 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") - - crd_rd_scan_to_ds = pydot.Edge(src=crd_rd_scanner, dst=dst_crd, **crd_edge_attr, 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", vector_reduce_mode=True) - - #self.graph.add_edge(input_to_rsg_edge) - #self.graph.add_edge(rsg_to_repeat) - #self.graph.add_edge(repeat_to_crd_rd_scan) - #self.graph.add_edge(crd_rd_scan_to_val_rd_scan) + # 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") + + crd_rd_scan_to_ds = pydot.Edge( + src=crd_rd_scanner, + dst=dst_crd, + **crd_edge_attr, + 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", + vector_reduce_mode=True) + + # self.graph.add_edge(input_to_rsg_edge) + # self.graph.add_edge(rsg_to_repeat) + # self.graph.add_edge(repeat_to_crd_rd_scan) + # self.graph.add_edge(crd_rd_scan_to_val_rd_scan) self.graph.add_edge(in_crd_to_union) self.graph.add_edge(in_val_to_union) self.graph.add_edge(crd_rd_scan_to_union)