{"slug": "benchmarking-nested-do-loops-matmul-and-blas-dgemm", "title": "Benchmarking nested do loops, MATMUL and Blas DGEMM", "summary": "Apple's Accelerate framework outperforms GitHub Copilot-generated BLAS Level 3 dtrsm routines on Apple M1 and M2 chips, with performance jumps at matrix sizes that are multiples of 8 attributed to the AMX matrix coprocessor, according to a benchmark by corsix. The M1 and M2 feature a matrix coprocessor, while newer chips like M4 may use the Arm SME extension.", "body_md": "The M1 and M2 also have a matrix coprocessor (a special matrix acceleration unit): [GitHub - corsix/amx: Apple AMX Instruction Set · GitHub](https://github.com/corsix/amx). In newer chips (M4 and later?) they upgraded this to the [Arm SME extension](https://developer.arm.com/community/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-scalable-matrix-extension-introduction).\n\nIn the past I did some benchmarking of the BLAS Level 3 [ dtrsm](https://www.netlib.org/lapack/explore-html/d9/de5/group__trsm_ga7120d931d7b1a15e12d50d328799df8a.html) routine; in the plot below label\n\n`dtrsm`\n\nis for Apple Accelerate and the rest are variants written by GitHub Copilot, some with explicit vectorization using NEON intrinsics:Accelerate is the fastest. Notice the the big jumps when the matrix size is a multiple of 8? I believe that’s the AMX extension.", "url": "https://wpnews.pro/news/benchmarking-nested-do-loops-matmul-and-blas-dgemm", "canonical_source": "https://fortran-lang.discourse.group/t/benchmarking-nested-do-loops-matmul-and-blas-dgemm/11043#post_6", "published_at": "2026-08-27 20:59:01+00:00", "updated_at": "2026-08-27 21:19:06.868635+00:00", "lang": "en", "topics": ["machine-learning", "ai-infrastructure"], "entities": ["Apple", "GitHub Copilot", "corsix", "Arm SME", "AMX"], "alternates": {"html": "https://wpnews.pro/news/benchmarking-nested-do-loops-matmul-and-blas-dgemm", "markdown": "https://wpnews.pro/news/benchmarking-nested-do-loops-matmul-and-blas-dgemm.md", "text": "https://wpnews.pro/news/benchmarking-nested-do-loops-matmul-and-blas-dgemm.txt", "jsonld": "https://wpnews.pro/news/benchmarking-nested-do-loops-matmul-and-blas-dgemm.jsonld"}}