Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

ARM Matrix Multiplication (NEON Edition)

说明与用途

使用 ARM NEON 汇编实现矩阵乘法的指南,展示手动优化和性能测量。

问题

Implement fast matrix multiplication on ARM CPUs using NEON assembly instead of relying on GPU or high-level libraries.

结果

Hand‑written NEON assembly slightly outperforms the C compiler but remains a small fraction of the M2’s theoretical peak. SIMD vectorization yields modest gains, highlighting the need for more advanced optimizations (e.g., SME/SVE2).

工作流

  • Write reference C matrix multiplication
  • Compile with -O2 and benchmark
  • Translate naive C loops to ARM assembly
  • Benchmark assembly version
  • Add SIMD vectorization (load 4 B values, broadcast A, use fmadd)
  • Benchmark SIMD version

证据

At -O2 this runs at 2.09 Gflops, about 1.9% of our theoretical maximum.

来源

alright we have 1.98 Gflops (or about 1.8% of the theoretical max)... the c compiler is smarter than me.

来源

  • 记录日期: 2026-09-21T22:00:28.259Z