|
NumericAL
A header-only C++20 lexer built on REAL
|
The matrix coprocessor of Apple's M-series chips (AMX), for the double matrix product.
More...
#include <algorithm>#include <array>#include <cstring>#include <atomic>#include <cmath>#include <cstddef>#include <cstdint>#include <initializer_list>#include "simd.hpp"Go to the source code of this file.
Namespaces | |
| namespace | numerical |
| The NumericAL public API. | |
| namespace | numerical::detail |
Functions | |
| bool | numerical::detail::amx_usable () noexcept |
| Whether this chip's AMX can be used: known family and a passing self-test, decided once. | |
The matrix coprocessor of Apple's M-series chips (AMX), for the double matrix product.
Apple documents no instruction for it; the encodings used here are the ones the AMX has kept from the M1 to the M4 for loads, stores and the 64-bit fused multiply-add. Each core reaches it through instructions the assembler emits as raw words, so no compiler support is needed and the library stays header-only.
Because the instructions are not documented, the path is used only where it is known to work:
NUMERICAL_NO_AMX;std::fma in ascending order of the depth; else the path stays off for the process;NUMERICAL_AMX=0: under such a cap, not even the self-test runs.Every element of C is a chain of fused multiply-adds in ascending order of the depth, so a product through the AMX is the same on any number of threads; it differs from the vector path's separately rounded products in the last bits, as any fused product does.
Definition in file amx.hpp.