Skip to content

Commit

Permalink
[RTL MVAU] Bring back is_versal node attribute for resource estimations
Browse files Browse the repository at this point in the history
  • Loading branch information
auphelia committed May 29, 2024
1 parent 4012378 commit 1dd118b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def __init__(self, onnx_node, **kwargs):
super().__init__(onnx_node, **kwargs)

def get_nodeattr_types(self):
my_attrs = {}
my_attrs = {
# Flag to indicate if Versal device is targeted
"is_versal": ("i", False, 0, {0, 1}),
}
my_attrs.update(MVAU.get_nodeattr_types(self))
my_attrs.update(RTLBackend.get_nodeattr_types(self))
return my_attrs
Expand Down Expand Up @@ -138,11 +141,10 @@ def dsp_estimation(self):
# multiplication
P = self.get_nodeattr("PE")
Q = self.get_nodeattr("SIMD")
# TODO: get dsp block type
# if dsp_block = "DSP58":
# mult_dsp = P * np.ceil(Q / 3)
# else:
mult_dsp = np.ceil(P / 4) * Q
if self.get_nodeattr("is_versal"):
mult_dsp = P * np.ceil(Q / 3)
else:
mult_dsp = np.ceil(P / 4) * Q
return int(mult_dsp)

def instantiate_ip(self, cmd):
Expand Down
3 changes: 3 additions & 0 deletions src/finn/transformation/fpgadataflow/specialize_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ def apply(self, model):
for attribute in node.attribute:
if attribute.name != "preferred_impl_style":
new_node.attribute.append(attribute)
if new_node.op_type == "MVAU_rtl":
is_versal_family = is_versal(self.fpgapart)
getCustomOp(new_node).set_nodeattr("is_versal", is_versal_family)
graph.node.insert(node_ind, new_node)
# remove old nodes
graph.node.remove(node)
Expand Down

0 comments on commit 1dd118b

Please sign in to comment.