Skip to content

Commit

Permalink
[Test] Apply parallelism independent if it is HLS or RTL variant
Browse files Browse the repository at this point in the history
  • Loading branch information
auphelia committed Mar 25, 2024
1 parent f5ca9f2 commit 85baad0
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tests/fpgadataflow/test_depthwise_convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
from finn.transformation.fpgadataflow.prepare_rtlsim import PrepareRTLSim
from finn.transformation.fpgadataflow.set_exec_mode import SetExecMode
from finn.transformation.fpgadataflow.specialize_layers import SpecializeLayers
from finn.util.fpgadataflow import is_fpgadataflow_node


def set_up_reference_model(act, idt, wdt, k, ifm_dim, ifm_ch, stride, padding):
Expand Down Expand Up @@ -182,21 +181,16 @@ def test_depthwise_conv_hw_cppsim(act, pe, k, stride, padding):

new_model = model.transform(InferConvInpGen())
new_model = new_model.transform(InferVectorVectorActivation())
# for cppsim set all layers to preferred impl style = "hls"
for node in new_model.graph.node:
if is_fpgadataflow_node(node):
inst = getCustomOp(node)
inst.set_nodeattr("preferred_impl_style", "hls")

new_model = new_model.transform(SpecializeLayers())

# set SIMD in ConvInputGen node and PE in VVAU node

for n in new_model.graph.node:
if n.op_type == "ConvolutionInputGenerator_hls":
if n.op_type.startswith("ConvolutionInputGenerator"):
convinputgen_node = getCustomOp(n)
convinputgen_node.set_nodeattr("SIMD", pe)
elif n.op_type == "VectorVectorActivation_hls":
elif n.op_type.startswith("VectorVectorActivation"):
vvau_node = getCustomOp(n)
vvau_node.set_nodeattr("PE", pe)
new_model = new_model.transform(SetExecMode("cppsim"))
Expand Down Expand Up @@ -234,13 +228,14 @@ def test_depthwise_conv_hw_rtlsim(act, pe, k, stride, padding):
new_model = new_model.transform(InferVectorVectorActivation())

new_model = new_model.transform(SpecializeLayers())

# set SIMD in ConvInputGen node and PE in VVAU node

for n in new_model.graph.node:
if n.op_type == "ConvolutionInputGenerator_rtl":
if n.op_type.startswith("ConvolutionInputGenerator"):
convinputgen_node = getCustomOp(n)
convinputgen_node.set_nodeattr("SIMD", pe)
elif n.op_type == "VectorVectorActivation_hls":
elif n.op_type.startswith("VectorVectorActivation"):
vvau_node = getCustomOp(n)
vvau_node.set_nodeattr("PE", pe)

Expand Down

0 comments on commit 85baad0

Please sign in to comment.