mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 12:52:33 -05:00
Optimize fastGEMM1T NEON: extend 4-wide to 8-wide outer loop unrolling - #29716 **PR Description:** - This PR extends the NEON fastGEMM1T optimization by adding an 8-wide outer loop before the existing 4-wide loop. The 8-wide block processes 8 output neurons per iteration instead of 4, reducing the total number of outer loop iterations by half and sharing the vector load cost across 8 output accumulator registers instead of 4. - On x86, the AVX2 path processes 8 floats per instruction (256-bit registers) and AVX-512 processes 16 floats per instruction (512-bit registers). On ARM, NEON is 128-bit, only 4 floats per instruction. Intel's wider registers naturally cover more outputs per inner step. This patch brings ARM NEON closer to Intel parity through wider outer loop unrolling. **Performance results:** <img width="1236" height="478" alt="image" src="https://github.com/user-attachments/assets/c933e64c-2200-450e-9887-3fd0cbdd5b8e" /> Notes: - The existing 4-wide loop is retained to handle remainders when nvecs is not a multiple of 8 - No existing tests modified - Follows the same pattern as the existing 4-wide NEON path. - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch