Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping to cgra update reduce #101

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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