From e89a672ab7e2b51e0531cbfe63fcedefb6e392fd Mon Sep 17 00:00:00 2001 From: "Rob Herring (Arm)" Date: Mon, 30 Mar 2026 16:02:56 -0500 Subject: [PATCH] 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 Signed-off-by: Rob Herring (Arm) Part-of: --- src/gallium/drivers/ethosu/ethosu_lower.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/ethosu/ethosu_lower.c b/src/gallium/drivers/ethosu/ethosu_lower.c index 5a91d8b1402..ffaa1f267ae 100644 --- a/src/gallium/drivers/ethosu/ethosu_lower.c +++ b/src/gallium/drivers/ethosu/ethosu_lower.c @@ -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");