etnaviv/nn: Don't shortcut ZRL bits calculation

In some (probably malformed) cases, even weights BOs for strided or depthwise
convolutions can become bigger when using ZRL compression.

To avoid running out of space in the BO, play safe and calculate the
actual optimum ZRL bit count. This does slow compilation for quite a
bit, though (2x slower for MobileNetV1).

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28879>
This commit is contained in:
Tomeu Vizoso 2024-04-23 17:04:15 +02:00 committed by Marge Bot
parent d46e68c89a
commit 9bac40b796

View file

@ -1253,16 +1253,6 @@ calculate_zrl_bits(struct etna_ml_subgraph *subgraph, const struct etna_operatio
unsigned best_compressed_size;
unsigned best_zrl_bits;
/* On HW that doesn't natively support depthwise and strided convolutions,
* we have to lower them and pad with lots of zeroes. We can be pretty certain
* that max bits of compression will help these jobs.
*/
if (operation->depthwise ||
operation->stride > 1) {
return max_zrl_bits;
}
/* These are very unlikely to have enough zeroes for compression to be useful. */
if (operation->addition ||
operation->pointwise) {