Skip to content

Commit

Permalink
Merge pull request #101 from weiya711/mapping_to_cgra_update_reduce
Browse files Browse the repository at this point in the history
1. Update compute_node.py to add the required new configurations to configure the PE sitting inside the reduce_pe_cluster
2. Update reduce_node.py to add the required new configurations to configure the Reduce sitting inside the reduce_pe_cluster
3. Update all nodes that connects to/from reduce node to update the connection port name required by the change of port name in the updated reduce_pe_cluster
  • Loading branch information
bobcheng15 authored Nov 15, 2023
2 parents 09490d7 + b39b2b4 commit cade108
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
15 changes: 12 additions & 3 deletions sam/onyx/hw_nodes/compute_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def connect(self, other, edge, kwargs=None):
pe = self.get_name()
new_conns = {
f'pe_to_reduce': [
([(pe, "res"), (other_red, f"data_in")], 17),
([(pe, "res"), (other_red, f"reduce_data_in")], 17),
]
}
return new_conns
Expand Down Expand Up @@ -151,13 +151,22 @@ def configure(self, attributes):
comment = attributes['comment'].strip('"')
print(c_op)
op_code = 0
# configuring via sam, it is a sparse app
use_dense = False
# mapping to pe only, configuring only the pe, ignore the reduce
pe_only = True
# data I/O should interface with other primitive outside of the cluster
pe_in_external = 1
if c_op == 'mul':
op_code = 1
elif c_op == 'add' and 'sub=1' not in comment:
op_code = 0
elif c_op == 'add' and 'sub=1' in comment:
op_code = 2
cfg_kwargs = {
'op': op_code
'op': op_code,
'use_dense': use_dense,
'pe_only': pe_only,
'pe_in_external': pe_in_external
}
return op_code, cfg_kwargs
return (op_code, use_dense, pe_only, pe_in_external), cfg_kwargs
2 changes: 1 addition & 1 deletion sam/onyx/hw_nodes/merge_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def connect(self, other, edge, kwargs=None):
other_red = other.get_name()
new_conns = {
f'merge_to_reduce_inner': [
([(merge, f"cmrg_coord_out_{0}"), (other_red, f"data_in")], 17),
([(merge, f"cmrg_coord_out_{0}"), (other_red, f"reduce_data_in")], 17),
]
}

Expand Down
22 changes: 17 additions & 5 deletions sam/onyx/hw_nodes/reduce_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def connect(self, other, edge, kwargs=None):
new_conns = {
'reduce_to_wr_scan': [
# send output to rd scanner
([(red, "data_out"), (wr_scan, "data_in")], 17),
([(red, "reduce_data_out"), (wr_scan, "data_in")], 17),
# ([(red, "eos_out"), (wr_scan, "eos_in_0")], 1),
# ([(wr_scan, "ready_out_0"), (red, "ready_in")], 1),
# ([(red, "valid_out"), (wr_scan, "valid_in_0")], 1),
Expand All @@ -53,7 +53,7 @@ def connect(self, other, edge, kwargs=None):
new_conns = {
'reduce_to_reduce': [
# send output to rd scanner
([(red, "data_out"), (other_red, "data_in")], 17),
([(red, "reduce_data_out"), (other_red, "reduce_data_in")], 17),
# ([(red, "eos_out"), (wr_scan, "eos_in_0")], 1),
# ([(wr_scan, "ready_out_0"), (red, "ready_in")], 1),
# ([(red, "valid_out"), (wr_scan, "valid_in_0")], 1),
Expand All @@ -72,7 +72,7 @@ def connect(self, other, edge, kwargs=None):
new_conns = {
f'reduce_to_pe_{other_conn}': [
# send output to rd scanner
([(red, "data_out"), (pe, f"data{other_conn}")], 17),
([(red, "reduce_data_out"), (pe, f"data{other_conn}")], 17),
# ([(red, "eos_out"), (wr_scan, "eos_in_0")], 1),
# ([(wr_scan, "ready_out_0"), (red, "ready_in")], 1),
# ([(red, "valid_out"), (wr_scan, "valid_in_0")], 1),
Expand Down Expand Up @@ -102,7 +102,19 @@ def connect(self, other, edge, kwargs=None):
def configure(self, attributes):
# TODO
stop_lvl = 2
# bypassing the fifos in the pe, get result in a single cycle
pe_only = False
# configuring both the pe and the reduce
pe_connected_to_reduce = True
# data I/O to and from the PE should be internal with the reduce
pe_in_external = 0
# op is set to integer add for the PE TODO: make this configurable in the sam graph
op = 0
cfg_kwargs = {
'stop_lvl': stop_lvl
'stop_lvl': stop_lvl,
'pe_connected_to_reduce': pe_connected_to_reduce,
'pe_only': pe_only,
'pe_in_external': pe_in_external,
'op': op
}
return stop_lvl, cfg_kwargs
return (stop_lvl, pe_connected_to_reduce, pe_only, pe_in_external, op), cfg_kwargs

0 comments on commit cade108

Please sign in to comment.