DigitalMediaProfessionals / tool

DV network conversion tool
Apache License 2.0
0 stars 1 forks source link

Non-transposed weight packing #24

Closed ZongHong-Lyu closed 5 years ago

ZongHong-Lyu commented 5 years ago

In email from steven:

Zong-san,
It seems that the commonly used buffer sizes for DV700 h/w are large 
enough to support non-transposed first layer input in most cases.
As far as I understand, currently, non-transposed mode is supported by 
h/w(risc-v program) but not by the weight-packing tool ...  Would it 
be possible to support non-transposed weight packing in the tool soon?
For Mercury project, the i/o requirements are quite challenging and we 
need to make another specialized version of tinyIPU - it's too hard to 
support transposed output for this, so we will need to use non-transposed flow.

And the follow up:

Zong-san,
As I understand it, it is implemented as a per-layer setting in the h/w config structure, using the top bit (0x8000) of input_circular_offset.
ZongHong-Lyu commented 5 years ago

From Christer:

The input_circular_offset is used in 3D convolution so the input is a circular buffer,
which only replace the oldest frame, the offset which frame is the first frame.

And the MSB of this register is used to tell if the image is transposed or not.
If MSB is set, the input image and output images are not transposed.
But then the weight itself needs to be transposed.
Also the way to calculate tiles need to swap width and height.

I think since setting the MSB of input_circular_offset needs to modify too many codes, which scatter in tool, user space driver, and kernel driver. It is better to not touch this bit, but just has a flag in tool to transpose weights and swap width and height for non-transposed output.