Skip to content

perf: Speed up s8q NHWC max pooling#1292

Merged
morgolock merged 1 commit into
mainfrom
pr/pool_quant_qinfo_optim
Jun 3, 2026
Merged

perf: Speed up s8q NHWC max pooling#1292
morgolock merged 1 commit into
mainfrom
pr/pool_quant_qinfo_optim

Conversation

@morgolock
Copy link
Copy Markdown
Contributor

@morgolock morgolock commented Jun 2, 2026

Refactor the A64, SVE and SME QASYMM8_SIGNED differing-qinfo NHWC MAX pooling kernels to reduce the cost of the requantized path.

The old code did:

  • add output offset
  • explicit clamp to [-128, 127] with smax / smin
  • pack down with several uzp1 shuffles

The new code does:

  • add output offset
  • saturating narrow directly with sqxtn / sqxtn2 from s32 -> s16 -> s8

Why this helps:

  • sqxtn already performs the signed saturation, so the explicit clamp is redundant.
  • It also lets us remove a chunk of shuffle/packing work.
  • So the requantized epilogue gets shorter: fewer instructions, less register traffic, less packing overhead.

Change-Id: I47a378aeda61de86f2d6784393ccb4a08984706c

Copy link
Copy Markdown
Contributor

@gunes-arm gunes-arm left a comment

Choose a reason for hiding this comment

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

Nice work Pablo. I only have doc-related suggestions.

(1)
I suggest we remove the following section from the commit description as it's highly input configuration dependent:

For the tested diff-qinfo cases this improves steady-state latency by:
- A64: 4.7% to 5.3%
- SVE2: 0.8% to 3.9%
- SME2: 3.9% to 8.6%

(2) MR title and commit title should be the same. I'd say the following is fine; note the capital start:
perf: Speed up s8q NHWC max pooling

Refactor the A64, SVE and SME QASYMM8_SIGNED differing-qinfo NHWC MAX pooling kernels to reduce the cost of the requantized path.

 The old code did:
      - add output offset
      - explicit clamp to [-128, 127] with smax / smin
      - pack down with several uzp1 shuffles
  - The new code does:
      - add output offset
      - saturating narrow directly with sqxtn / sqxtn2 from s32 -> s16 -> s8

  Why this helps:
  - sqxtn already performs the signed saturation, so the explicit clamp is redundant.
  - It also lets us remove a chunk of shuffle/packing work.
  - So the requantized epilogue gets shorter: fewer instructions, less register traffic, less packing overhead.

Signed-off-by: Pablo Marquez Tello <pablo.tello@arm.com>
Change-Id: I47a378aeda61de86f2d6784393ccb4a08984706c
@DavidMansell
Copy link
Copy Markdown
Contributor

Looks good to me.

@morgolock morgolock force-pushed the pr/pool_quant_qinfo_optim branch from 9272e82 to f78b12c Compare June 3, 2026 09:13
@morgolock morgolock changed the title perf: speed up s8q NHWC max pooling perf: Speed up s8q NHWC max pooling Jun 3, 2026
@morgolock
Copy link
Copy Markdown
Contributor Author

Nice work Pablo. I only have doc-related suggestions.

(1) I suggest we remove the following section from the commit description as it's highly input configuration dependent:

For the tested diff-qinfo cases this improves steady-state latency by:
- A64: 4.7% to 5.3%
- SVE2: 0.8% to 3.9%
- SME2: 3.9% to 8.6%

(2) MR title and commit title should be the same. I'd say the following is fine; note the capital start: perf: Speed up s8q NHWC max pooling

Thanks. All addressed in latest patchset.

@gunes-arm
Copy link
Copy Markdown
Contributor

Can you also remove

A64: 4.7% to 5.3%
SVE2: 0.8% to 3.9%
SME2: 3.9% to 8.6%

from the description as well.

@morgolock
Copy link
Copy Markdown
Contributor Author

Can you also remove

A64: 4.7% to 5.3%
SVE2: 0.8% to 3.9%
SME2: 3.9% to 8.6%

from the description as well.

Done.

@morgolock morgolock merged commit 68d63f3 into main Jun 3, 2026
2 checks passed
@morgolock morgolock deleted the pr/pool_quant_qinfo_optim branch June 3, 2026 10:34
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.

3 participants