Skip to content
Snippets Groups Projects
Commit 99c09dc6 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Test] extend FIFO sizing test to cnv and premade conf

parent cd4af948
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,8 @@ import pytest
import json
import shutil
from brevitas.export.onnx.generic.manager import BrevitasONNXManager
from qonnx.core.modelwrapper import ModelWrapper
from qonnx.custom_op.registry import getCustomOp
import finn.builder.build_dataflow as build
import finn.builder.build_dataflow_config as build_cfg
......@@ -52,7 +54,14 @@ def fetch_test_model(topology, wbits=2, abits=2):
@pytest.mark.parametrize(
"method", ["largefifo_rtlsim_python", "largefifo_rtlsim_cpp", "characterize"]
)
def test_fifosizing_linear(method):
@pytest.mark.parametrize(
"topology",
[
"cnv",
# "tfc"
],
)
def test_fifosizing_linear(method, topology):
force_python_rtlsim = "python" in method
method_key = "largefifo_rtlsim" if "largefifo_rtlsim" in method else "characterize"
tmp_output_dir = fetch_test_model("tfc")
......@@ -83,4 +92,32 @@ def test_fifosizing_linear(method):
/ float(est_data["estimated_throughput_fps"])
> 0.9
)
# now run the same build using the generated folding and FIFO config
tmp_output_dir_cmp = fetch_test_model("tfc")
cfg_cmp = cfg
cfg_cmp.output_dir = tmp_output_dir_cmp
cfg_cmp.auto_fifo_depths = False
cfg_cmp.target_fps = None
cfg_cmp.generate_outputs = [build_cfg.DataflowOutputType.STITCHED_IP]
cfg_cmp.folding_config_file = tmp_output_dir + "/final_hw_config.json"
build.build_dataflow_cfg(tmp_output_dir_cmp + "/model.onnx", cfg_cmp)
model0 = ModelWrapper(
tmp_output_dir + "/intermediate_models/step_create_stitched_ip.onnx"
)
model1 = ModelWrapper(
tmp_output_dir_cmp + "/intermediate_models/step_create_stitched_ip.onnx"
)
assert len(model0.graph.node) == len(model1.graph.node)
for i in range(len(model0.graph.node)):
node0 = model0.graph.node[i]
node1 = model1.graph.node[i]
assert node0.op_type == node1.op_type
if node0.op_type == "StreamingFIFO":
node0_inst = getCustomOp(node0)
node1_inst = getCustomOp(node1)
assert node0_inst.get_nodeattr("depth") == node1_inst.get_nodeattr("depth")
shutil.rmtree(tmp_output_dir)
shutil.rmtree(tmp_output_dir_cmp)
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