Skip to content
Snippets Groups Projects
Commit 746d44d4 authored by auphelia's avatar auphelia
Browse files

[CustomOp] Add assertion when pe or simd setting not valid

parent 0c239a5f
No related branches found
No related tags found
No related merge requests found
...@@ -253,9 +253,6 @@ class VectorVectorActivation(HLSCustomOp): ...@@ -253,9 +253,6 @@ class VectorVectorActivation(HLSCustomOp):
def get_instream_width(self, ind=0): def get_instream_width(self, ind=0):
i_bits = self.get_input_datatype().bitwidth() i_bits = self.get_input_datatype().bitwidth()
simd = self.get_nodeattr("SIMD") simd = self.get_nodeattr("SIMD")
# if simd > 1:
# pe = self.get_nodeattr("Channels")
# else:
pe = self.get_nodeattr("PE") pe = self.get_nodeattr("PE")
in_width = i_bits * simd * pe in_width = i_bits * simd * pe
return in_width return in_width
...@@ -270,11 +267,13 @@ class VectorVectorActivation(HLSCustomOp): ...@@ -270,11 +267,13 @@ class VectorVectorActivation(HLSCustomOp):
dim_h, dim_w = self.get_nodeattr("Dim") dim_h, dim_w = self.get_nodeattr("Dim")
ch = self.get_nodeattr("Channels") ch = self.get_nodeattr("Channels")
simd = self.get_nodeattr("SIMD") simd = self.get_nodeattr("SIMD")
# if simd > 1:
# pe = self.get_nodeattr("Channels")
# else:
pe = self.get_nodeattr("PE") pe = self.get_nodeattr("PE")
sf = k_h * k_w // simd kernel_2 = k_h * k_w
assert (
kernel_2 % simd == 0
), "Requirement kernel (k_h * k_w) divisable by SIMD is violated."
sf = kernel_2 // simd
assert ch % pe == 0, "Requirement Channels divisable by PE is violated."
nf = ch // pe nf = ch // pe
if ind == 0: if ind == 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment