Skip to content

Commit

Permalink
Merge pull request #143 from weiya711/print_cleanup
Browse files Browse the repository at this point in the history
code cleanup
  • Loading branch information
kalhankoul96 authored Oct 16, 2024
2 parents 47895d2 + 0809751 commit 2151dc7
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
max-parallel: 5
steps:
Expand Down
2 changes: 1 addition & 1 deletion sam/onyx/hw_nodes/buffet_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def connect(self, other, edge, kwargs=None):
raise NotImplementedError(f'Cannot connect BuffetNode to {other_type}')

def configure(self, attributes):

print("Buffet Configure ", attributes)
total_cap = 2048

capacity_0 = 1024
Expand Down
8 changes: 1 addition & 7 deletions sam/onyx/hw_nodes/compute_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,10 @@ def connect(self, other, edge, kwargs=None):
elif other_type == CrdHoldNode:
raise NotImplementedError(f'Cannot connect GLBNode to {other_type}')
elif other_type == FiberAccessNode:
print("COMPUTE TO FIBER ACCESS")
assert kwargs is not None
assert 'flavor_that' in kwargs
that_flavor = other.get_flavor(kwargs['flavor_that'])
print(kwargs)
init_conns = self.connect(that_flavor, edge)
print(init_conns)
final_conns = other.remap_conns(init_conns, kwargs['flavor_that'])
return final_conns
else:
Expand Down Expand Up @@ -212,11 +209,9 @@ def parse_mapped_json(self, filename, node_id, is_mapped_from_complex_op, origin
self.opcode = int(opcode, 0)

def configure(self, attributes):
print("PE CONFIGURE")
print(attributes)
print("PE Configure ", attributes)
c_op = attributes['type'].strip('"')
comment = attributes['comment'].strip('"')
print(c_op)
op_code = 0
# configuring via sam, it is a sparse app
use_dense = False
Expand All @@ -228,7 +223,6 @@ def configure(self, attributes):
num_sparse_inputs = list("000")
for port in self.mapped_input_ports:
num_sparse_inputs[2 - int(port)] = '1'
print("".join(num_sparse_inputs))
num_sparse_inputs = int("".join(num_sparse_inputs), 2)

cfg_kwargs = {
Expand Down
18 changes: 1 addition & 17 deletions sam/onyx/hw_nodes/crdhold_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ def connect(self, other, edge, kwargs=None):
wr_scan = other.get_name()
conn = 0
comment = edge.get_attributes()['comment'].strip('"')
print("CRDHOLD TO WR SCAN")
print(comment)
if 'outer' in comment:
conn = 1
new_conns = {
Expand All @@ -65,23 +63,18 @@ def connect(self, other, edge, kwargs=None):
# out_conn = 0
# in_conn = 0

print(edge)
intersect = other.get_name()
# Use inner to process outer
print("CRDHOLD TO INTERSECT")
comment = edge.get_attributes()['comment'].strip('"')
print(comment)

label = edge.get_attributes()['label'].strip('"')
t_label = label.split('-')[1]
print(t_label)
if self.get_inner() in t_label:
out_conn = 0
else:
out_conn = 1

other_t_0 = other.get_tensor_from_connection(0)
print(other_t_0)
if other_t_0 in comment:
in_conn = 0
else:
Expand All @@ -108,12 +101,7 @@ def connect(self, other, edge, kwargs=None):
hold_outer = other.get_outer()
hold_inner = other.get_inner()
conn = 0
print(edge)
print("CRDHOLD TO CRDHOLD")
comment = edge.get_attributes()['comment'].strip('"')
print(comment)
print(hold_outer)
print(hold_inner)
if hold_outer in comment:
conn = 1
new_conns = {
Expand Down Expand Up @@ -142,13 +130,10 @@ def connect(self, other, edge, kwargs=None):
return new_conns

elif other_type == FiberAccessNode:
print("CRDHOLD TO FIBER ACCESS")
assert kwargs is not None
assert 'flavor_that' in kwargs
that_flavor = other.get_flavor(kwargs['flavor_that'])
print(kwargs)
init_conns = self.connect(that_flavor, edge)
print(init_conns)
final_conns = other.remap_conns(init_conns, kwargs['flavor_that'])
return final_conns
else:
Expand All @@ -157,8 +142,7 @@ def connect(self, other, edge, kwargs=None):
return new_conns

def configure(self, attributes):
print("CRDHOLD CONFIGURE")
print(attributes)
print("CRDHOLD Configure: ", attributes)
cmrg_enable = 1
# TODO what is this supposed to be?
cmrg_stop_lvl = 1
Expand Down
42 changes: 2 additions & 40 deletions sam/onyx/hw_nodes/fiberaccess_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def remap_conns(self, conns, flavor):

for conn_set_name, conn_list in conns.items():
# remapped_conns[conn_set_name]
print(f"remapping {conn_set_name}: {conn_list}")
# print(f"remapping {conn_set_name}: {conn_list}")
tmp_list_conns = []
for conn_item in conn_list:
conns, size = conn_item
Expand Down Expand Up @@ -93,10 +93,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO GLB")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -111,10 +108,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO WRITE SCANNER")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -123,10 +117,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO INTERSECT")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -135,10 +126,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO Crd Hold")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -149,10 +137,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO Crd Hold")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -161,10 +146,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO Crd Hold")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -173,10 +155,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO Crd Hold")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -185,10 +164,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO WRITE SCANNER")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -199,10 +175,7 @@ def connect(self, other, edge, kwargs=None):
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO Crd Hold")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns

