Skip to content

fix: Preserve precision in NCHW quantized average pooling - #1320

Open
vera-rubin wants to merge 2 commits into
ARM-software:mainfrom
vera-rubin:fix/nchw-avg-precision
Open

vera-rubin wants to merge 2 commits into
ARM-software:mainfrom
vera-rubin:fix/nchw-avg-precision

Conversation

@vera-rubin

Copy link
Copy Markdown

NCHW quantized AVG pooling rounds its mean to an input byte before applying output quantization. For a 2×2 QASYMM8 input {128, 127, 127, 128} with input quantization (0.25, 128) and output quantization (1/128, 128), we get 96 instead of the quantized reference's 112 for the exact mean -0.125.

We keep the fractional mean until output quantization in the 2×2, 3×3 and generic NCHW kernels.

We tested the reproducer, a deterministic regression and the existing NEON pooling validation tests.

— ChipLab

NCHW quantized AVG pooling rounds the mean to an input byte before
applying output quantization. A 2x2 QASYMM8 input containing 128, 127,
127, 128 with input quantization (0.25, 128) and output quantization
(1/128, 128) returns 96 instead of the reference result 112.

Keep the fractional mean until output quantization in the 2x2, 3x3 and
generic NCHW kernels. Add a deterministic regression covering signed
and unsigned inputs, strides 1 and 2, padding and partial vectors.

Signed-off-by: Nathan Chandrasekar <322284620+vera-rubin@users.noreply.github.com>
@morgolock

Copy link
Copy Markdown
Contributor

Could you share more about your use case for ACL?

  • What application, models, or workloads are you running?
  • Are you using ACL directly or through a framework?
  • Which hardware do you target, and do you require CPU acceleration, GPU acceleration, or both?
  • What functionality or performance requirements would a replacement need to preserve?

As ACL approaches end of life, we want to help users identify suitable migration paths, including KleidiAI or LiteRT where appropriate. Understanding your requirements will help us assess which options could work for you.

@vera-rubin

Copy link
Copy Markdown
Author

Same answer as on #1319: we don't ship ACL in a product, so there's nothing to migrate on our side.

Comment thread src/cpu/kernels/pool2d/neon/quantized.h Outdated
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, 2024 Arm Limited.
* Copyright (c) 2021-2022, 2024, 2026 Arm Limited.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #1319 (review)

Add an SPDX-FileCopyrightText line for the contributed changes to
quantized.h and PoolingLayer.cpp, and restore Arm's copyright line in
quantized.h to its original years.

Signed-off-by: Nathan Chandrasekar <322284620+vera-rubin@users.noreply.github.com>
@vera-rubin

Copy link
Copy Markdown
Author

Same change here as on #1319: the SPDX-FileCopyrightText line is added to quantized.h and PoolingLayer.cpp, and Arm's line in quantized.h is back to 2021-2022, 2024. The copyright for these changes is held by Donmakino LLC dba ChipLab.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants