From ef31fa313bf1a45bc0b23741e5c6fbd38b89b7fc Mon Sep 17 00:00:00 2001 From: Bo Wun Cheng Date: Wed, 15 Nov 2023 00:13:35 -0800 Subject: [PATCH 1/3] update configuration code for pe and reduce to account for the new config register heirarchy in reduce_pe_cluster. also modified the signal name for connection from crddrop to reduce and reduce to arrayval to match the new signal name of reduce in cluster, matmul_ijk_crddrop passed --- sam/onyx/hw_nodes/compute_node.py | 13 +++++++++++-- sam/onyx/hw_nodes/merge_node.py | 2 +- sam/onyx/hw_nodes/reduce_node.py | 18 +++++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/sam/onyx/hw_nodes/compute_node.py b/sam/onyx/hw_nodes/compute_node.py index 2fb7620f..f6c651a2 100644 --- a/sam/onyx/hw_nodes/compute_node.py +++ b/sam/onyx/hw_nodes/compute_node.py @@ -151,6 +151,12 @@ 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 = True if c_op == 'mul': op_code = 1 elif c_op == 'add' and 'sub=1' not in comment: @@ -158,6 +164,9 @@ def configure(self, attributes): 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 diff --git a/sam/onyx/hw_nodes/merge_node.py b/sam/onyx/hw_nodes/merge_node.py index 9b1f1ae7..c0b3d158 100644 --- a/sam/onyx/hw_nodes/merge_node.py +++ b/sam/onyx/hw_nodes/merge_node.py @@ -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), ] } diff --git a/sam/onyx/hw_nodes/reduce_node.py b/sam/onyx/hw_nodes/reduce_node.py index 5caac658..4b2e679f 100644 --- a/sam/onyx/hw_nodes/reduce_node.py +++ b/sam/onyx/hw_nodes/reduce_node.py @@ -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), @@ -102,7 +102,19 @@ def connect(self, other, edge, kwargs=None): def configure(self, attributes): # TODO stop_lvl = 2 + # configuring via sam, it is a sparse app + use_dense = False + # configuring both the pe and the reduce + pe_only = False + # data I/O to and from the PE should be internal with the reduce + pe_in_external = False + # 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, + 'use_dense': use_dense, + 'pe_only': pe_only, + 'pe_in_external': pe_in_external, + 'op': op } - return stop_lvl, cfg_kwargs + return (stop_lvl, use_dense, pe_only, pe_in_external, op), cfg_kwargs From d0793dde6b547fd2d1a09a613960c4c0f5d0bc62 Mon Sep 17 00:00:00 2001 From: Bo Wun Cheng Date: Wed, 15 Nov 2023 10:28:06 -0800 Subject: [PATCH 2/3] update port name for connection from reduce to reduce, also updated the reduce node configuration to use dense mode --- sam/onyx/hw_nodes/compute_node.py | 4 ++-- sam/onyx/hw_nodes/reduce_node.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sam/onyx/hw_nodes/compute_node.py b/sam/onyx/hw_nodes/compute_node.py index f6c651a2..2482f399 100644 --- a/sam/onyx/hw_nodes/compute_node.py +++ b/sam/onyx/hw_nodes/compute_node.py @@ -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 @@ -156,7 +156,7 @@ def configure(self, attributes): # 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 = True + pe_in_external = 1 if c_op == 'mul': op_code = 1 elif c_op == 'add' and 'sub=1' not in comment: diff --git a/sam/onyx/hw_nodes/reduce_node.py b/sam/onyx/hw_nodes/reduce_node.py index 4b2e679f..aa101d12 100644 --- a/sam/onyx/hw_nodes/reduce_node.py +++ b/sam/onyx/hw_nodes/reduce_node.py @@ -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), @@ -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), @@ -102,19 +102,19 @@ def connect(self, other, edge, kwargs=None): def configure(self, attributes): # TODO stop_lvl = 2 - # configuring via sam, it is a sparse app - use_dense = False - # configuring both the pe and the reduce + # 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 = False + 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, - 'use_dense': use_dense, + 'pe_connected_to_reduce': pe_connected_to_reduce, 'pe_only': pe_only, 'pe_in_external': pe_in_external, 'op': op } - return (stop_lvl, use_dense, pe_only, pe_in_external, op), cfg_kwargs + return (stop_lvl, pe_connected_to_reduce, pe_only, pe_in_external, op), cfg_kwargs From b39b2b429157e98bc58bcd9d1c62ac84af11d50a Mon Sep 17 00:00:00 2001 From: Bo Wun Cheng Date: Wed, 15 Nov 2023 14:24:29 -0800 Subject: [PATCH 3/3] fix code style --- sam/onyx/hw_nodes/reduce_node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sam/onyx/hw_nodes/reduce_node.py b/sam/onyx/hw_nodes/reduce_node.py index aa101d12..6ed41cf7 100644 --- a/sam/onyx/hw_nodes/reduce_node.py +++ b/sam/onyx/hw_nodes/reduce_node.py @@ -108,7 +108,7 @@ def configure(self, attributes): 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 is set to integer add for the PE TODO: make this configurable in the sam graph op = 0 cfg_kwargs = { 'stop_lvl': stop_lvl,