Expand All @@ -213,32 +186,22 @@ def connect(self, other, edge, kwargs=None):
assert 'flavor_that' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
that_flavor = other.get_flavor(kwargs['flavor_that'])
print(kwargs)
print("FIBER ACCESS TO FIBER ACCESS")
init_conns = this_flavor.connect(that_flavor, edge)
print(init_conns)
final_conns_1 = self.remap_conns(init_conns, kwargs['flavor_this'])
final_conns_2 = other.remap_conns(final_conns_1, kwargs['flavor_that'])
print(final_conns_2)
return final_conns_2
elif other_type == StreamArbiterNode:
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO Stream Arbiter")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns
elif other_type == PassThroughNode:
assert kwargs is not None
assert 'flavor_this' in kwargs
this_flavor = self.get_flavor(kwargs['flavor_this'])
print(kwargs)
print("FIBER ACCESS TO Pass Through")
init_conns = this_flavor.connect(other, edge)
print(init_conns)
final_conns = self.remap_conns(init_conns, kwargs['flavor_this'])
return final_conns
else:
Expand All @@ -247,11 +210,10 @@ def connect(self, other, edge, kwargs=None):
return new_conns

def configure(self, attributes, flavor):
print("Fiber Access Configure: ", attributes)

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
Expand Down
2 changes: 0 additions & 2 deletions sam/onyx/hw_nodes/glb_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ def connect(self, other, edge, kwargs=None):
# Only could be using the write scanner portion of the fiber access
# fa = other.get_name()
conns_original = self.connect(other.get_write_scanner(), edge=edge)
print(conns_original)
conns_remapped = other.remap_conns(conns_original, "write_scanner")
print(conns_remapped)

return conns_remapped
elif other_type == PassThroughNode:
Expand Down
18 changes: 1 addition & 17 deletions sam/onyx/hw_nodes/intersect_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,12 @@ def connect(self, other, edge, kwargs=None):
elif other_type == LookupNode:
raise NotImplementedError(f'Cannot connect IntersectNode to {other_type}')
elif other_type == MergeNode:
print("INTERSECT TO MERGE")
print(edge)
merge = other.get_name()
# Use inner to process outer
merge_outer = other.get_outer()
merge_inner = other.get_inner()
conn = 0
# print("INTERSECT TO MERGE")
# print(edge)
# print(edge.get_attributes())
comment = edge.get_attributes()['comment'].strip('"')
# print(comment)
# print(merge_outer)
# print(merge_inner)
# okay this is dumb, stopgap until we can have super consistent output
try:
mapped_to_conn = comment.split("-")[1]
Expand All @@ -147,7 +139,6 @@ def connect(self, other, edge, kwargs=None):
mapped_to_conn = comment
if merge_outer in mapped_to_conn:
conn = 1
print(f"CONN: {conn}")
new_conns = {
f'isect_to_merger_{conn}': [
# Send isect row and isect col to merger inside isect_col
Expand All @@ -158,9 +149,7 @@ def connect(self, other, edge, kwargs=None):
return new_conns
elif other_type == RepeatNode:
repeat = other.get_name()
print("INTERSECT TO REPEAT EDGE!")
out_conn = 0
print(edge)
comment = edge.get_attributes()['comment'].strip('"')
cmt_tnsr = comment.split("-")[1]
assert cmt_tnsr in self.tensor_to_conn
Expand Down Expand Up @@ -199,7 +188,6 @@ def connect(self, other, edge, kwargs=None):
}
return new_conns
elif other_type == CrdHoldNode:
print(edge)
crdhold = other.get_name()
edge_comment = edge.get_attributes()['comment'].strip('"')
if 'outer' in edge_comment:
Expand All @@ -213,13 +201,10 @@ def connect(self, other, edge, kwargs=None):
}
return new_conns
elif other_type == FiberAccessNode:
print("INTERSECT TO FIBER ACCESS")
assert kwargs is not None
assert 'flavor_that' in kwargs
that_flavor = other.get_flavor(kwargs['flavor_that'])
print(kwargs)
init_conns = self.connect(that_flavor, edge)
print(init_conns)
final_conns = other.remap_conns(init_conns, kwargs['flavor_that'])
return final_conns
elif other_type == PassThroughNode:
Expand Down Expand Up @@ -266,8 +251,7 @@ def get_tensor_from_connection(self, conn):
return self.conn_to_tensor[conn]

def configure(self, attributes):
# print("INTERSECT CONFIGURE")
# print(attributes)
print("INTERSECT Configure", attributes)
cmrg_enable = 0
cmrg_stop_lvl = 0
type_op = attributes['type'].strip('"')
Expand Down
Loading

0 comments on commit 2151dc7

Please sign in to comment.