arXiv Science⌕ Search

arXiv · 2611.38484

Fast matrix multiplication: mixing fast, accurate schemes over a vendor GEMM, chosen by a calibrated planner

Abstract

Fast matrix multiplication is in practice a few levels of a Strassen-like scheme over a vendor's General Matrix Multiplication (GEMM) routine. We treat each scheme as an operator that takes a problem one level down, and let every level of a plan use a different one. On Apple's M4 Pro, over Accelerate's GEMM, a calibrated planner chooses among accurate forms of the $\langle 2\times2\times2:7\rangle$, $\langle 4\times4\times4:48\rangle$ and $\langle 3\times3\times6:40\rangle$ schemes. A level runs as three fused passes over memory, so its cost is the blocks it moves, not its arithmetic. At $n=13824$ the plans run $1.71\times$ (f32) and $1.88\times$ (f64) faster than Accelerate's GEMM with 0.38 and 0.50 of its error on well-scaled inputs. At 6912 and 13824 they are 5-16% faster than the best plans built from the $\langle 4\times4\times4:48\rangle$ scheme alone, with 0.57-0.75 of their error. The planner's error model predicts a plan's error from where its levels sit (a level's own rounding is multiplied by the levels above it), and the planner uses it to choose between plans of equal speed. A conventional implementation of Strassen-Winograd (one block operation at a time), the algorithm of IBM ESSL's _GEMMS, over the same GEMM is 1.21-1.54 times slower than the plans and has 1.9-9.7 times their error; fused $2\times2$ levels, which the library also has, are level with the $4\times4$ scheme at half the depth. On badly scaled inputs the plans need exact power-of-two prescaling, at up to 4% of the time, and inputs whose magnitudes cross between blocks defeat them. In f32, sharing a level's products with the GPU brings the speedup over Accelerate to $3.1\times$.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Greg Sidebottom. 2026-11-28. Fast matrix multiplication: mixing fast, accurate schemes over a vendor GEMM, chosen by a calibrated planner. https://arxiv.science/abs/2611.38484

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

The involute function and its inverse in IEEE 754 double precision: measured and proved accuracy, and its effect on gear inspection

Almost every spur and helical gear calculation uses the involute function inv(a) = tan(a) - a or its inverse. Near a = 0 the two terms almost cancel: at a = 10^-3 the textbook formula in binary64 keeps about 9 correct digits, and far fewer in binary32, binary16 or fixed point, and the result can depend on the platform's tan. We report the accuracy of a proprietary implementation that avoids these problems. On 50,000 committed test angles the forward function's largest error against an 80-digit reference is 0.4999681 ulp, so every tested result is correctly rounded (measured, not proved). The inverse is proved faithfully rounded, with error at most 0.6 ulp, for 10^-200 <= y < 2, using interval arithmetic and the SMT solvers z3 and cvc5 with a short, named list of trusted inputs; its largest measured error on 50,000 points is 0.5555115 ulp. A separate bracket around the root is proved to contain it for 0 < y <= 10^6, and did so at all 47,083 test points. Both functions return identical bits on x86-64 and aarch64 Linux, Apple-silicon macOS, AWS Lambda and an NVIDIA DGX Spark, in Python and NodeJS, on every finite test input. Against public inverse methods on nine runtimes, our inverse returned the same bits on all of them and stayed within 0.54 ulp on 12,017 targets from 0.5 to 60 degrees, while textbook Newton iterations differed between runtimes on up to about 10% of inputs and kept only 12 correct digits. For external and internal spur gears with 5 to 500 teeth and pressure angles from 14.5 to 30 degrees, all inputs fall inside the tested and proved ranges. Against ISO 1328-1 tolerance classes, we give in micrometres the errors that shortcut inverses cause in pin measurement and centre distance, and how far circular-arc CAD teeth (SolidWorks Toolbox) depart from the involute. Drawing an involute is easy; accuracy matters in inspection.

cs.MS↗

Networktools: A Header-only C++ Library for Network Optimization Problems

Networktools is an open source, header-only C++20 library for graph-based modeling and optimization, with dedicated algorithms and data structures for modeling and solving telecommunications network optimization problems. More precisely, the library provides general purpose graph data structures and algorithms for tasks such as efficient graph traversal, flow computation, matching and connectivity analysis, together with a generic API to linear and mixed integer linear programming solvers. Additionally, a dedicated traffic engineering module provides further specialized data structures and algorithms that can be used to simulate routing, assess how router or IP/optical link failures affect traffic loads, and optimize routing configurations such as link weights and/or segment routing paths.

cs.MS↗

CAMPS: Composable Adapters for Mixed-Precision Solvers

Mixed-precision solvers usually assign a fixed precision to each algorithmic component. This makes it hard to reuse a lower-precision solver at different depths inside a higher-precision solver. We introduce CAMPS (Composable Adapters for Mixed-Precision Solvers), a framework that uses iterative refinement to connect solvers across precisions. An adapter computes residuals and updates in the precision of its parent and passes each correction solve to a child solver in a lower precision. The child can be a direct solver, an iterative solver, or another adapter. The adapter checks every correction and keeps it if the residual does not increase. We prove three results. Adapters can be placed at any compatible set of precision boundaries in a solver tree without breaking the solver interface. Every output that the root solver reports as successful satisfies a backward-error bound set by the stopping tolerance and the root precision. Convergence follows from one sufficient condition per boundary, computed from the leaves of the tree to its root. We test five configurations on dense and sparse systems in 64-bit, 32-bit, and 16-bit floating-point arithmetic (FP64, FP32, and FP16). On dense well-conditioned systems, CAMPS is up to 9.6x faster than an FP64 direct solver for a single solve that includes the factorization. On sparse nonsymmetric systems, a three-precision hierarchy is the fastest method we tested. Compared with our implementation of the nested solver F3R, CAMPS is as fast and uses about 3.4x less peak memory. CAMPS does not always win. Plain conjugate gradient is faster on sparse symmetric positive definite systems. On very ill-conditioned systems, FP32 corrections fail, and the adapter detects the failure and switches to an FP64 fallback.

cs.MS↗