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

[Test] add thresholding test that triggers multi-inp error case

parent 65248bc3
No related branches found
No related tags found
No related merge requests found
......@@ -52,11 +52,13 @@ from finn.transformation.general import GiveUniqueNodeNames
from finn.util.basic import gen_finn_dt_tensor
from finn.util.pyverilator import axilite_read, axilite_write
test_fpga_part = "xc7z020clg400-1"
test_fpga_part = "xczu3eg-sbva484-1-e"
target_clk_ns = 5
def make_single_thresholding_modelwrapper(T, pe, idt, odt, actval, mem_mode):
def make_single_thresholding_modelwrapper(
T, pe, idt, odt, actval, mem_mode, n_inp_vecs
):
NumChannels = T.shape[0]
inp = helper.make_tensor_value_info("inp", TensorProto.FLOAT, [1, NumChannels])
......@@ -78,6 +80,7 @@ def make_single_thresholding_modelwrapper(T, pe, idt, odt, actval, mem_mode):
outputDataType=odt.name,
ActVal=actval,
mem_mode=mem_mode,
numInputVectors=[n_inp_vecs],
)
graph = helper.make_graph(
nodes=[Thresholding_node],
......@@ -115,10 +118,11 @@ def test_fpgadataflow_thresholding(idt, act, nf, ich, exec_mode, mem_mode):
if nf == -1:
nf = ich
pe = ich // nf
n_inp_vecs = 2
assert ich % pe == 0
# generate input data
x = gen_finn_dt_tensor(idt, (1, ich))
x = gen_finn_dt_tensor(idt, (n_inp_vecs, ich))
odt = act
n_steps = act.get_num_possible_values() - 1
......@@ -135,7 +139,9 @@ def test_fpgadataflow_thresholding(idt, act, nf, ich, exec_mode, mem_mode):
else:
actval = odt.min()
model = make_single_thresholding_modelwrapper(T, pe, idt, odt, actval, mem_mode)
model = make_single_thresholding_modelwrapper(
T, pe, idt, odt, actval, mem_mode, n_inp_vecs
)
if exec_mode == "cppsim":
model = model.transform(PrepareCppSim())
......@@ -185,6 +191,7 @@ def test_fpgadataflow_thresholding(idt, act, nf, ich, exec_mode, mem_mode):
@pytest.mark.vivado
def test_runtime_thresholds_single_layer():
n_inp_vecs = 2
mem_mode = "decoupled"
act = DataType["INT4"]
idt = DataType["INT16"]
......@@ -194,7 +201,7 @@ def test_runtime_thresholds_single_layer():
assert ich % pe == 0
# generate input data
in_tensor = gen_finn_dt_tensor(idt, (1, ich))
in_tensor = gen_finn_dt_tensor(idt, (n_inp_vecs, ich))
odt = act
n_steps = act.get_num_possible_values() - 1
......@@ -207,7 +214,9 @@ def test_runtime_thresholds_single_layer():
else:
actval = odt.min()
model = make_single_thresholding_modelwrapper(T, pe, idt, odt, actval, mem_mode)
model = make_single_thresholding_modelwrapper(
T, pe, idt, odt, actval, mem_mode, n_inp_vecs
)
op_inst = getCustomOp(model.graph.node[0])
op_inst.set_nodeattr("runtime_writeable_weights", 1)
op_inst.make_weight_file(T, "decoupled_runtime", "old_weights.dat")
......
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