Xilinx / finn-base

Open Source Compiler Framework using ONNX as Frontend and IR
https://finn-base.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
29 stars 17 forks source link

Experimental: fast_mode data packing for binary #24

Closed maltanar closed 3 years ago

maltanar commented 3 years ago

finnpy_to_packed_bytearray can be slow, which isn't too much of a concern at compile-time but will reduce performance at runtime.

To address one little part of this problem, this PR introduces fast_mode support when packing 1-bit types by using numpy.packbits. An extra condition (total bits must be divisible by 8) is introduced to remain compatible with what the original does, which does not match with what numpy does if the condition is violated.