Skip to content

Commit b7f7cfe

Browse files
author
Lukas Stasytis
committed
decrease test-case counts and remove unnecessary prints
1 parent aa91e40 commit b7f7cfe

4 files changed

Lines changed: 25 additions & 49 deletions

File tree

tests/fpgadataflow/test_fpgadataflow_channelwise_ops.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@
4949
from finn.transformation.fpgadataflow.set_exec_mode import SetExecMode
5050
from finn.transformation.fpgadataflow.specialize_layers import SpecializeLayers
5151
from finn.util.basic import decompress_string_to_numpy
52-
from finn.util.test import compare_two_chr_funcs, get_characteristic_fnc
52+
from finn.util.test import (
53+
compare_two_chr_funcs,
54+
debug_chr_funcs,
55+
get_characteristic_fnc,
56+
)
5357

5458

5559
def make_modelwrapper(C, pe, idt, odt, pdt, func, vecs):
@@ -232,23 +236,7 @@ def test_fpgadataflow_analytical_characterization_channelwise_ops(
232236
rtlsim_in = decompress_string_to_numpy(node_rtlsim.get_nodeattr("io_chrc_in"))
233237
rtlsim_out = decompress_string_to_numpy(node_rtlsim.get_nodeattr("io_chrc_out"))
234238

235-
# DEBUGGING ======================================================
236-
if direction == "input":
237-
np.set_printoptions(threshold=np.inf)
238-
print("chr IN")
239-
print(chr_in[:100])
240-
241-
print("rtlsim IN")
242-
print(rtlsim_in[:100])
243-
244-
elif direction == "output":
245-
np.set_printoptions(threshold=np.inf)
246-
print("chr OUT")
247-
print(chr_out[:100])
248-
249-
print("rtlsim OUT")
250-
print(rtlsim_out[:100])
251-
# DEBUGGING ======================================================
239+
debug_chr_funcs(chr_in, chr_out, rtlsim_in, rtlsim_out, direction)
252240

253241
if direction == "input":
254242
assert compare_two_chr_funcs(

tests/fpgadataflow/test_fpgadataflow_convinputgenerator.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@
5050
from finn.transformation.fpgadataflow.set_exec_mode import SetExecMode
5151
from finn.transformation.fpgadataflow.specialize_layers import SpecializeLayers
5252
from finn.util.basic import decompress_string_to_numpy
53-
from finn.util.test import compare_two_chr_funcs, get_characteristic_fnc
53+
from finn.util.test import (
54+
compare_two_chr_funcs,
55+
debug_chr_funcs,
56+
get_characteristic_fnc,
57+
)
5458

5559

5660
def make_single_im2col_modelwrapper(k, ifm_ch, ifm_dim, ofm_dim, stride, dilation, idt, dw):
@@ -245,21 +249,21 @@ def test_fpgadataflow_slidingwindow(
245249
# which port to test
246250
@pytest.mark.parametrize("direction", ["input", "output"])
247251
# input datatype
248-
@pytest.mark.parametrize("idt", [DataType["INT2"], DataType["UINT4"]])
252+
@pytest.mark.parametrize("idt", [DataType["INT2"]])
249253
# kernel size
250-
@pytest.mark.parametrize("k", [[2, 2], [3, 3], [1, 5]])
254+
@pytest.mark.parametrize("k", [[3, 3], [1, 5]])
251255
# input dimension
252256
@pytest.mark.parametrize("ifm_dim", [[8, 8], [1, 21]])
253257
# input channels
254258
@pytest.mark.parametrize("ifm_ch", [2, 4])
255259
# Stride
256-
@pytest.mark.parametrize("stride", [[1, 1], [2, 2], [2, 1]])
260+
@pytest.mark.parametrize("stride", [[2, 2], [2, 1]])
257261
# Dilation
258-
@pytest.mark.parametrize("dilation", [[1, 1], [2, 2], [2, 1]])
262+
@pytest.mark.parametrize("dilation", [[2, 2], [2, 1]])
259263
# execution mode
260-
@pytest.mark.parametrize("exec_mode", ["cppsim", "rtlsim"])
264+
@pytest.mark.parametrize("exec_mode", ["rtlsim"])
261265
# input channel parallelism ("SIMD")
262-
@pytest.mark.parametrize("simd", [1, 2, 4])
266+
@pytest.mark.parametrize("simd", [1, 4])
263267
# depthwise
264268
@pytest.mark.parametrize("dw", [0, 1])
265269
# parallel_window enable (MMV_out = M*K)
@@ -362,23 +366,7 @@ def test_fpgadataflow_analytical_characterization_slidingwindow(
362366
rtlsim_in = decompress_string_to_numpy(node_rtlsim.get_nodeattr("io_chrc_in"))
363367
rtlsim_out = decompress_string_to_numpy(node_rtlsim.get_nodeattr("io_chrc_out"))
364368

365-
# DEBUGGING ======================================================
366-
if direction == "input":
367-
np.set_printoptions(threshold=np.inf)
368-
print("chr IN")
369-
print(chr_in[:100])
370-
371-
print("rtlsim IN")
372-
print(rtlsim_in[:100])
373-
374-
elif direction == "output":
375-
np.set_printoptions(threshold=np.inf)
376-
print("chr OUT")
377-
print(chr_out[:100])
378-
379-
print("rtlsim OUT")
380-
print(rtlsim_out[:100])
381-
# DEBUGGING ======================================================
369+
debug_chr_funcs(chr_in, chr_out, rtlsim_in, rtlsim_out, direction)
382370

383371
if direction == "input":
384372
assert compare_two_chr_funcs(

tests/fpgadataflow/test_fpgadataflow_dwc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ def test_fpgadataflow_dwc_stitched_rtlsim(config, impl_style):
188188
[
189189
([1, 24], 6, 4, DataType["INT2"]),
190190
([1, 24], 4, 6, DataType["INT2"]),
191-
# ([1, 4], 2, 4, DataType["BIPOLAR"]),
192-
# ([1, 4], 4, 2, DataType["INT2"]),
193-
# ([1, 2, 8], 4, 4, DataType["INT2"]),
194-
# ([1, 2, 8], 8, 16, DataType["INT2"]),
191+
([1, 4], 2, 4, DataType["BIPOLAR"]),
192+
([1, 4], 4, 2, DataType["INT2"]),
193+
([1, 2, 8], 4, 4, DataType["INT2"]),
194+
([1, 2, 8], 8, 16, DataType["INT2"]),
195195
],
196196
)
197197
@pytest.mark.parametrize("exec_mode", ["rtlsim"])

tests/fpgadataflow/test_fpgadataflow_fmpadding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ def test_fpgadataflow_fmpadding(idim, pad, num_ch, simd, idt, mode, impl_style):
173173
# # which port to test
174174
@pytest.mark.parametrize("direction", ["input", "output"])
175175
# input image dimension
176-
@pytest.mark.parametrize("idim", [[8, 8], [10, 8]])
176+
@pytest.mark.parametrize("idim", [[10, 8]])
177177
# number of rows and number of cols to add
178-
@pytest.mark.parametrize("pad", [[1, 1, 1, 1], [1, 1, 2, 2], [1, 3, 2, 3], [7, 0, 8, 0]])
178+
@pytest.mark.parametrize("pad", [[1, 1, 1, 1], [1, 1, 2, 2], [7, 0, 8, 0]])
179179
# number of channels
180180
@pytest.mark.parametrize("num_ch", [2, 4])
181181
# Input parallelism
182182
@pytest.mark.parametrize("simd", [1, 2])
183183
# FINN input datatype
184-
@pytest.mark.parametrize("idt", [DataType["INT2"], DataType["INT4"]])
184+
@pytest.mark.parametrize("idt", [DataType["INT2"]])
185185
# execution mode
186186
@pytest.mark.parametrize("mode", ["rtlsim"])
187187
# implementation style

0 commit comments

Comments
 (0)