ethosu: Fix U85 AvgPool for greater than 8x8 kernel sizes

The U85 uses average mode for kernel sizes less than or equal to 8x8 and
sum mode for larger (in either dimension) kernel sizes. According to the
U85 TRM, the average and sum modes have the following constraints:

average - Average pooling up to 8x8, inbuilt scale only
sum - Sum or average pooling, per-channel, or global scale

Reviewed-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40719>
This commit is contained in:
Rob Herring (Arm) 2026-03-30 16:02:56 -05:00 committed by Marge Bot
parent cabc55e9a5
commit e89a672ab7

View file

@ -171,7 +171,12 @@ ethosu_lower_pooling(struct ethosu_subgraph *subgraph,
operation->pooling.type = ETHOSU_POOLING_TYPE_MAX;
break;
case PIPE_ML_POOLING_TYPE_AVG:
operation->pooling.type = ETHOSU_POOLING_TYPE_AVG;
if (ethosu_ml_device(subgraph->base.device)->is_u65 ||
((poperation->pooling.filter_height <= 8) &&
(poperation->pooling.filter_width <= 8)))
operation->pooling.type = ETHOSU_POOLING_TYPE_AVG;
else
operation->pooling.type = ETHOSU_POOLING_TYPE_SUM;
break;
default:
assert(0 && "Unsupported pooling type");