Skip to content

Draft: etnaviv/nn: WIP weight bitstream encoder for future i.MX8MP support

Philipp Zabel requested to merge pH5/mesa:etnaviv-npu-imx8mp into main

This does not work yet.

The bitstream encoder can (barely) create bit-identical weight bitstreams for a bunch of kernels in its current state, but only if it is given the same symbol map. Any kernels with zero runs in them are still fraught with uncertainties.

I have not yet understood how the run length table in the header works exactly, so I'm not sure the decision, which zero encoding to use, and when, is correct. Also there are different amounts of trailing zeroes needed for smaller kernels, that I have not yet understood the pattern for.

Choosing the symbol map for optimal compression isn't implemented for zero run length encoding, but is currently enabled anyway, as the blob chooses to use it for small kernels. A fixed symbol map is used instead, that happens produce an exact bitstream for the test_conv2d[4-False-valid-1-1-1-1-4-1] case. Still, while this doesn't crash the NPU anymore, I have not yet managed to make it compute the correct result we have yet to determine the proper symbol map for other cases.

Based on !28921 (merged).

Edited by Philipp Zabel

Merge request reports